org.antlr.tool
Class AssignTokenTypesBehavior

java.lang.Object
  extended by org.antlr.runtime.BaseRecognizer
      extended by org.antlr.runtime.tree.TreeParser
          extended by org.antlr.grammar.v3.AssignTokenTypesWalker
              extended by org.antlr.tool.AssignTokenTypesBehavior

public class AssignTokenTypesBehavior
extends AssignTokenTypesWalker

Move all of the functionality from assign.types.g grammar file.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.antlr.grammar.v3.AssignTokenTypesWalker
AssignTokenTypesWalker.block_return, AssignTokenTypesWalker.modifier_return, AssignTokenTypesWalker.optionValue_return
 
Field Summary
protected  Map<String,String> aliases
           
protected  Map<String,String> aliasesReverseIndex
           
protected  Map<String,Integer> stringLiterals
           
protected  Set<String> tokenRuleDefs
          Track actual lexer rule defs so we don't get repeated token defs in generated lexer.
protected  Map<String,Integer> tokens
           
protected static Integer UNASSIGNED
           
protected static Integer UNASSIGNED_IN_PARSER_RULE
           
 
Fields inherited from class org.antlr.grammar.v3.AssignTokenTypesWalker
ACTION, ACTION_CHAR_LITERAL, ACTION_ESC, ACTION_STRING_LITERAL, ALT, AMPERSAND, ARG, ARG_ACTION, ARGLIST, ASSIGN, BACKTRACK_SEMPRED, BANG, BLOCK, CATCH, CHAR_LITERAL, CHAR_RANGE, charAlias, charAlias2, CHARSET, CLOSE_ELEMENT_OPTION, CLOSURE, COLON, COMBINED_GRAMMAR, COMMA, COMMENT, currentRuleName, DIGIT, DOC_COMMENT, DOLLAR, DOT, DOUBLE_ANGLE_STRING_LITERAL, DOUBLE_QUOTE_STRING_LITERAL, EOA, EOB, EOF, EOR, EPSILON, ESC, ETC, FINALLY, FOLLOW_ACTION_in_attrScope214, FOLLOW_ACTION_in_element982, FOLLOW_ACTION_in_exceptionHandler824, FOLLOW_ACTION_in_finallyClause839, FOLLOW_ACTION_in_ruleScopeSpec707, FOLLOW_ALT_in_alternative773, FOLLOW_alternative_in_block746, FOLLOW_AMPERSAND_in_attrScope205, FOLLOW_AMPERSAND_in_grammarSpec173, FOLLOW_AMPERSAND_in_ruleBody609, FOLLOW_AMPERSAND_in_ruleScopeSpec697, FOLLOW_ARG_ACTION_in_atom1088, FOLLOW_ARG_ACTION_in_atom1104, FOLLOW_ARG_ACTION_in_exceptionHandler822, FOLLOW_ARG_ACTION_in_ruleBody567, FOLLOW_ARG_ACTION_in_ruleBody578, FOLLOW_ARG_in_ruleBody564, FOLLOW_ASSIGN_in_delegateGrammars380, FOLLOW_ASSIGN_in_element935, FOLLOW_ASSIGN_in_option255, FOLLOW_ASSIGN_in_tokenSpec451, FOLLOW_atom_in_atom1146, FOLLOW_atom_in_element898, FOLLOW_atom_in_element915, FOLLOW_atom_in_element917, FOLLOW_atom_in_element926, FOLLOW_atom_in_element928, FOLLOW_attrScope_in_grammarSpec164, FOLLOW_BACKTRACK_SEMPRED_in_element998, FOLLOW_BANG_in_element890, FOLLOW_BLOCK_in_block731, FOLLOW_block_in_ebnf1023, FOLLOW_block_in_ebnf1032, FOLLOW_block_in_ebnf1043, FOLLOW_block_in_ebnf1054, FOLLOW_block_in_element970, FOLLOW_block_in_ruleBody622, FOLLOW_CATCH_in_exceptionHandler820, FOLLOW_CHAR_LITERAL_in_atom1118, FOLLOW_CHAR_LITERAL_in_charSetElement333, FOLLOW_CHAR_LITERAL_in_charSetElement342, FOLLOW_CHAR_LITERAL_in_charSetElement344, FOLLOW_CHAR_LITERAL_in_charSetElement355, FOLLOW_CHAR_LITERAL_in_charSetElement357, FOLLOW_CHAR_LITERAL_in_optionValue295, FOLLOW_CHAR_LITERAL_in_tokenSpec486, FOLLOW_CHAR_RANGE_in_element924, FOLLOW_CHARSET_in_charSet318, FOLLOW_charSetElement_in_charSet320, FOLLOW_CLOSURE_in_ebnf1041, FOLLOW_COMBINED_GRAMMAR_in_grammar_108, FOLLOW_delegateGrammars_in_grammarSpec150, FOLLOW_DOC_COMMENT_in_grammarSpec136, FOLLOW_DOT_in_atom1142, FOLLOW_ebnf_in_element956, FOLLOW_element_in_alternative776, FOLLOW_element_in_element883, FOLLOW_element_in_element892, FOLLOW_element_in_element906, FOLLOW_element_in_element939, FOLLOW_element_in_element950, FOLLOW_element_in_tree_1070, FOLLOW_EOA_in_alternative780, FOLLOW_EOB_in_block756, FOLLOW_EOR_in_ruleBody633, FOLLOW_EPSILON_in_element1012, FOLLOW_exceptionGroup_in_ruleBody627, FOLLOW_exceptionHandler_in_exceptionGroup795, FOLLOW_FINALLY_in_finallyClause837, FOLLOW_finallyClause_in_exceptionGroup801, FOLLOW_finallyClause_in_exceptionGroup808, FOLLOW_FORCED_ACTION_in_element977, FOLLOW_GATED_SEMPRED_in_element1007, FOLLOW_grammarSpec_in_grammar_110, FOLLOW_grammarSpec_in_grammar_68, FOLLOW_grammarSpec_in_grammar_82, FOLLOW_grammarSpec_in_grammar_98, FOLLOW_ID_in_atom1144, FOLLOW_ID_in_attrScope200, FOLLOW_ID_in_delegateGrammars382, FOLLOW_ID_in_delegateGrammars384, FOLLOW_ID_in_delegateGrammars392, FOLLOW_ID_in_element937, FOLLOW_ID_in_element948, FOLLOW_ID_in_grammarSpec129, FOLLOW_ID_in_option257, FOLLOW_ID_in_optionValue285, FOLLOW_ID_in_ruleBody548, FOLLOW_ID_in_ruleScopeSpec713, FOLLOW_ID_in_throwsSpec677, FOLLOW_IMPORT_in_delegateGrammars372, FOLLOW_INT_in_optionValue300, FOLLOW_LEXER_GRAMMAR_in_grammar_63, FOLLOW_modifier_in_ruleBody557, FOLLOW_NOT_in_element904, FOLLOW_option_in_optionsSpec236, FOLLOW_OPTIONAL_in_ebnf1030, FOLLOW_OPTIONS_in_optionsSpec233, FOLLOW_optionsSpec_in_block737, FOLLOW_optionsSpec_in_grammarSpec143, FOLLOW_optionsSpec_in_ruleBody593, FOLLOW_optionValue_in_option259, FOLLOW_OR_in_charSetElement340, FOLLOW_PARSER_GRAMMAR_in_grammar_78, FOLLOW_PLUS_ASSIGN_in_element946, FOLLOW_POSITIVE_CLOSURE_in_ebnf1052, FOLLOW_PREC_RULE_in_rule532, FOLLOW_RANGE_in_charSetElement353, FOLLOW_RANGE_in_element913, FOLLOW_RET_in_ruleBody575, FOLLOW_rewrite_in_block748, FOLLOW_REWRITE_in_rewrite857, FOLLOW_REWRITES_in_rewrite852, FOLLOW_ROOT_in_element881, FOLLOW_RULE_in_rule523, FOLLOW_rule_in_rules510, FOLLOW_RULE_REF_in_atom1085, FOLLOW_ruleBody_in_rule525, FOLLOW_ruleBody_in_rule534, FOLLOW_rules_in_grammarSpec185, FOLLOW_ruleScopeSpec_in_ruleBody600, FOLLOW_SCOPE_in_attrScope198, FOLLOW_SCOPE_in_ruleScopeSpec692, FOLLOW_SEMPRED_in_element987, FOLLOW_set_in_ast_suffix0, FOLLOW_set_in_modifier0, FOLLOW_STRING_LITERAL_in_atom1129, FOLLOW_STRING_LITERAL_in_optionValue290, FOLLOW_STRING_LITERAL_in_tokenSpec475, FOLLOW_SYN_SEMPRED_in_element992, FOLLOW_SYNPRED_in_element968, FOLLOW_THROWS_in_throwsSpec675, FOLLOW_throwsSpec_in_ruleBody586, FOLLOW_TOKEN_REF_in_atom1101, FOLLOW_TOKEN_REF_in_tokenSpec431, FOLLOW_TOKEN_REF_in_tokenSpec458, FOLLOW_TOKENS_in_tokensSpec414, FOLLOW_tokenSpec_in_tokensSpec416, FOLLOW_tokensSpec_in_grammarSpec157, FOLLOW_tree__in_element961, FOLLOW_TREE_BEGIN_in_tree_1068, FOLLOW_TREE_GRAMMAR_in_grammar_92, FOLLOW_WILDCARD_in_atom1136, FORCED_ACTION, FRAGMENT, GATED_SEMPRED, grammar, GRAMMAR, ID, IMPLIES, IMPORT, INITACTION, INT, LABEL, LEXER, LEXER_GRAMMAR, LPAREN, ML_COMMENT, NESTED_ACTION, NESTED_ARG_ACTION, NOT, OPEN_ELEMENT_OPTION, OPTIONAL, OPTIONS, OR, PARSER, PARSER_GRAMMAR, PLUS, PLUS_ASSIGN, POSITIVE_CLOSURE, PREC_RULE, PRIVATE, PROTECTED, PUBLIC, QUESTION, RANGE, RCURLY, RECURSIVE_RULE_REF, RET, RETURNS, REWRITE, REWRITES, ROOT, RPAREN, RULE, RULE_REF, SCOPE, SEMI, SEMPRED, SL_COMMENT, SRC, STAR, STRAY_BRACKET, STRING_LITERAL, stringAlias, stringAlias2, SYN_SEMPRED, SYNPRED, TEMPLATE, THROWS, TOKEN_REF, tokenNames, TOKENS, TREE, TREE_BEGIN, TREE_GRAMMAR, WILDCARD, WS, WS_LOOP, WS_OPT, XDIGIT
 
