Search in sources :

Example 61 with MatchResult

use of java.util.regex.MatchResult in project logisim-evolution by reds-heig.

the class VhdlParser method parseVector.

private int parseVector(Scanner scanner, StringBuilder type) throws IllegalVhdlContentException {
    if (scanner.findWithinHorizon(Pattern.compile(VECTOR_PATTERN, Pattern.CASE_INSENSITIVE), 0) == null)
        throw new IllegalVhdlContentException(Strings.get("vectorDeclarationException"));
    MatchResult result = scanner.match();
    if (result.groupCount() != 3)
        throw new IllegalVhdlContentException(Strings.get("vectorDeclarationException"));
    type.append(getType(result.group(1).toLowerCase()));
    return Integer.parseInt(result.group(2)) - Integer.parseInt(result.group(3)) + 1;
}
Also used : MatchResult(java.util.regex.MatchResult)

Example 62 with MatchResult

use of java.util.regex.MatchResult in project ow by vtst.

the class EasyScanner method scan.

public EasyScanResult scan(Pattern pattern) {
    prepareToScan();
    MatchResult m = null;
    if (scanner.findWithinHorizon(pattern, 0) != null) {
        m = scanner.match();
    }
    EasyScanResult r = new EasyScanResult(input, m);
    if (m != null)
        seekInput(m.start());
    return r;
}
Also used : MatchResult(java.util.regex.MatchResult)

Aggregations

MatchResult (java.util.regex.MatchResult)62 Matcher (java.util.regex.Matcher)26 Pattern (java.util.regex.Pattern)16 Scanner (java.util.Scanner)11 Point (java.awt.Point)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 IOException (java.io.IOException)3 NoSuchElementException (java.util.NoSuchElementException)3 XMLStreamException (javax.xml.stream.XMLStreamException)3 MatcherState (com.github.anba.es6draft.regexp.MatcherState)2 ArrayObject (com.github.anba.es6draft.runtime.types.builtins.ArrayObject)2 InputStream (java.io.InputStream)2 Fault (org.apache.cxf.interceptor.Fault)2 CachedOutputStream (org.apache.cxf.io.CachedOutputStream)2 IterableMatchResult (com.github.anba.es6draft.regexp.IterableMatchResult)1 MatcherResult (com.github.anba.es6draft.regexp.MatcherResult)1 ScriptObject (com.github.anba.es6draft.runtime.types.ScriptObject)1 OrdinaryObject (com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)1 ImmutableMap (com.google.common.collect.ImmutableMap)1