Examples of defineTokenName()


Examples of org.antlr.v4.tool.Grammar.defineTokenName()

  void assignLexerTokenTypes(Grammar g, List<GrammarAST> tokensDefs) {
    Grammar G = g.getOutermostGrammar(); // put in root, even if imported
    for (GrammarAST def : tokensDefs) {
      // tokens { id (',' id)* } so must check IDs not TOKEN_REF
      if ( Grammar.isTokenName(def.getText()) ) {
        G.defineTokenName(def.getText());
      }
    }

    /* Define token types for nonfragment rules which do not include a 'type(...)'
     * or 'more' lexer command.
View Full Code Here

Examples of org.antlr.v4.tool.Grammar.defineTokenName()

    /* Define token types for nonfragment rules which do not include a 'type(...)'
     * or 'more' lexer command.
     */
    for (Rule r : g.rules.values()) {
      if ( !r.isFragment() && !hasTypeOrMoreCommand(r) ) {
        G.defineTokenName(r.name);
      }
    }

    // FOR ALL X : 'xxx'; RULES, DEFINE 'xxx' AS TYPE X
    List<Pair<GrammarAST,GrammarAST>> litAliases =
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.