Package uk.co.badgersinfoil.metaas.impl.parser.e4x

Examples of uk.co.badgersinfoil.metaas.impl.parser.e4x.E4XParser


  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


  }

  public static LinkedListTree parseXMLLiteral(AS3Lexer lexer, CharStream cs, LinkedListTokenStream stream) throws RecognitionException {
    String tail = cs.substring(cs.index(), cs.size()-1);
    int initialTailLength = tail.length();
    E4XParser parser;
    try {
      parser = e4xParserOn(new StringReader(tail), stream);
    } catch (IOException e) {
      // TODO: better exception type?
      throw new RuntimeException(e);
    }
    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
View Full Code Here

    // see.
    LinkedListToken startMarker = (LinkedListToken)stream.LT(-1);
    startMarker.setType(E4XParser.XML_LCHEVRON);
    stream.seek(stream.index()-1);

    E4XParser parser = new E4XParser(stream);
    parser.setTreeAdaptor(new LinkedListTreeAdaptor());
    parser.setInput(lexer, cs);
    return parser;
  }
View Full Code Here

TOP

Related Classes of uk.co.badgersinfoil.metaas.impl.parser.e4x.E4XParser

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.