private ANTLRTreePrinter.block_return Block(GrammarAST t, bool forceParens) { ANTLRTreePrinter other = new ANTLRTreePrinter(new CommonTreeNodeStream(t)); other.buf = buf; return(other.block(forceParens)); }
public string Text(GrammarAST t) { if (t == null) return null; try { ITreeNodeStream input = new CommonTreeNodeStream(new ANTLRParser.grammar_Adaptor(null), t); ANTLRTreePrinter printer = new ANTLRTreePrinter(input); return printer.toString(grammar, true); } catch (Exception e) { if (e.IsCritical()) throw; ErrorManager.Error(ErrorManager.MSG_BAD_AST_STRUCTURE, e); return null; } }
private TreeRuleReturnScope<GrammarAST> Block( GrammarAST t, bool forceParens ) { ANTLRTreePrinter other = new ANTLRTreePrinter(new CommonTreeNodeStream(t)); other.buf = buf; return other.block( forceParens ); }
public virtual void PrintGrammar( TextWriter output ) { ANTLRTreePrinter printer = new ANTLRTreePrinter( new Antlr.Runtime.Tree.CommonTreeNodeStream( grammarTree ) ); //printer.setASTNodeClass( "org.antlr.tool.GrammarAST" ); try { string g = printer.toString( this, false ); output.WriteLine( g ); } catch ( RecognitionException re ) { ErrorManager.Error( ErrorManager.MSG_SYNTAX_ERROR, re ); } }
public virtual string GrammarTreeToString( GrammarAST t, bool showActions ) { string s = null; try { s = t.Line + ":" + (t.CharPositionInLine+1) + ": "; s += new ANTLRTreePrinter( new Antlr.Runtime.Tree.CommonTreeNodeStream( t ) ).toString( this, showActions ); } catch ( Exception /*e*/ ) { s = "<invalid or missing tree structure>"; } return s; }
public ANTLRTreePrinter.block_return Block( GrammarAST t, bool forceParens ) { ANTLRTreePrinter other = new ANTLRTreePrinter( new CommonTreeNodeStream( t ) ); return other.block( forceParens ); }