Fields inherited from class org.antlr.runtime.tree.TreeParser
DOWN, input, UP
 
Fields inherited from class org.antlr.runtime.BaseRecognizer
DEFAULT_TOKEN_CHANNEL, HIDDEN, INITIAL_FOLLOW_STACK_SIZE, MEMO_RULE_FAILED, MEMO_RULE_UNKNOWN, NEXT_TOKEN_RULE_NAME, state
 
Constructor Summary
AssignTokenTypesBehavior()
           
 
Method Summary
protected  void alias(GrammarAST t, GrammarAST s)
           
protected  void aliasTokenIDsAndLiterals(Grammar root)
           
protected  void assignStringTypes(Grammar root)
           
protected  void assignTokenIDTypes(Grammar root)
           
protected  void defineTokenNamesAndLiteralsInGrammar(Grammar root)
           
 void defineTokens(Grammar root)
           
protected  void init(Grammar g)
           
protected  void trackString(GrammarAST t)
          Track string literals (could be in tokens{} section)
protected  void trackToken(GrammarAST t)
           
protected  void trackTokenRule(GrammarAST t, GrammarAST modifier, GrammarAST block)
           
 
Methods inherited from class org.antlr.grammar.v3.AssignTokenTypesWalker
alternative, ast_suffix, atom, attrScope, block, charSet, charSetElement, defineStringLiteralsFromDelegates, delegateGrammars, ebnf, element, exceptionGroup, exceptionHandler, finallyClause, getGrammarFileName, getTokenNames, grammar_, grammarSpec, initASTPatterns, modifier, option, optionsSpec, optionValue, reportError, rewrite, rule, ruleBody, rules, ruleScopeSpec, throwsSpec, tokenSpec, tokensSpec, tree_
 
