Examples of ANTLRTreePrinter


Examples of org.antlr.grammar.v3.ANTLRTreePrinter

  public String grammarTreeToString(GrammarAST t, boolean showActions) {
    String s;
    try {
      s = t.getLine()+":"+(t.getCharPositionInLine()+1)+": ";
      s += new ANTLRTreePrinter(new CommonTreeNodeStream(t)).toString(this, showActions);
    }
    catch (Exception e) {
      s = "<invalid or missing tree structure>";
    }
    return s;
View Full Code Here

Examples of org.antlr.grammar.v3.ANTLRTreePrinter

    }
    return s;
  }

  public void printGrammar(PrintStream output) {
    ANTLRTreePrinter printer = new ANTLRTreePrinter(new CommonTreeNodeStream(getGrammarTree()));
    try {
      String g = printer.toString(this, false);
      output.println(g);
    }
    catch (RecognitionException re) {
      ErrorManager.error(ErrorManager.MSG_SYNTAX_ERROR,re);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.