Examples of GrammarASTWithOptions


Examples of org.antlr.v4.tool.ast.GrammarASTWithOptions

        {
          elementOptions.append("tokenIndex=").append(tok.getTokenIndex());
        }

        if ( node instanceof GrammarASTWithOptions ) {
          GrammarASTWithOptions o = (GrammarASTWithOptions)node;
          for (Map.Entry<String, GrammarAST> entry : o.getOptions().entrySet()) {
            if (elementOptions.length() > 0) {
              elementOptions.append(',');
            }

            elementOptions.append(entry.getKey());
View Full Code Here

Examples of org.antlr.v4.tool.ast.GrammarASTWithOptions

  /** Given ^(TOKEN_REF ^(OPTIONS ^(ELEMENT_OPTIONS (= assoc right))))
   *  set option assoc=right in TOKEN_REF.
   */
  public static void setNodeOptions(GrammarAST node, GrammarAST options) {
    if ( options==null ) return;
    GrammarASTWithOptions t = (GrammarASTWithOptions)node;
    if ( t.getChildCount()==0 || options.getChildCount()==0 ) return;
    for (Object o : options.getChildren()) {
      GrammarAST c = (GrammarAST)o;
      if ( c.getType()==ANTLRParser.ASSIGN ) {
        t.setOption(c.getChild(0).getText(), (GrammarAST)c.getChild(1));
      }
      else {
        t.setOption(c.getText(), null); // no arg such as ID<VarNodeType>
      }
    }
  }
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.