Methods inherited from class org.antlr.runtime.tree.TreeParser
getAncestor, getCurrentInputSymbol, getErrorHeader, getErrorMessage, getMissingSymbol, getSourceName, getTreeNodeStream, inContext, inContext, matchAny, recoverFromMismatchedToken, reset, setTreeNodeStream, traceIn, traceOut
 
Methods inherited from class org.antlr.runtime.BaseRecognizer
alreadyParsedRule, beginResync, combineFollows, computeContextSensitiveRuleFOLLOW, computeErrorRecoverySet, consumeUntil, consumeUntil, displayRecognitionError, emitErrorMessage, endResync, failed, getBacktrackingLevel, getNumberOfSyntaxErrors, getRuleInvocationStack, getRuleInvocationStack, getRuleMemoization, getRuleMemoizationCacheSize, getTokenErrorDisplay, match, memoize, mismatchIsMissingToken, mismatchIsUnwantedToken, pushFollow, recover, recoverFromMismatchedSet, setBacktrackingLevel, toStrings, traceIn, traceOut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNASSIGNED

protected static final Integer UNASSIGNED

UNASSIGNED_IN_PARSER_RULE

protected static final Integer UNASSIGNED_IN_PARSER_RULE

stringLiterals

protected Map<String,Integer> stringLiterals

