Package uk.co.badgersinfoil.metaas.impl.antlr

Examples of uk.co.badgersinfoil.metaas.impl.antlr.LinkedListTokenSource


   * Creates a properly-configured parser object for the E4X grammar.
   */
  public static E4XParser parserOn(Reader in) throws IOException {
    ANTLRReaderStream cs = new ANTLRReaderStream(in);
    E4XLexer lexer = new E4XLexer(cs);
    LinkedListTokenSource source = new LinkedListTokenSource(lexer);
    LinkedListTokenStream stream = new LinkedListTokenStream(source);
    E4XParser parser = new E4XParser(stream);
    parser.setTreeAdaptor(TREE_ADAPTOR);
    parser.setInput(lexer, cs);
    return parser;
View Full Code Here


    }
    LinkedListTree ast = AS3FragmentParser.tree(parser.xmlPrimary());
    tail = parser.getInputTail();
    // skip over the XML in the original, underlying CharStream
    cs.seek(cs.index() + (initialTailLength - tail.length()));
    LinkedListTokenSource source = (LinkedListTokenSource)stream.getTokenSource();
    stream.setTokenSource(source)// cause any remembered E4X state to be dropped
    stream.scrub(1); // erase the subsequent token that the E4X parser got from this stream
    source.setDelegate(lexer);
    return ast;
  }
View Full Code Here

  }

  private static E4XParser e4xParserOn(Reader in, LinkedListTokenStream stream) throws IOException {
    ANTLRReaderStream cs = new ANTLRReaderStream(in);
    E4XLexer lexer = new E4XLexer(cs);
    LinkedListTokenSource source = (LinkedListTokenSource)stream.getTokenSource();
    source.setDelegate(lexer);
   
    // The AS3 grammar will see the initial '<' as an LT (less-than)
    // token, and lookahead in the AS3Parser will have already
    // grabbed references to that token in order to make it the
    // startToken for various AST subtrees, so we can't just delete
View Full Code Here

   * Creates a properly-configured parser object for the E4X grammar.
   */
  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

    }
    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
    source.setDelegate(lexer);
    return ast;
  }
View Full Code Here

  }

  private static RegexSimpleParser regexpParserOn(Reader in, LinkedListTokenStream stream) throws IOException {
    ANTLRReaderStream cs = new ANTLRReaderStream(in);
    RegexSimpleLexer lexer = new RegexSimpleLexer(cs);
    LinkedListTokenSource source = (LinkedListTokenSource)stream.getTokenSource();
    source.setDelegate(lexer);

    // The AS3 grammar will see the initial '/' as an DIV (divide)
    // token, and lookahead in the AS3Parser will have already
    // grabbed references to that token in order to make it the
    // startToken for various AST subtrees, so we can't just delete
View Full Code Here

  private static JavadocParser parserOn(String text) throws IOException {
    StringReader in = new StringReader(text);
    ANTLRReaderStream cs = new ANTLRReaderStream(in);
    JavadocLexer lexer = new JavadocLexer(cs);
    LinkedListTokenSource source = new LinkedListTokenSource(lexer);
    LinkedListTokenStream stream = new LinkedListTokenStream(source);
    JavadocParser parser = new JavadocParser(stream);
    parser.setTreeAdaptor(TREE_ADAPTOR);
    return parser;
  }
View Full Code Here

      cs = new ANTLRReaderStream(in);
    } catch (IOException e) {
      throw new SyntaxException(e);
    }
    AS3Lexer lexer = new AS3Lexer(cs);
    LinkedListTokenSource linker = new LinkedListTokenSource(lexer);
    LinkedListTokenStream tokenStream = new LinkedListTokenStream(linker);
    AS3Parser parser = new AS3Parser(tokenStream);
    parser.setInput(lexer, cs);
    parser.setTreeAdaptor(TREE_ADAPTOR);
    return parser;
View Full Code Here

TOP

Related Classes of uk.co.badgersinfoil.metaas.impl.antlr.LinkedListTokenSource

Copyright © 2018 www.massapicom. 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.