Examples of RegexSimpleParser


Examples of uk.co.badgersinfoil.metaas.impl.parser.regexsimple.RegexSimpleParser

  public static RegexSimpleParser parserOn(Reader in) throws IOException {
    ANTLRReaderStream cs = new ANTLRReaderStream(in);
    RegexSimpleLexer lexer = new RegexSimpleLexer(cs);
    LinkedListTokenSource source = new LinkedListTokenSource(lexer);
    LinkedListTokenStream stream = new LinkedListTokenStream(source);
    RegexSimpleParser parser = new RegexSimpleParser(stream);
    parser.setTreeAdaptor(TREE_ADAPTOR);
    parser.setInput(lexer, cs);
    return parser;
  }
View Full Code Here

Examples of uk.co.badgersinfoil.metaas.impl.parser.regexsimple.RegexSimpleParser

  }

  public static LinkedListTree parseRegexpLiteral(LinkedListToken startMarker, AS3Lexer lexer, CharStream cs, LinkedListTokenStream stream) throws RecognitionException {
    String tail = cs.substring(cs.index(), cs.size()-1);
    int initialTailLength = tail.length();
    RegexSimpleParser parser;
    try {
      parser = regexpParserOn(new StringReader(tail), stream);
    } catch (IOException e) {
      // TODO: better exception type?
      throw new RuntimeException(e);
    }
    LinkedListTree ast = AS3FragmentParser.tree(parser.regexpLiteral());
    tail = parser.getInputTail();
    // skip over the regexp in the original, underlying CharStream
    cs.seek(cs.index() + (initialTailLength - tail.length()));
    LinkedListTokenSource source = (LinkedListTokenSource)stream.getTokenSource();
    stream.setTokenSource(source)// cause any remembered RegexpSimple state to be dropped
    stream.scrub(1); // erase the subsequent token that the RegexpSimple parser got from this stream
View Full Code Here

Examples of uk.co.badgersinfoil.metaas.impl.parser.regexsimple.RegexSimpleParser

    // SinpleRegexpParser will see.
    LinkedListToken startMarker = (LinkedListToken)stream.LT(-1);
    startMarker.setType(RegexSimpleParser.REGEXP_DELIMITER);
    stream.seek(stream.index()-1);

    RegexSimpleParser parser = new RegexSimpleParser(stream);
    parser.setTreeAdaptor(new LinkedListTreeAdaptor());
    parser.setInput(lexer, cs);
    return parser;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.