/** Creates a tree parser for a given tree of this kind. */ public <P extends TreeParser> P createTreeParser(Class<P> parserType, I info) { try { // instantiate the parser ParseTreeAdaptor<T,I> adaptor = new ParseTreeAdaptor<>(this); Constructor<P> parserConstructor = parserType.getConstructor(TreeNodeStream.class); P result = parserConstructor.newInstance(adaptor.createTreeNodeStream(this)); Method adaptorSetter = parserType.getMethod("setTreeAdaptor", TreeAdaptor.class); adaptorSetter.invoke(result, adaptor); callInitialise(result, info); return result; } catch (Exception e) { throw toRuntime(e); } }
public TreeParser[] getDelegates() { return new TreeParser[] {}; }
public String extractLine(TreeParser parser, RecognitionException e) { return extractLine(parser.getTreeNodeStream().getTokenStream(), e); }