Examples of TerminalAST


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

      String rname = combinedGrammar.getStringLiteralLexerRuleName(lit);
      // can't use wizard; need special node types
      GrammarAST litRule = new RuleAST(ANTLRParser.RULE);
      BlockAST blk = new BlockAST(ANTLRParser.BLOCK);
      AltAST alt = new AltAST(ANTLRParser.ALT);
      TerminalAST slit = new TerminalAST(new CommonToken(ANTLRParser.STRING_LITERAL, lit));
      alt.addChild(slit);
      blk.addChild(alt);
      CommonToken idToken = new CommonToken(ANTLRParser.TOKEN_REF, rname);
      litRule.addChild(new TerminalAST(idToken));
      litRule.addChild(blk);
      lexerRulesRoot.insertChild(insertIndex, litRule);
//      lexerRulesRoot.getChildren().add(0, litRule);
      lexerRulesRoot.freshenParentAndChildIndexes(); // reset indexes and set litRule parent
View Full Code Here

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

          t = new RuleAST(new CommonToken(tokenType, text));
    }
    else if ( tokenType==ANTLRParser.STRING_LITERAL ) {
      // implicit lexer construction done with wizard; needs this node type
      // whereas grammar ANTLRParser.g can use token option to spec node type
      t = new TerminalAST(new CommonToken(tokenType, text));
    }
    else {
      t = (GrammarAST)super.create(tokenType, text);
    }
        t.token.setInputStream(input);
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.