Package org.antlr.grammar.v3
Class AssignTokenTypesWalker
- java.lang.Object
-
- org.antlr.runtime.BaseRecognizer
-
- org.antlr.runtime.tree.TreeParser
-
- org.antlr.grammar.v3.AssignTokenTypesWalker
-
- Direct Known Subclasses:
AssignTokenTypesBehavior
public class AssignTokenTypesWalker extends TreeParser
[Warning: TJP says that this is probably out of date as of 11/19/2005, but since it's probably still useful, I'll leave in. Don't have energy to update at the moment.] Compute the token types for all literals and rules etc.. There are a few different cases to consider for grammar types and a few situations within. CASE 1 : pure parser grammar a) Any reference to a token gets a token type. b) The tokens section may alias a token name to a string or char CASE 2 : pure lexer grammar a) Import token vocabulary if available. Set token types for any new tokens to values above last imported token type b) token rule definitions get token types if not already defined c) literals do NOT get token types CASE 3 : merged parser / lexer grammar a) Any char or string literal gets a token type in a parser rule b) Any reference to a token gets a token type if not referencing a fragment lexer rule c) The tokens section may alias a token name to a string or char which must add a rule to the lexer d) token rule definitions get token types if not already defined e) token rule definitions may also alias a token name to a literal. E.g., Rule 'FOR : "for";' will alias FOR to "for" in the sense that references to either in the parser grammar will yield the token type What this pass does: 0. Collects basic info about the grammar like grammar name and type; Oh, I have go get the options in case they affect the token types. E.g., tokenVocab option. Imports any token vocab name/type pairs into a local hashtable. 1. Finds a list of all literals and token names. 2. Finds a list of all token name rule definitions; no token rules implies pure parser. 3. Finds a list of all simple token rule defs of form "<NAME> : <literal>;" and aliases them. 4. Walks token names table and assign types to any unassigned 5. Walks aliases and assign types to referenced literals 6. Walks literals, assigning types if untyped 4. Informs the Grammar object of the type definitions such as: g.defineToken(<charliteral>, ttype); g.defineToken(<stringliteral>, ttype); g.defineToken(<tokenID>, ttype); where some of the ttype values will be the same for aliases tokens.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AssignTokenTypesWalker.block_return
static class
AssignTokenTypesWalker.modifier_return
static class
AssignTokenTypesWalker.optionValue_return
-
Field Summary
-
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
Constructors Constructor Description AssignTokenTypesWalker(TreeNodeStream input)
AssignTokenTypesWalker(TreeNodeStream input, RecognizerSharedState state)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
alias(GrammarAST t, GrammarAST s)
protected void
aliasTokenIDsAndLiterals(Grammar root)
void
alternative()
protected void
assignStringTypes(Grammar root)
protected void
assignTokenIDTypes(Grammar root)
void
ast_suffix()
void
atom()
void
attrScope()
AssignTokenTypesWalker.block_return
block()
void
charSet()
void
charSetElement()
protected void
defineStringLiteralsFromDelegates()
protected void
defineTokenNamesAndLiteralsInGrammar(Grammar root)
void
defineTokens(Grammar root)
void
delegateGrammars()
void
ebnf()
void
element()
void
exceptionGroup()
void
exceptionHandler()
void
finallyClause()
TreeParser[]
getDelegates()
java.lang.String
getGrammarFileName()
For debugging and other purposes, might want the grammar name.java.lang.String[]
getTokenNames()
Used to print out token names like ID during debugging and error reporting.void
grammar_(Grammar g)
void
grammarSpec()
protected void
init(Grammar root)
protected void
initASTPatterns()
AssignTokenTypesWalker.modifier_return
modifier()
void
option(java.util.Map<java.lang.Object,java.lang.Object> opts)
java.util.Map<java.lang.Object,java.lang.Object>
optionsSpec()
AssignTokenTypesWalker.optionValue_return
optionValue()
void
reportError(RecognitionException ex)
Report a recognition problem.void
rewrite()
void
rule()
void
ruleBody()
void
rules()
void
ruleScopeSpec()
void
throwsSpec()
void
tokenSpec()
void
tokensSpec()
protected void
trackString(GrammarAST t)
protected void
trackToken(GrammarAST t)
protected void
trackTokenRule(GrammarAST t, GrammarAST modifier, GrammarAST block)
void
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
-
-
-
-
Field Detail
-
tokenNames
public static final java.lang.String[] tokenNames
-
EOF
public static final int EOF
- See Also:
- Constant Field Values
-
ACTION
public static final int ACTION
- See Also:
- Constant Field Values
-
ACTION_CHAR_LITERAL
public static final int ACTION_CHAR_LITERAL
- See Also:
- Constant Field Values
-
ACTION_ESC
public static final int ACTION_ESC
- See Also:
- Constant Field Values
-
ACTION_STRING_LITERAL
public static final int ACTION_STRING_LITERAL
- See Also:
- Constant Field Values
-
ALT
public static final int ALT
- See Also:
- Constant Field Values
-
AMPERSAND
public static final int AMPERSAND
- See Also:
- Constant Field Values
-
ARG
public static final int ARG
- See Also:
- Constant Field Values
-
ARGLIST
public static final int ARGLIST
- See Also:
- Constant Field Values
-
ARG_ACTION
public static final int ARG_ACTION
- See Also:
- Constant Field Values
-
ASSIGN
public static final int ASSIGN
- See Also:
- Constant Field Values
-
BACKTRACK_SEMPRED
public static final int BACKTRACK_SEMPRED
- See Also:
- Constant Field Values
-
BANG
public static final int BANG
- See Also:
- Constant Field Values
-
BLOCK
public static final int BLOCK
- See Also:
- Constant Field Values
-
CATCH
public static final int CATCH
- See Also:
- Constant Field Values
-
CHAR_LITERAL
public static final int CHAR_LITERAL
- See Also:
- Constant Field Values
-
CHAR_RANGE
public static final int CHAR_RANGE
- See Also:
- Constant Field Values
-
CLOSE_ELEMENT_OPTION
public static final int CLOSE_ELEMENT_OPTION
- See Also:
- Constant Field Values
-
CLOSURE
public static final int CLOSURE
- See Also:
- Constant Field Values
-
COLON
public static final int COLON
- See Also:
- Constant Field Values
-
COMBINED_GRAMMAR
public static final int COMBINED_GRAMMAR
- See Also:
- Constant Field Values
-
COMMA
public static final int COMMA
- See Also:
- Constant Field Values
-
COMMENT
public static final int COMMENT
- See Also:
- Constant Field Values
-
DIGIT
public static final int DIGIT
- See Also:
- Constant Field Values
-
DOC_COMMENT
public static final int DOC_COMMENT
- See Also:
- Constant Field Values
-
DOLLAR
public static final int DOLLAR
- See Also:
- Constant Field Values
-
DOT
public static final int DOT
- See Also:
- Constant Field Values
-
DOUBLE_ANGLE_STRING_LITERAL
public static final int DOUBLE_ANGLE_STRING_LITERAL
- See Also:
- Constant Field Values
-
DOUBLE_QUOTE_STRING_LITERAL
public static final int DOUBLE_QUOTE_STRING_LITERAL
- See Also:
- Constant Field Values
-
EOA
public static final int EOA
- See Also:
- Constant Field Values
-
EOB
public static final int EOB
- See Also:
- Constant Field Values
-
EOR
public static final int EOR
- See Also:
- Constant Field Values
-
EPSILON
public static final int EPSILON
- See Also:
- Constant Field Values
-
ESC
public static final int ESC
- See Also:
- Constant Field Values
-
ETC
public static final int ETC
- See Also:
- Constant Field Values
-
FINALLY
public static final int FINALLY
- See Also:
- Constant Field Values
-
FORCED_ACTION
public static final int FORCED_ACTION
- See Also:
- Constant Field Values
-
FRAGMENT
public static final int FRAGMENT
- See Also:
- Constant Field Values
-
GATED_SEMPRED
public static final int GATED_SEMPRED
- See Also:
- Constant Field Values
-
GRAMMAR
public static final int GRAMMAR
- See Also:
- Constant Field Values
-
ID
public static final int ID
- See Also:
- Constant Field Values
-
IMPLIES
public static final int IMPLIES
- See Also:
- Constant Field Values
-
IMPORT
public static final int IMPORT
- See Also:
- Constant Field Values
-
INITACTION
public static final int INITACTION
- See Also:
- Constant Field Values
-
INT
public static final int INT
- See Also:
- Constant Field Values
-
LABEL
public static final int LABEL
- See Also:
- Constant Field Values
-
LEXER
public static final int LEXER
- See Also:
- Constant Field Values
-
LEXER_GRAMMAR
public static final int LEXER_GRAMMAR
- See Also:
- Constant Field Values
-
LPAREN
public static final int LPAREN
- See Also:
- Constant Field Values
-
ML_COMMENT
public static final int ML_COMMENT
- See Also:
- Constant Field Values
-
NESTED_ACTION
public static final int NESTED_ACTION
- See Also:
- Constant Field Values
-
NESTED_ARG_ACTION
public static final int NESTED_ARG_ACTION
- See Also:
- Constant Field Values
-
NOT
public static final int NOT
- See Also:
- Constant Field Values
-
OPEN_ELEMENT_OPTION
public static final int OPEN_ELEMENT_OPTION
- See Also:
- Constant Field Values
-
OPTIONAL
public static final int OPTIONAL
- See Also:
- Constant Field Values
-
OPTIONS
public static final int OPTIONS
- See Also:
- Constant Field Values
-
OR
public static final int OR
- See Also:
- Constant Field Values
-
PARSER
public static final int PARSER
- See Also:
- Constant Field Values
-
PARSER_GRAMMAR
public static final int PARSER_GRAMMAR
- See Also:
- Constant Field Values
-
PLUS
public static final int PLUS
- See Also:
- Constant Field Values
-
PLUS_ASSIGN
public static final int PLUS_ASSIGN
- See Also:
- Constant Field Values
-
POSITIVE_CLOSURE
public static final int POSITIVE_CLOSURE
- See Also:
- Constant Field Values
-
PREC_RULE
public static final int PREC_RULE
- See Also:
- Constant Field Values
-
PRIVATE
public static final int PRIVATE
- See Also:
- Constant Field Values
-
PROTECTED
public static final int PROTECTED
- See Also:
- Constant Field Values
-
PUBLIC
public static final int PUBLIC
- See Also:
- Constant Field Values
-
QUESTION
public static final int QUESTION
- See Also:
- Constant Field Values
-
RANGE
public static final int RANGE
- See Also:
- Constant Field Values
-
RCURLY
public static final int RCURLY
- See Also:
- Constant Field Values
-
RECURSIVE_RULE_REF
public static final int RECURSIVE_RULE_REF
- See Also:
- Constant Field Values
-
RET
public static final int RET
- See Also:
- Constant Field Values
-
RETURNS
public static final int RETURNS
- See Also:
- Constant Field Values
-
REWRITE
public static final int REWRITE
- See Also:
- Constant Field Values
-
REWRITES
public static final int REWRITES
- See Also:
- Constant Field Values
-
ROOT
public static final int ROOT
- See Also:
- Constant Field Values
-
RPAREN
public static final int RPAREN
- See Also:
- Constant Field Values
-
RULE
public static final int RULE
- See Also:
- Constant Field Values
-
RULE_REF
public static final int RULE_REF
- See Also:
- Constant Field Values
-
SCOPE
public static final int SCOPE
- See Also:
- Constant Field Values
-
SEMI
public static final int SEMI
- See Also:
- Constant Field Values
-
SEMPRED
public static final int SEMPRED
- See Also:
- Constant Field Values
-
SL_COMMENT
public static final int SL_COMMENT
- See Also:
- Constant Field Values
-
SRC
public static final int SRC
- See Also:
- Constant Field Values
-
STAR
public static final int STAR
- See Also:
- Constant Field Values
-
STRAY_BRACKET
public static final int STRAY_BRACKET
- See Also:
- Constant Field Values
-
STRING_LITERAL
public static final int STRING_LITERAL
- See Also:
- Constant Field Values
-
SYNPRED
public static final int SYNPRED
- See Also:
- Constant Field Values
-
SYN_SEMPRED
public static final int SYN_SEMPRED
- See Also:
- Constant Field Values
-
TEMPLATE
public static final int TEMPLATE
- See Also:
- Constant Field Values
-
THROWS
public static final int THROWS
- See Also:
- Constant Field Values
-
TOKENS
public static final int TOKENS
- See Also:
- Constant Field Values
-
TOKEN_REF
public static final int TOKEN_REF
- See Also:
- Constant Field Values
-
TREE
public static final int TREE
- See Also:
- Constant Field Values
-
TREE_BEGIN
public static final int TREE_BEGIN
- See Also:
- Constant Field Values
-
TREE_GRAMMAR
public static final int TREE_GRAMMAR
- See Also:
- Constant Field Values
-
WILDCARD
public static final int WILDCARD
- See Also:
- Constant Field Values
-
WS
public static final int WS
- See Also:
- Constant Field Values
-
WS_LOOP
public static final int WS_LOOP
- See Also:
- Constant Field Values
-
WS_OPT
public static final int WS_OPT
- See Also:
- Constant Field Values
-
XDIGIT
public static final int XDIGIT
- See Also:
- Constant Field Values
-
CHARSET
public static final int CHARSET
- See Also:
- Constant Field Values
-
grammar
protected Grammar grammar
-
currentRuleName
protected java.lang.String currentRuleName
-
stringAlias
protected static GrammarAST stringAlias
-
charAlias
protected static GrammarAST charAlias
-
stringAlias2
protected static GrammarAST stringAlias2
-
charAlias2
protected static GrammarAST charAlias2
-
FOLLOW_LEXER_GRAMMAR_in_grammar_69
public static final BitSet FOLLOW_LEXER_GRAMMAR_in_grammar_69
-
FOLLOW_grammarSpec_in_grammar_74
public static final BitSet FOLLOW_grammarSpec_in_grammar_74
-
FOLLOW_PARSER_GRAMMAR_in_grammar_84
public static final BitSet FOLLOW_PARSER_GRAMMAR_in_grammar_84
-
FOLLOW_grammarSpec_in_grammar_88
public static final BitSet FOLLOW_grammarSpec_in_grammar_88
-
FOLLOW_TREE_GRAMMAR_in_grammar_98
public static final BitSet FOLLOW_TREE_GRAMMAR_in_grammar_98
-
FOLLOW_grammarSpec_in_grammar_104
public static final BitSet FOLLOW_grammarSpec_in_grammar_104
-
FOLLOW_COMBINED_GRAMMAR_in_grammar_114
public static final BitSet FOLLOW_COMBINED_GRAMMAR_in_grammar_114
-
FOLLOW_grammarSpec_in_grammar_116
public static final BitSet FOLLOW_grammarSpec_in_grammar_116
-
FOLLOW_ID_in_grammarSpec135
public static final BitSet FOLLOW_ID_in_grammarSpec135
-
FOLLOW_DOC_COMMENT_in_grammarSpec142
public static final BitSet FOLLOW_DOC_COMMENT_in_grammarSpec142
-
FOLLOW_optionsSpec_in_grammarSpec149
public static final BitSet FOLLOW_optionsSpec_in_grammarSpec149
-
FOLLOW_delegateGrammars_in_grammarSpec156
public static final BitSet FOLLOW_delegateGrammars_in_grammarSpec156
-
FOLLOW_tokensSpec_in_grammarSpec163
public static final BitSet FOLLOW_tokensSpec_in_grammarSpec163
-
FOLLOW_attrScope_in_grammarSpec170
public static final BitSet FOLLOW_attrScope_in_grammarSpec170
-
FOLLOW_AMPERSAND_in_grammarSpec179
public static final BitSet FOLLOW_AMPERSAND_in_grammarSpec179
-
FOLLOW_rules_in_grammarSpec191
public static final BitSet FOLLOW_rules_in_grammarSpec191
-
FOLLOW_SCOPE_in_attrScope204
public static final BitSet FOLLOW_SCOPE_in_attrScope204
-
FOLLOW_ID_in_attrScope206
public static final BitSet FOLLOW_ID_in_attrScope206
-
FOLLOW_AMPERSAND_in_attrScope211
public static final BitSet FOLLOW_AMPERSAND_in_attrScope211
-
FOLLOW_ACTION_in_attrScope220
public static final BitSet FOLLOW_ACTION_in_attrScope220
-
FOLLOW_OPTIONS_in_optionsSpec239
public static final BitSet FOLLOW_OPTIONS_in_optionsSpec239
-
FOLLOW_option_in_optionsSpec242
public static final BitSet FOLLOW_option_in_optionsSpec242
-
FOLLOW_ASSIGN_in_option261
public static final BitSet FOLLOW_ASSIGN_in_option261
-
FOLLOW_ID_in_option263
public static final BitSet FOLLOW_ID_in_option263
-
FOLLOW_optionValue_in_option265
public static final BitSet FOLLOW_optionValue_in_option265
-
FOLLOW_ID_in_optionValue291
public static final BitSet FOLLOW_ID_in_optionValue291
-
FOLLOW_STRING_LITERAL_in_optionValue296
public static final BitSet FOLLOW_STRING_LITERAL_in_optionValue296
-
FOLLOW_CHAR_LITERAL_in_optionValue301
public static final BitSet FOLLOW_CHAR_LITERAL_in_optionValue301
-
FOLLOW_INT_in_optionValue306
public static final BitSet FOLLOW_INT_in_optionValue306
-
FOLLOW_CHARSET_in_charSet324
public static final BitSet FOLLOW_CHARSET_in_charSet324
-
FOLLOW_charSetElement_in_charSet326
public static final BitSet FOLLOW_charSetElement_in_charSet326
-
FOLLOW_CHAR_LITERAL_in_charSetElement339
public static final BitSet FOLLOW_CHAR_LITERAL_in_charSetElement339
-
FOLLOW_OR_in_charSetElement346
public static final BitSet FOLLOW_OR_in_charSetElement346
-
FOLLOW_CHAR_LITERAL_in_charSetElement348
public static final BitSet FOLLOW_CHAR_LITERAL_in_charSetElement348
-
FOLLOW_CHAR_LITERAL_in_charSetElement350
public static final BitSet FOLLOW_CHAR_LITERAL_in_charSetElement350
-
FOLLOW_RANGE_in_charSetElement359
public static final BitSet FOLLOW_RANGE_in_charSetElement359
-
FOLLOW_CHAR_LITERAL_in_charSetElement361
public static final BitSet FOLLOW_CHAR_LITERAL_in_charSetElement361
-
FOLLOW_CHAR_LITERAL_in_charSetElement363
public static final BitSet FOLLOW_CHAR_LITERAL_in_charSetElement363
-
FOLLOW_IMPORT_in_delegateGrammars378
public static final BitSet FOLLOW_IMPORT_in_delegateGrammars378
-
FOLLOW_ASSIGN_in_delegateGrammars386
public static final BitSet FOLLOW_ASSIGN_in_delegateGrammars386
-
FOLLOW_ID_in_delegateGrammars388
public static final BitSet FOLLOW_ID_in_delegateGrammars388
-
FOLLOW_ID_in_delegateGrammars390
public static final BitSet FOLLOW_ID_in_delegateGrammars390
-
FOLLOW_ID_in_delegateGrammars398
public static final BitSet FOLLOW_ID_in_delegateGrammars398
-
FOLLOW_TOKENS_in_tokensSpec420
public static final BitSet FOLLOW_TOKENS_in_tokensSpec420
-
FOLLOW_tokenSpec_in_tokensSpec422
public static final BitSet FOLLOW_tokenSpec_in_tokensSpec422
-
FOLLOW_TOKEN_REF_in_tokenSpec437
public static final BitSet FOLLOW_TOKEN_REF_in_tokenSpec437
-
FOLLOW_ASSIGN_in_tokenSpec457
public static final BitSet FOLLOW_ASSIGN_in_tokenSpec457
-
FOLLOW_TOKEN_REF_in_tokenSpec464
public static final BitSet FOLLOW_TOKEN_REF_in_tokenSpec464
-
FOLLOW_STRING_LITERAL_in_tokenSpec481
public static final BitSet FOLLOW_STRING_LITERAL_in_tokenSpec481
-
FOLLOW_CHAR_LITERAL_in_tokenSpec492
public static final BitSet FOLLOW_CHAR_LITERAL_in_tokenSpec492
-
FOLLOW_rule_in_rules516
public static final BitSet FOLLOW_rule_in_rules516
-
FOLLOW_RULE_in_rule529
public static final BitSet FOLLOW_RULE_in_rule529
-
FOLLOW_ruleBody_in_rule531
public static final BitSet FOLLOW_ruleBody_in_rule531
-
FOLLOW_PREC_RULE_in_rule538
public static final BitSet FOLLOW_PREC_RULE_in_rule538
-
FOLLOW_ruleBody_in_rule540
public static final BitSet FOLLOW_ruleBody_in_rule540
-
FOLLOW_ID_in_ruleBody554
public static final BitSet FOLLOW_ID_in_ruleBody554
-
FOLLOW_modifier_in_ruleBody563
public static final BitSet FOLLOW_modifier_in_ruleBody563
-
FOLLOW_ARG_in_ruleBody570
public static final BitSet FOLLOW_ARG_in_ruleBody570
-
FOLLOW_ARG_ACTION_in_ruleBody573
public static final BitSet FOLLOW_ARG_ACTION_in_ruleBody573
-
FOLLOW_RET_in_ruleBody581
public static final BitSet FOLLOW_RET_in_ruleBody581
-
FOLLOW_ARG_ACTION_in_ruleBody584
public static final BitSet FOLLOW_ARG_ACTION_in_ruleBody584
-
FOLLOW_throwsSpec_in_ruleBody592
public static final BitSet FOLLOW_throwsSpec_in_ruleBody592
-
FOLLOW_optionsSpec_in_ruleBody599
public static final BitSet FOLLOW_optionsSpec_in_ruleBody599
-
FOLLOW_ruleScopeSpec_in_ruleBody606
public static final BitSet FOLLOW_ruleScopeSpec_in_ruleBody606
-
FOLLOW_AMPERSAND_in_ruleBody615
public static final BitSet FOLLOW_AMPERSAND_in_ruleBody615
-
FOLLOW_block_in_ruleBody628
public static final BitSet FOLLOW_block_in_ruleBody628
-
FOLLOW_exceptionGroup_in_ruleBody633
public static final BitSet FOLLOW_exceptionGroup_in_ruleBody633
-
FOLLOW_EOR_in_ruleBody639
public static final BitSet FOLLOW_EOR_in_ruleBody639
-
FOLLOW_THROWS_in_throwsSpec681
public static final BitSet FOLLOW_THROWS_in_throwsSpec681
-
FOLLOW_ID_in_throwsSpec683
public static final BitSet FOLLOW_ID_in_throwsSpec683
-
FOLLOW_SCOPE_in_ruleScopeSpec698
public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec698
-
FOLLOW_AMPERSAND_in_ruleScopeSpec703
public static final BitSet FOLLOW_AMPERSAND_in_ruleScopeSpec703
-
FOLLOW_ACTION_in_ruleScopeSpec713
public static final BitSet FOLLOW_ACTION_in_ruleScopeSpec713
-
FOLLOW_ID_in_ruleScopeSpec719
public static final BitSet FOLLOW_ID_in_ruleScopeSpec719
-
FOLLOW_BLOCK_in_block737
public static final BitSet FOLLOW_BLOCK_in_block737
-
FOLLOW_optionsSpec_in_block743
public static final BitSet FOLLOW_optionsSpec_in_block743
-
FOLLOW_alternative_in_block752
public static final BitSet FOLLOW_alternative_in_block752
-
FOLLOW_rewrite_in_block754
public static final BitSet FOLLOW_rewrite_in_block754
-
FOLLOW_EOB_in_block762
public static final BitSet FOLLOW_EOB_in_block762
-
FOLLOW_ALT_in_alternative779
public static final BitSet FOLLOW_ALT_in_alternative779
-
FOLLOW_element_in_alternative782
public static final BitSet FOLLOW_element_in_alternative782
-
FOLLOW_EOA_in_alternative786
public static final BitSet FOLLOW_EOA_in_alternative786
-
FOLLOW_exceptionHandler_in_exceptionGroup801
public static final BitSet FOLLOW_exceptionHandler_in_exceptionGroup801
-
FOLLOW_finallyClause_in_exceptionGroup807
public static final BitSet FOLLOW_finallyClause_in_exceptionGroup807
-
FOLLOW_finallyClause_in_exceptionGroup814
public static final BitSet FOLLOW_finallyClause_in_exceptionGroup814
-
FOLLOW_CATCH_in_exceptionHandler826
public static final BitSet FOLLOW_CATCH_in_exceptionHandler826
-
FOLLOW_ARG_ACTION_in_exceptionHandler828
public static final BitSet FOLLOW_ARG_ACTION_in_exceptionHandler828
-
FOLLOW_ACTION_in_exceptionHandler830
public static final BitSet FOLLOW_ACTION_in_exceptionHandler830
-
FOLLOW_FINALLY_in_finallyClause843
public static final BitSet FOLLOW_FINALLY_in_finallyClause843
-
FOLLOW_ACTION_in_finallyClause845
public static final BitSet FOLLOW_ACTION_in_finallyClause845
-
FOLLOW_REWRITES_in_rewrite858
public static final BitSet FOLLOW_REWRITES_in_rewrite858
-
FOLLOW_REWRITE_in_rewrite863
public static final BitSet FOLLOW_REWRITE_in_rewrite863
-
FOLLOW_ROOT_in_element887
public static final BitSet FOLLOW_ROOT_in_element887
-
FOLLOW_element_in_element889
public static final BitSet FOLLOW_element_in_element889
-
FOLLOW_BANG_in_element896
public static final BitSet FOLLOW_BANG_in_element896
-
FOLLOW_element_in_element898
public static final BitSet FOLLOW_element_in_element898
-
FOLLOW_atom_in_element904
public static final BitSet FOLLOW_atom_in_element904
-
FOLLOW_NOT_in_element910
public static final BitSet FOLLOW_NOT_in_element910
-
FOLLOW_element_in_element912
public static final BitSet FOLLOW_element_in_element912
-
FOLLOW_RANGE_in_element919
public static final BitSet FOLLOW_RANGE_in_element919
-
FOLLOW_atom_in_element921
public static final BitSet FOLLOW_atom_in_element921
-
FOLLOW_atom_in_element923
public static final BitSet FOLLOW_atom_in_element923
-
FOLLOW_CHAR_RANGE_in_element930
public static final BitSet FOLLOW_CHAR_RANGE_in_element930
-
FOLLOW_atom_in_element932
public static final BitSet FOLLOW_atom_in_element932
-
FOLLOW_atom_in_element934
public static final BitSet FOLLOW_atom_in_element934
-
FOLLOW_ASSIGN_in_element941
public static final BitSet FOLLOW_ASSIGN_in_element941
-
FOLLOW_ID_in_element943
public static final BitSet FOLLOW_ID_in_element943
-
FOLLOW_element_in_element945
public static final BitSet FOLLOW_element_in_element945
-
FOLLOW_PLUS_ASSIGN_in_element952
public static final BitSet FOLLOW_PLUS_ASSIGN_in_element952
-
FOLLOW_ID_in_element954
public static final BitSet FOLLOW_ID_in_element954
-
FOLLOW_element_in_element956
public static final BitSet FOLLOW_element_in_element956
-
FOLLOW_ebnf_in_element962
public static final BitSet FOLLOW_ebnf_in_element962
-
FOLLOW_tree__in_element967
public static final BitSet FOLLOW_tree__in_element967
-
FOLLOW_SYNPRED_in_element974
public static final BitSet FOLLOW_SYNPRED_in_element974
-
FOLLOW_block_in_element976
public static final BitSet FOLLOW_block_in_element976
-
FOLLOW_FORCED_ACTION_in_element983
public static final BitSet FOLLOW_FORCED_ACTION_in_element983
-
FOLLOW_ACTION_in_element988
public static final BitSet FOLLOW_ACTION_in_element988
-
FOLLOW_SEMPRED_in_element993
public static final BitSet FOLLOW_SEMPRED_in_element993
-
FOLLOW_SYN_SEMPRED_in_element998
public static final BitSet FOLLOW_SYN_SEMPRED_in_element998
-
FOLLOW_BACKTRACK_SEMPRED_in_element1004
public static final BitSet FOLLOW_BACKTRACK_SEMPRED_in_element1004
-
FOLLOW_GATED_SEMPRED_in_element1013
public static final BitSet FOLLOW_GATED_SEMPRED_in_element1013
-
FOLLOW_EPSILON_in_element1018
public static final BitSet FOLLOW_EPSILON_in_element1018
-
FOLLOW_block_in_ebnf1029
public static final BitSet FOLLOW_block_in_ebnf1029
-
FOLLOW_OPTIONAL_in_ebnf1036
public static final BitSet FOLLOW_OPTIONAL_in_ebnf1036
-
FOLLOW_block_in_ebnf1038
public static final BitSet FOLLOW_block_in_ebnf1038
-
FOLLOW_CLOSURE_in_ebnf1047
public static final BitSet FOLLOW_CLOSURE_in_ebnf1047
-
FOLLOW_block_in_ebnf1049
public static final BitSet FOLLOW_block_in_ebnf1049
-
FOLLOW_POSITIVE_CLOSURE_in_ebnf1058
public static final BitSet FOLLOW_POSITIVE_CLOSURE_in_ebnf1058
-
FOLLOW_block_in_ebnf1060
public static final BitSet FOLLOW_block_in_ebnf1060
-
FOLLOW_TREE_BEGIN_in_tree_1074
public static final BitSet FOLLOW_TREE_BEGIN_in_tree_1074
-
FOLLOW_element_in_tree_1076
public static final BitSet FOLLOW_element_in_tree_1076
-
FOLLOW_RULE_REF_in_atom1091
public static final BitSet FOLLOW_RULE_REF_in_atom1091
-
FOLLOW_ARG_ACTION_in_atom1094
public static final BitSet FOLLOW_ARG_ACTION_in_atom1094
-
FOLLOW_TOKEN_REF_in_atom1107
public static final BitSet FOLLOW_TOKEN_REF_in_atom1107
-
FOLLOW_ARG_ACTION_in_atom1110
public static final BitSet FOLLOW_ARG_ACTION_in_atom1110
-
FOLLOW_CHAR_LITERAL_in_atom1124
public static final BitSet FOLLOW_CHAR_LITERAL_in_atom1124
-
FOLLOW_STRING_LITERAL_in_atom1135
public static final BitSet FOLLOW_STRING_LITERAL_in_atom1135
-
FOLLOW_WILDCARD_in_atom1142
public static final BitSet FOLLOW_WILDCARD_in_atom1142
-
FOLLOW_DOT_in_atom1148
public static final BitSet FOLLOW_DOT_in_atom1148
-
FOLLOW_ID_in_atom1150
public static final BitSet FOLLOW_ID_in_atom1150
-
FOLLOW_atom_in_atom1152
public static final BitSet FOLLOW_atom_in_atom1152
-
-
Constructor Detail
-
AssignTokenTypesWalker
public AssignTokenTypesWalker(TreeNodeStream input)
-
AssignTokenTypesWalker
public AssignTokenTypesWalker(TreeNodeStream input, RecognizerSharedState state)
-
-
Method Detail
-
getDelegates
public TreeParser[] getDelegates()
-
getTokenNames
public java.lang.String[] getTokenNames()
Description copied from class:BaseRecognizer
Used to print out token names like ID during debugging and error reporting. The generated parsers implement a method that overrides this to point to their String[] tokenNames.- Overrides:
getTokenNames
in classBaseRecognizer
-
getGrammarFileName
public java.lang.String getGrammarFileName()
Description copied from class:BaseRecognizer
For debugging and other purposes, might want the grammar name. Have ANTLR generate an implementation for this method.- Overrides:
getGrammarFileName
in classBaseRecognizer
-
reportError
public void reportError(RecognitionException ex)
Description copied from class:BaseRecognizer
Report a recognition problem. This method sets errorRecovery to indicate the parser is recovering not parsing. Once in recovery mode, no errors are generated. To get out of recovery mode, the parser must successfully match a token (after a resync). So it will go: 1. error occurs 2. enter recovery mode, report error 3. consume until token found in resynch set 4. try to resume parsing 5. next match() will reset errorRecovery mode If you override, make sure to update syntaxErrors if you care about that.- Overrides:
reportError
in classBaseRecognizer
-
initASTPatterns
protected void initASTPatterns()
-
trackString
protected void trackString(GrammarAST t)
-
trackToken
protected void trackToken(GrammarAST t)
-
trackTokenRule
protected void trackTokenRule(GrammarAST t, GrammarAST modifier, GrammarAST block)
-
alias
protected void alias(GrammarAST t, GrammarAST s)
-
defineTokens
public void defineTokens(Grammar root)
-
defineStringLiteralsFromDelegates
protected void defineStringLiteralsFromDelegates()
-
assignStringTypes
protected void assignStringTypes(Grammar root)
-
aliasTokenIDsAndLiterals
protected void aliasTokenIDsAndLiterals(Grammar root)
-
assignTokenIDTypes
protected void assignTokenIDTypes(Grammar root)
-
defineTokenNamesAndLiteralsInGrammar
protected void defineTokenNamesAndLiteralsInGrammar(Grammar root)
-
init
protected void init(Grammar root)
-
grammar_
public final void grammar_(Grammar g) throws RecognitionException
- Throws:
RecognitionException
-
grammarSpec
public final void grammarSpec() throws RecognitionException
- Throws:
RecognitionException
-
attrScope
public final void attrScope() throws RecognitionException
- Throws:
RecognitionException
-
optionsSpec
public final java.util.Map<java.lang.Object,java.lang.Object> optionsSpec() throws RecognitionException
- Throws:
RecognitionException
-
option
public final void option(java.util.Map<java.lang.Object,java.lang.Object> opts) throws RecognitionException
- Throws:
RecognitionException
-
optionValue
public final AssignTokenTypesWalker.optionValue_return optionValue() throws RecognitionException
- Throws:
RecognitionException
-
charSet
public final void charSet() throws RecognitionException
- Throws:
RecognitionException
-
charSetElement
public final void charSetElement() throws RecognitionException
- Throws:
RecognitionException
-
delegateGrammars
public final void delegateGrammars() throws RecognitionException
- Throws:
RecognitionException
-
tokensSpec
public final void tokensSpec() throws RecognitionException
- Throws:
RecognitionException
-
tokenSpec
public final void tokenSpec() throws RecognitionException
- Throws:
RecognitionException
-
rules
public final void rules() throws RecognitionException
- Throws:
RecognitionException
-
rule
public final void rule() throws RecognitionException
- Throws:
RecognitionException
-
ruleBody
public final void ruleBody() throws RecognitionException
- Throws:
RecognitionException
-
modifier
public final AssignTokenTypesWalker.modifier_return modifier() throws RecognitionException
- Throws:
RecognitionException
-
throwsSpec
public final void throwsSpec() throws RecognitionException
- Throws:
RecognitionException
-
ruleScopeSpec
public final void ruleScopeSpec() throws RecognitionException
- Throws:
RecognitionException
-
block
public final AssignTokenTypesWalker.block_return block() throws RecognitionException
- Throws:
RecognitionException
-
alternative
public final void alternative() throws RecognitionException
- Throws:
RecognitionException
-
exceptionGroup
public final void exceptionGroup() throws RecognitionException
- Throws:
RecognitionException
-
exceptionHandler
public final void exceptionHandler() throws RecognitionException
- Throws:
RecognitionException
-
finallyClause
public final void finallyClause() throws RecognitionException
- Throws:
RecognitionException
-
rewrite
public final void rewrite() throws RecognitionException
- Throws:
RecognitionException
-
element
public final void element() throws RecognitionException
- Throws:
RecognitionException
-
ebnf
public final void ebnf() throws RecognitionException
- Throws:
RecognitionException
-
tree_
public final void tree_() throws RecognitionException
- Throws:
RecognitionException
-
atom
public final void atom() throws RecognitionException
- Throws:
RecognitionException
-
ast_suffix
public final void ast_suffix() throws RecognitionException
- Throws:
RecognitionException
-
-