tokens

protected Map<String,Integer> tokens

aliases

protected Map<String,String> aliases

aliasesReverseIndex

protected Map<String,String> aliasesReverseIndex

tokenRuleDefs

protected Set<String> tokenRuleDefs
Track actual lexer rule defs so we don't get repeated token defs in generated lexer.

Constructor Detail

AssignTokenTypesBehavior

public AssignTokenTypesBehavior()
Method Detail

init

protected void init(Grammar g)
Overrides:
init in class AssignTokenTypesWalker

trackString

protected void trackString(GrammarAST t)
Track string literals (could be in tokens{} section)

Overrides:
trackString in class AssignTokenTypesWalker

trackToken

protected void trackToken(GrammarAST t)
Overrides:
trackToken in class AssignTokenTypesWalker

trackTokenRule

protected void trackTokenRule(GrammarAST t,
                              GrammarAST modifier,
                              GrammarAST block)
Overrides:
trackTokenRule in class AssignTokenTypesWalker

alias

protected void alias(GrammarAST t,
                     GrammarAST s)
Overrides:
alias in class AssignTokenTypesWalker

defineTokens

public void defineTokens(Grammar root)
Overrides:
defineTokens in class AssignTokenTypesWalker

assignStringTypes

protected void assignStringTypes(Grammar root)
Overrides:
assignStringTypes in class AssignTokenTypesWalker

aliasTokenIDsAndLiterals

protected void aliasTokenIDsAndLiterals(Grammar root)
Overrides:
aliasTokenIDsAndLiterals in class AssignTokenTypesWalker

assignTokenIDTypes

protected void assignTokenIDTypes(Grammar root)
Overrides:
assignTokenIDTypes in class AssignTokenTypesWalker

defineTokenNamesAndLiteralsInGrammar

protected void defineTokenNamesAndLiteralsInGrammar(Grammar root)
Overrides:
defineTokenNamesAndLiteralsInGrammar in class AssignTokenTypesWalker


Copyright © 2011. All Rights Reserved.