}
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