org.antlr.grammar.v3
Class AssignTokenTypesWalker

java.lang.Object
  extended by org.antlr.runtime.BaseRecognizer
      extended by org.antlr.runtime.tree.TreeParser
          extended by 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 " : ;" 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(, ttype); g.defineToken(, ttype); g.defineToken(, ttype); where some of the ttype values will be the same for aliases tokens.


Nested Class Summary
static class AssignTokenTypesWalker.block_return
           
static class AssignTokenTypesWalker.modifier_return
           
static class AssignTokenTypesWalker.optionValue_return
           
 
Field Summary
static int ACTION
           
static int ACTION_CHAR_LITERAL
           
static int ACTION_ESC
           
static int ACTION_STRING_LITERAL
           
static int ALT
           
static int AMPERSAND
           
static int ARG
           
static int ARG_ACTION
           
static int ARGLIST
           
static int ASSIGN
           
static int BACKTRACK_SEMPRED
           
static int BANG
           
static int BLOCK
           
static int CATCH
           
static int CHAR_LITERAL
           
static int CHAR_RANGE
           
protected static GrammarAST charAlias
           
protected static GrammarAST charAlias2
           
static int CHARSET
           
static int CLOSE_ELEMENT_OPTION
           
static int CLOSURE
           
static int COLON
           
static int COMBINED_GRAMMAR
           
static int COMMA
           
static int COMMENT
           
protected  String currentRuleName
           
static int DIGIT
           
static int DOC_COMMENT
           
static int DOLLAR
           
static int DOT
           
static int DOUBLE_ANGLE_STRING_LITERAL
           
static int DOUBLE_QUOTE_STRING_LITERAL
           
static int EOA
           
static int EOB
           
static int EOF
           
static int EOR
           
static int EPSILON
           
static int ESC
           
static int ETC
           
static int FINALLY
           
static BitSet FOLLOW_ACTION_in_attrScope214
           
static BitSet FOLLOW_ACTION_in_element982
           
static BitSet FOLLOW_ACTION_in_exceptionHandler824
           
static BitSet FOLLOW_ACTION_in_finallyClause839
           
static BitSet FOLLOW_ACTION_in_ruleScopeSpec707
           
static BitSet FOLLOW_ALT_in_alternative773
           
static BitSet FOLLOW_alternative_in_block746
           
static BitSet FOLLOW_AMPERSAND_in_attrScope205
           
static BitSet FOLLOW_AMPERSAND_in_grammarSpec173
           
static BitSet FOLLOW_AMPERSAND_in_ruleBody609
           
static BitSet FOLLOW_AMPERSAND_in_ruleScopeSpec697
           
static BitSet FOLLOW_ARG_ACTION_in_atom1088
           
static BitSet FOLLOW_ARG_ACTION_in_atom1104
           
static BitSet FOLLOW_ARG_ACTION_in_exceptionHandler822
           
static BitSet FOLLOW_ARG_ACTION_in_ruleBody567
           
static BitSet FOLLOW_ARG_ACTION_in_ruleBody578
           
static BitSet FOLLOW_ARG_in_ruleBody564
           
static BitSet FOLLOW_ASSIGN_in_delegateGrammars380
           
static BitSet FOLLOW_ASSIGN_in_element935
           
static BitSet FOLLOW_ASSIGN_in_option255
           
static BitSet FOLLOW_ASSIGN_in_tokenSpec451
           
static BitSet FOLLOW_atom_in_atom1146
           
static BitSet FOLLOW_atom_in_element898
           
static BitSet FOLLOW_atom_in_element915
           
static BitSet FOLLOW_atom_in_element917
           
static BitSet FOLLOW_atom_in_element926
           
static BitSet FOLLOW_atom_in_element928
           
static BitSet FOLLOW_attrScope_in_grammarSpec164
           
static BitSet FOLLOW_BACKTRACK_SEMPRED_in_element998
           
static BitSet FOLLOW_BANG_in_element890
           
static BitSet FOLLOW_BLOCK_in_block731
           
static BitSet FOLLOW_block_in_ebnf1023
           
static BitSet FOLLOW_block_in_ebnf1032
           
static BitSet FOLLOW_block_in_ebnf1043
           
static BitSet FOLLOW_block_in_ebnf1054
           
static BitSet FOLLOW_block_in_element970
           
static BitSet FOLLOW_block_in_ruleBody622
           
static BitSet FOLLOW_CATCH_in_exceptionHandler820
           
static BitSet FOLLOW_CHAR_LITERAL_in_atom1118
           
static BitSet FOLLOW_CHAR_LITERAL_in_charSetElement333
           
static BitSet FOLLOW_CHAR_LITERAL_in_charSetElement342
           
static BitSet FOLLOW_CHAR_LITERAL_in_charSetElement344
           
static BitSet FOLLOW_CHAR_LITERAL_in_charSetElement355
           
static BitSet FOLLOW_CHAR_LITERAL_in_charSetElement357
           
static BitSet FOLLOW_CHAR_LITERAL_in_optionValue295
           
static BitSet FOLLOW_CHAR_LITERAL_in_tokenSpec486
           
static BitSet FOLLOW_CHAR_RANGE_in_element924
           
static BitSet FOLLOW_CHARSET_in_charSet318
           
static BitSet FOLLOW_charSetElement_in_charSet320
           
static BitSet FOLLOW_CLOSURE_in_ebnf1041
           
static BitSet FOLLOW_COMBINED_GRAMMAR_in_grammar_108
           
static BitSet FOLLOW_delegateGrammars_in_grammarSpec150
           
static BitSet FOLLOW_DOC_COMMENT_in_grammarSpec136
           
static BitSet FOLLOW_DOT_in_atom1142
           
static BitSet FOLLOW_ebnf_in_element956
           
static BitSet FOLLOW_element_in_alternative776
           
static BitSet FOLLOW_element_in_element883
           
static BitSet FOLLOW_element_in_element892
           
static BitSet FOLLOW_element_in_element906
           
static BitSet FOLLOW_element_in_element939
           
static BitSet FOLLOW_element_in_element950
           
static BitSet FOLLOW_element_in_tree_1070
           
static BitSet FOLLOW_EOA_in_alternative780
           
static BitSet FOLLOW_EOB_in_block756
           
static BitSet FOLLOW_EOR_in_ruleBody633
           
static BitSet FOLLOW_EPSILON_in_element1012
           
static BitSet FOLLOW_exceptionGroup_in_ruleBody627
           
static BitSet FOLLOW_exceptionHandler_in_exceptionGroup795
           
static BitSet FOLLOW_FINALLY_in_finallyClause837
           
static BitSet FOLLOW_finallyClause_in_exceptionGroup801
           
static BitSet FOLLOW_finallyClause_in_exceptionGroup808
           
static BitSet FOLLOW_FORCED_ACTION_in_element977
           
static BitSet FOLLOW_GATED_SEMPRED_in_element1007
           
static BitSet FOLLOW_grammarSpec_in_grammar_110
           
static BitSet FOLLOW_grammarSpec_in_grammar_68
           
static BitSet FOLLOW_grammarSpec_in_grammar_82
           
static BitSet FOLLOW_grammarSpec_in_grammar_98
           
static BitSet FOLLOW_ID_in_atom1144
           
static BitSet FOLLOW_ID_in_attrScope200
           
static BitSet FOLLOW_ID_in_delegateGrammars382
           
static BitSet FOLLOW_ID_in_delegateGrammars384
           
static BitSet FOLLOW_ID_in_delegateGrammars392
           
static BitSet FOLLOW_ID_in_element937
           
static BitSet FOLLOW_ID_in_element948
           
static BitSet FOLLOW_ID_in_grammarSpec129
           
static BitSet FOLLOW_ID_in_option257
           
static BitSet FOLLOW_ID_in_optionValue285
           
static BitSet FOLLOW_ID_in_ruleBody548
           
static BitSet FOLLOW_ID_in_ruleScopeSpec713
           
static BitSet FOLLOW_ID_in_throwsSpec677
           
static BitSet FOLLOW_IMPORT_in_delegateGrammars372
           
static BitSet FOLLOW_INT_in_optionValue300
           
static BitSet FOLLOW_LEXER_GRAMMAR_in_grammar_63
           
static BitSet FOLLOW_modifier_in_ruleBody557
           
static BitSet FOLLOW_NOT_in_element904
           
static BitSet FOLLOW_option_in_optionsSpec236
           
static BitSet FOLLOW_OPTIONAL_in_ebnf1030
           
static BitSet FOLLOW_OPTIONS_in_optionsSpec233
           
static BitSet FOLLOW_optionsSpec_in_block737
           
static BitSet FOLLOW_optionsSpec_in_grammarSpec143
           
static BitSet FOLLOW_optionsSpec_in_ruleBody593
           
static BitSet FOLLOW_optionValue_in_option259
           
static BitSet FOLLOW_OR_in_charSetElement340
           
static BitSet FOLLOW_PARSER_GRAMMAR_in_grammar_78
           
static BitSet FOLLOW_PLUS_ASSIGN_in_element946
           
static BitSet FOLLOW_POSITIVE_CLOSURE_in_ebnf1052
           
static BitSet FOLLOW_PREC_RULE_in_rule532
           
static BitSet FOLLOW_RANGE_in_charSetElement353
           
static BitSet FOLLOW_RANGE_in_element913
           
static BitSet FOLLOW_RET_in_ruleBody575
           
static BitSet FOLLOW_rewrite_in_block748
           
static BitSet FOLLOW_REWRITE_in_rewrite857
           
static BitSet FOLLOW_REWRITES_in_rewrite852
           
static BitSet FOLLOW_ROOT_in_element881
           
static BitSet FOLLOW_RULE_in_rule523
           
static BitSet FOLLOW_rule_in_rules510
           
static BitSet FOLLOW_RULE_REF_in_atom1085
           
static BitSet FOLLOW_ruleBody_in_rule525
           
static BitSet FOLLOW_ruleBody_in_rule534
           
static BitSet FOLLOW_rules_in_grammarSpec185
           
static BitSet FOLLOW_ruleScopeSpec_in_ruleBody600
           
static BitSet FOLLOW_SCOPE_in_attrScope198
           
static BitSet FOLLOW_SCOPE_in_ruleScopeSpec692
           
static BitSet FOLLOW_SEMPRED_in_element987
           
static BitSet FOLLOW_set_in_ast_suffix0
           
static BitSet FOLLOW_set_in_modifier0
           
static BitSet FOLLOW_STRING_LITERAL_in_atom1129
           
static BitSet FOLLOW_STRING_LITERAL_in_optionValue290
           
static BitSet FOLLOW_STRING_LITERAL_in_tokenSpec475
           
static BitSet FOLLOW_SYN_SEMPRED_in_element992
           
static BitSet FOLLOW_SYNPRED_in_element968
           
static BitSet FOLLOW_THROWS_in_throwsSpec675
           
static BitSet FOLLOW_throwsSpec_in_ruleBody586
           
static BitSet FOLLOW_TOKEN_REF_in_atom1101
           
static BitSet FOLLOW_TOKEN_REF_in_tokenSpec431
           
static BitSet FOLLOW_TOKEN_REF_in_tokenSpec458
           
static BitSet FOLLOW_TOKENS_in_tokensSpec414
           
static BitSet FOLLOW_tokenSpec_in_tokensSpec416
           
static BitSet FOLLOW_tokensSpec_in_grammarSpec157
           
static BitSet FOLLOW_tree__in_element961
           
static BitSet FOLLOW_TREE_BEGIN_in_tree_1068
           
static BitSet FOLLOW_TREE_GRAMMAR_in_grammar_92
           
static BitSet FOLLOW_WILDCARD_in_atom1136
           
static int FORCED_ACTION
           
static int FRAGMENT
           
static int GATED_SEMPRED
           
protected  Grammar grammar
           
static int GRAMMAR
           
static int ID
           
static int IMPLIES
           
static int IMPORT
           
static int INITACTION
           
static int INT
           
static int LABEL
           
static int LEXER
           
static int LEXER_GRAMMAR
           
static int LPAREN
           
static int ML_COMMENT
           
static int NESTED_ACTION
           
static int NESTED_ARG_ACTION
           
static int NOT
           
static int OPEN_ELEMENT_OPTION
           
static int OPTIONAL
           
static int OPTIONS
           
static int OR
           
static int PARSER
           
static int PARSER_GRAMMAR
           
static int PLUS
           
static int PLUS_ASSIGN
           
static int POSITIVE_CLOSURE
           
static int PREC_RULE
           
static int PRIVATE
           
static int PROTECTED
           
static int PUBLIC
           
static int QUESTION
           
static int RANGE
           
static int RCURLY
           
static int RECURSIVE_RULE_REF
           
static int RET
           
static int RETURNS
           
static int REWRITE
           
static int REWRITES
           
static int ROOT
           
static int RPAREN
           
static int RULE
           
static int RULE_REF
           
static int SCOPE
           
static int SEMI
           
static int SEMPRED
           
static int SL_COMMENT
           
static int SRC
           
static int STAR
           
static int STRAY_BRACKET
           
static int STRING_LITERAL
           
protected static GrammarAST stringAlias
           
protected static GrammarAST stringAlias2
           
static int SYN_SEMPRED
           
static int SYNPRED
           
static int TEMPLATE
           
static int THROWS
           
static int TOKEN_REF
           
static String[] tokenNames
           
static int TOKENS
           
static int TREE
           
static int TREE_BEGIN
           
static int TREE_GRAMMAR
           
static int WILDCARD
           
static int WS
           
static int WS_LOOP
           
static int WS_OPT
           
static int 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
AssignTokenTypesWalker(TreeNodeStream input)
           
AssignTokenTypesWalker(TreeNodeStream input, RecognizerSharedState state)
           
 
Method Summary
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()
           
 String getGrammarFileName()
           
 String[] getTokenNames()
           
 void grammar_(Grammar g)
           
 void grammarSpec()
           
protected  void init(Grammar root)
           
protected  void initASTPatterns()
           
 AssignTokenTypesWalker.modifier_return modifier()
           
 void option(Map<Object,Object> opts)
           
 Map<Object,Object> optionsSpec()
           
 AssignTokenTypesWalker.optionValue_return optionValue()
           
 void reportError(RecognitionException ex)
           
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokenNames

public static final String[] tokenNames

EOF

public static final int EOF
See Also:
Constant Field Values

LEXER

public static final int LEXER
See Also:
Constant Field Values

PARSER

public static final int PARSER
See Also:
Constant Field Values

CATCH

public static final int CATCH
See Also:
Constant Field Values

FINALLY

public static final int FINALLY
See Also:
Constant Field Values

GRAMMAR

public static final int GRAMMAR
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

RETURNS

public static final int RETURNS
See Also:
Constant Field Values

THROWS

public static final int THROWS
See Also:
Constant Field Values

TREE

public static final int TREE
See Also:
Constant Field Values

RULE

public static final int RULE
See Also:
Constant Field Values

PREC_RULE

public static final int PREC_RULE
See Also:
Constant Field Values

RECURSIVE_RULE_REF

public static final int RECURSIVE_RULE_REF
See Also:
Constant Field Values

BLOCK

public static final int BLOCK
See Also:
Constant Field Values

OPTIONAL

public static final int OPTIONAL
See Also:
Constant Field Values

CLOSURE

public static final int CLOSURE
See Also:
Constant Field Values

POSITIVE_CLOSURE

public static final int POSITIVE_CLOSURE
See Also:
Constant Field Values

SYNPRED

public static final int SYNPRED
See Also:
Constant Field Values

RANGE

public static final int RANGE
See Also:
Constant Field Values

CHAR_RANGE

public static final int CHAR_RANGE
See Also:
Constant Field Values

EPSILON

public static final int EPSILON
See Also:
Constant Field Values

ALT

public static final int ALT
See Also:
Constant Field Values

EOR

public static final int EOR
See Also:
Constant Field Values

EOB

public static final int EOB
See Also:
Constant Field Values

EOA

public static final int EOA
See Also:
Constant Field Values

ID

public static final int ID
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

RET

public static final int RET
See Also:
Constant Field Values

LEXER_GRAMMAR

public static final int LEXER_GRAMMAR
See Also:
Constant Field Values

PARSER_GRAMMAR

public static final int PARSER_GRAMMAR
See Also:
Constant Field Values

TREE_GRAMMAR

public static final int TREE_GRAMMAR
See Also:
Constant Field Values

COMBINED_GRAMMAR

public static final int COMBINED_GRAMMAR
See Also:
Constant Field Values

INITACTION

public static final int INITACTION
See Also:
Constant Field Values

FORCED_ACTION

public static final int FORCED_ACTION
See Also:
Constant Field Values

LABEL

public static final int LABEL
See Also:
Constant Field Values

TEMPLATE

public static final int TEMPLATE
See Also:
Constant Field Values

SCOPE

public static final int SCOPE
See Also:
Constant Field Values

IMPORT

public static final int IMPORT
See Also:
Constant Field Values

GATED_SEMPRED

public static final int GATED_SEMPRED
See Also:
Constant Field Values

SYN_SEMPRED

public static final int SYN_SEMPRED
See Also:
Constant Field Values

BACKTRACK_SEMPRED

public static final int BACKTRACK_SEMPRED
See Also:
Constant Field Values

FRAGMENT

public static final int FRAGMENT
See Also:
Constant Field Values

DOT

public static final int DOT
See Also:
Constant Field Values

REWRITES

public static final int REWRITES
See Also:
Constant Field Values

ACTION

public static final int ACTION
See Also:
Constant Field Values

DOC_COMMENT

public static final int DOC_COMMENT
See Also:
Constant Field Values

SEMI

public static final int SEMI
See Also:
Constant Field Values

AMPERSAND

public static final int AMPERSAND
See Also:
Constant Field Values

COLON

public static final int COLON
See Also:
Constant Field Values

OPTIONS

public static final int OPTIONS
See Also:
Constant Field Values

RCURLY

public static final int RCURLY
See Also:
Constant Field Values

ASSIGN

public static final int ASSIGN
See Also:
Constant Field Values

STRING_LITERAL

public static final int STRING_LITERAL
See Also:
Constant Field Values

CHAR_LITERAL

public static final int CHAR_LITERAL
See Also:
Constant Field Values

INT

public static final int INT
See Also:
Constant Field Values

STAR

public static final int STAR
See Also:
Constant Field Values

COMMA

public static final int COMMA
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

BANG

public static final int BANG
See Also:
Constant Field Values

ARG_ACTION

public static final int ARG_ACTION
See Also:
Constant Field Values

OR

public static final int OR
See Also:
Constant Field Values

LPAREN

public static final int LPAREN
See Also:
Constant Field Values

RPAREN

public static final int RPAREN
See Also:
Constant Field Values

PLUS_ASSIGN

public static final int PLUS_ASSIGN
See Also:
Constant Field Values

SEMPRED

public static final int SEMPRED
See Also:
Constant Field Values

IMPLIES

public static final int IMPLIES
See Also:
Constant Field Values

ROOT

public static final int ROOT
See Also:
Constant Field Values

WILDCARD

public static final int WILDCARD
See Also:
Constant Field Values

RULE_REF

public static final int RULE_REF
See Also:
Constant Field Values

NOT

public static final int NOT
See Also:
Constant Field Values

TREE_BEGIN

public static final int TREE_BEGIN
See Also:
Constant Field Values

QUESTION

public static final int QUESTION
See Also:
Constant Field Values

PLUS

public static final int PLUS
See Also:
Constant Field Values

OPEN_ELEMENT_OPTION

public static final int OPEN_ELEMENT_OPTION
See Also:
Constant Field Values

CLOSE_ELEMENT_OPTION

public static final int CLOSE_ELEMENT_OPTION
See Also:
Constant Field Values

DOUBLE_QUOTE_STRING_LITERAL

public static final int DOUBLE_QUOTE_STRING_LITERAL
See Also:
Constant Field Values

DOUBLE_ANGLE_STRING_LITERAL

public static final int DOUBLE_ANGLE_STRING_LITERAL
See Also:
Constant Field Values

REWRITE

public static final int REWRITE
See Also:
Constant Field Values

ETC

public static final int ETC
See Also:
Constant Field Values

DOLLAR

public static final int DOLLAR
See Also:
Constant Field Values

WS

public static final int WS
See Also:
Constant Field Values

SL_COMMENT

public static final int SL_COMMENT
See Also:
Constant Field Values

ML_COMMENT

public static final int ML_COMMENT
See Also:
Constant Field Values

COMMENT

public static final int COMMENT
See Also:
Constant Field Values

SRC

public static final int SRC
See Also:
Constant Field Values

STRAY_BRACKET

public static final int STRAY_BRACKET
See Also:
Constant Field Values

ESC

public static final int ESC
See Also:
Constant Field Values

DIGIT

public static final int DIGIT
See Also:
Constant Field Values

XDIGIT

public static final int XDIGIT
See Also:
Constant Field Values

NESTED_ARG_ACTION

public static final int NESTED_ARG_ACTION
See Also:
Constant Field Values

ACTION_STRING_LITERAL

public static final int ACTION_STRING_LITERAL
See Also:
Constant Field Values

ACTION_CHAR_LITERAL

public static final int ACTION_CHAR_LITERAL
See Also:
Constant Field Values

NESTED_ACTION

public static final int NESTED_ACTION
See Also:
Constant Field Values

ACTION_ESC

public static final int ACTION_ESC
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

CHARSET

public static final int CHARSET
See Also:
Constant Field Values

grammar

protected Grammar grammar

currentRuleName

protected 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_63

public static final BitSet FOLLOW_LEXER_GRAMMAR_in_grammar_63

FOLLOW_grammarSpec_in_grammar_68

public static final BitSet FOLLOW_grammarSpec_in_grammar_68

FOLLOW_PARSER_GRAMMAR_in_grammar_78

public static final BitSet FOLLOW_PARSER_GRAMMAR_in_grammar_78

FOLLOW_grammarSpec_in_grammar_82

public static final BitSet FOLLOW_grammarSpec_in_grammar_82

FOLLOW_TREE_GRAMMAR_in_grammar_92

public static final BitSet FOLLOW_TREE_GRAMMAR_in_grammar_92

FOLLOW_grammarSpec_in_grammar_98

public static final BitSet FOLLOW_grammarSpec_in_grammar_98

FOLLOW_COMBINED_GRAMMAR_in_grammar_108

public static final BitSet FOLLOW_COMBINED_GRAMMAR_in_grammar_108

FOLLOW_grammarSpec_in_grammar_110

public static final BitSet FOLLOW_grammarSpec_in_grammar_110

FOLLOW_ID_in_grammarSpec129

public static final BitSet FOLLOW_ID_in_grammarSpec129

FOLLOW_DOC_COMMENT_in_grammarSpec136

public static final BitSet FOLLOW_DOC_COMMENT_in_grammarSpec136

FOLLOW_optionsSpec_in_grammarSpec143

public static final BitSet FOLLOW_optionsSpec_in_grammarSpec143

FOLLOW_delegateGrammars_in_grammarSpec150

public static final BitSet FOLLOW_delegateGrammars_in_grammarSpec150

FOLLOW_tokensSpec_in_grammarSpec157

public static final BitSet FOLLOW_tokensSpec_in_grammarSpec157

FOLLOW_attrScope_in_grammarSpec164

public static final BitSet FOLLOW_attrScope_in_grammarSpec164

FOLLOW_AMPERSAND_in_grammarSpec173

public static final BitSet FOLLOW_AMPERSAND_in_grammarSpec173

FOLLOW_rules_in_grammarSpec185

public static final BitSet FOLLOW_rules_in_grammarSpec185

FOLLOW_SCOPE_in_attrScope198

public static final BitSet FOLLOW_SCOPE_in_attrScope198

FOLLOW_ID_in_attrScope200

public static final BitSet FOLLOW_ID_in_attrScope200

FOLLOW_AMPERSAND_in_attrScope205

public static final BitSet FOLLOW_AMPERSAND_in_attrScope205

FOLLOW_ACTION_in_attrScope214

public static final BitSet FOLLOW_ACTION_in_attrScope214

FOLLOW_OPTIONS_in_optionsSpec233

public static final BitSet FOLLOW_OPTIONS_in_optionsSpec233

FOLLOW_option_in_optionsSpec236

public static final BitSet FOLLOW_option_in_optionsSpec236

FOLLOW_ASSIGN_in_option255

public static final BitSet FOLLOW_ASSIGN_in_option255

FOLLOW_ID_in_option257

public static final BitSet FOLLOW_ID_in_option257

FOLLOW_optionValue_in_option259

public static final BitSet FOLLOW_optionValue_in_option259

FOLLOW_ID_in_optionValue285

public static final BitSet FOLLOW_ID_in_optionValue285

FOLLOW_STRING_LITERAL_in_optionValue290

public static final BitSet FOLLOW_STRING_LITERAL_in_optionValue290

FOLLOW_CHAR_LITERAL_in_optionValue295

public static final BitSet FOLLOW_CHAR_LITERAL_in_optionValue295

FOLLOW_INT_in_optionValue300

public static final BitSet FOLLOW_INT_in_optionValue300

FOLLOW_CHARSET_in_charSet318

public static final BitSet FOLLOW_CHARSET_in_charSet318

FOLLOW_charSetElement_in_charSet320

public static final BitSet FOLLOW_charSetElement_in_charSet320

FOLLOW_CHAR_LITERAL_in_charSetElement333

public static final BitSet FOLLOW_CHAR_LITERAL_in_charSetElement333

FOLLOW_OR_in_charSetElement340

public static final BitSet FOLLOW_OR_in_charSetElement340

FOLLOW_CHAR_LITERAL_in_charSetElement342

public static final BitSet FOLLOW_CHAR_LITERAL_in_charSetElement342

FOLLOW_CHAR_LITERAL_in_charSetElement344

public static final BitSet FOLLOW_CHAR_LITERAL_in_charSetElement344

FOLLOW_RANGE_in_charSetElement353

public static final BitSet FOLLOW_RANGE_in_charSetElement353

FOLLOW_CHAR_LITERAL_in_charSetElement355

public static final BitSet FOLLOW_CHAR_LITERAL_in_charSetElement355

FOLLOW_CHAR_LITERAL_in_charSetElement357

public static final BitSet FOLLOW_CHAR_LITERAL_in_charSetElement357

FOLLOW_IMPORT_in_delegateGrammars372

public static final BitSet FOLLOW_IMPORT_in_delegateGrammars372

FOLLOW_ASSIGN_in_delegateGrammars380

public static final BitSet FOLLOW_ASSIGN_in_delegateGrammars380

FOLLOW_ID_in_delegateGrammars382

public static final BitSet FOLLOW_ID_in_delegateGrammars382

FOLLOW_ID_in_delegateGrammars384

public static final BitSet FOLLOW_ID_in_delegateGrammars384

FOLLOW_ID_in_delegateGrammars392

public static final BitSet FOLLOW_ID_in_delegateGrammars392

FOLLOW_TOKENS_in_tokensSpec414

public static final BitSet FOLLOW_TOKENS_in_tokensSpec414

FOLLOW_tokenSpec_in_tokensSpec416

public static final BitSet FOLLOW_tokenSpec_in_tokensSpec416

FOLLOW_TOKEN_REF_in_tokenSpec431

public static final BitSet FOLLOW_TOKEN_REF_in_tokenSpec431

FOLLOW_ASSIGN_in_tokenSpec451

public static final BitSet FOLLOW_ASSIGN_in_tokenSpec451

FOLLOW_TOKEN_REF_in_tokenSpec458

public static final BitSet FOLLOW_TOKEN_REF_in_tokenSpec458

FOLLOW_STRING_LITERAL_in_tokenSpec475

public static final BitSet FOLLOW_STRING_LITERAL_in_tokenSpec475

FOLLOW_CHAR_LITERAL_in_tokenSpec486

public static final BitSet FOLLOW_CHAR_LITERAL_in_tokenSpec486

FOLLOW_rule_in_rules510

public static final BitSet FOLLOW_rule_in_rules510

FOLLOW_RULE_in_rule523

public static final BitSet FOLLOW_RULE_in_rule523

FOLLOW_ruleBody_in_rule525

public static final BitSet FOLLOW_ruleBody_in_rule525

FOLLOW_PREC_RULE_in_rule532

public static final BitSet FOLLOW_PREC_RULE_in_rule532

FOLLOW_ruleBody_in_rule534

public static final BitSet FOLLOW_ruleBody_in_rule534

FOLLOW_ID_in_ruleBody548

public static final BitSet FOLLOW_ID_in_ruleBody548

FOLLOW_modifier_in_ruleBody557

public static final BitSet FOLLOW_modifier_in_ruleBody557

FOLLOW_ARG_in_ruleBody564

public static final BitSet FOLLOW_ARG_in_ruleBody564

FOLLOW_ARG_ACTION_in_ruleBody567

public static final BitSet FOLLOW_ARG_ACTION_in_ruleBody567

FOLLOW_RET_in_ruleBody575

public static final BitSet FOLLOW_RET_in_ruleBody575

FOLLOW_ARG_ACTION_in_ruleBody578

public static final BitSet FOLLOW_ARG_ACTION_in_ruleBody578

FOLLOW_throwsSpec_in_ruleBody586

public static final BitSet FOLLOW_throwsSpec_in_ruleBody586

FOLLOW_optionsSpec_in_ruleBody593

public static final BitSet FOLLOW_optionsSpec_in_ruleBody593

FOLLOW_ruleScopeSpec_in_ruleBody600

public static final BitSet FOLLOW_ruleScopeSpec_in_ruleBody600

FOLLOW_AMPERSAND_in_ruleBody609

public static final BitSet FOLLOW_AMPERSAND_in_ruleBody609

FOLLOW_block_in_ruleBody622

public static final BitSet FOLLOW_block_in_ruleBody622

FOLLOW_exceptionGroup_in_ruleBody627

public static final BitSet FOLLOW_exceptionGroup_in_ruleBody627

FOLLOW_EOR_in_ruleBody633

public static final BitSet FOLLOW_EOR_in_ruleBody633

FOLLOW_set_in_modifier0

public static final BitSet FOLLOW_set_in_modifier0

FOLLOW_THROWS_in_throwsSpec675

public static final BitSet FOLLOW_THROWS_in_throwsSpec675

FOLLOW_ID_in_throwsSpec677

public static final BitSet FOLLOW_ID_in_throwsSpec677

FOLLOW_SCOPE_in_ruleScopeSpec692

public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec692

FOLLOW_AMPERSAND_in_ruleScopeSpec697

public static final BitSet FOLLOW_AMPERSAND_in_ruleScopeSpec697

FOLLOW_ACTION_in_ruleScopeSpec707

public static final BitSet FOLLOW_ACTION_in_ruleScopeSpec707

FOLLOW_ID_in_ruleScopeSpec713

public static final BitSet FOLLOW_ID_in_ruleScopeSpec713

FOLLOW_BLOCK_in_block731

public static final BitSet FOLLOW_BLOCK_in_block731

FOLLOW_optionsSpec_in_block737

public static final BitSet FOLLOW_optionsSpec_in_block737

FOLLOW_alternative_in_block746

public static final BitSet FOLLOW_alternative_in_block746

FOLLOW_rewrite_in_block748

public static final BitSet FOLLOW_rewrite_in_block748

FOLLOW_EOB_in_block756

public static final BitSet FOLLOW_EOB_in_block756

FOLLOW_ALT_in_alternative773

public static final BitSet FOLLOW_ALT_in_alternative773

FOLLOW_element_in_alternative776

public static final BitSet FOLLOW_element_in_alternative776

FOLLOW_EOA_in_alternative780

public static final BitSet FOLLOW_EOA_in_alternative780

FOLLOW_exceptionHandler_in_exceptionGroup795

public static final BitSet FOLLOW_exceptionHandler_in_exceptionGroup795

FOLLOW_finallyClause_in_exceptionGroup801

public static final BitSet FOLLOW_finallyClause_in_exceptionGroup801

FOLLOW_finallyClause_in_exceptionGroup808

public static final BitSet FOLLOW_finallyClause_in_exceptionGroup808

FOLLOW_CATCH_in_exceptionHandler820

public static final BitSet FOLLOW_CATCH_in_exceptionHandler820

FOLLOW_ARG_ACTION_in_exceptionHandler822

public static final BitSet FOLLOW_ARG_ACTION_in_exceptionHandler822

FOLLOW_ACTION_in_exceptionHandler824

public static final BitSet FOLLOW_ACTION_in_exceptionHandler824

FOLLOW_FINALLY_in_finallyClause837

public static final BitSet FOLLOW_FINALLY_in_finallyClause837

FOLLOW_ACTION_in_finallyClause839

public static final BitSet FOLLOW_ACTION_in_finallyClause839

FOLLOW_REWRITES_in_rewrite852

public static final BitSet FOLLOW_REWRITES_in_rewrite852

FOLLOW_REWRITE_in_rewrite857

public static final BitSet FOLLOW_REWRITE_in_rewrite857

FOLLOW_ROOT_in_element881

public static final BitSet FOLLOW_ROOT_in_element881

FOLLOW_element_in_element883

public static final BitSet FOLLOW_element_in_element883

FOLLOW_BANG_in_element890

public static final BitSet FOLLOW_BANG_in_element890

FOLLOW_element_in_element892

public static final BitSet FOLLOW_element_in_element892

FOLLOW_atom_in_element898

public static final BitSet FOLLOW_atom_in_element898

FOLLOW_NOT_in_element904

public static final BitSet FOLLOW_NOT_in_element904

FOLLOW_element_in_element906

public static final BitSet FOLLOW_element_in_element906

FOLLOW_RANGE_in_element913

public static final BitSet FOLLOW_RANGE_in_element913

FOLLOW_atom_in_element915

public static final BitSet FOLLOW_atom_in_element915

FOLLOW_atom_in_element917

public static final BitSet FOLLOW_atom_in_element917

FOLLOW_CHAR_RANGE_in_element924

public static final BitSet FOLLOW_CHAR_RANGE_in_element924

FOLLOW_atom_in_element926

public static final BitSet FOLLOW_atom_in_element926

FOLLOW_atom_in_element928

public static final BitSet FOLLOW_atom_in_element928

FOLLOW_ASSIGN_in_element935

public static final BitSet FOLLOW_ASSIGN_in_element935

FOLLOW_ID_in_element937

public static final BitSet FOLLOW_ID_in_element937

FOLLOW_element_in_element939

public static final BitSet FOLLOW_element_in_element939

FOLLOW_PLUS_ASSIGN_in_element946

public static final BitSet FOLLOW_PLUS_ASSIGN_in_element946

FOLLOW_ID_in_element948

public static final BitSet FOLLOW_ID_in_element948

FOLLOW_element_in_element950

public static final BitSet FOLLOW_element_in_element950

FOLLOW_ebnf_in_element956

public static final BitSet FOLLOW_ebnf_in_element956

FOLLOW_tree__in_element961

public static final BitSet FOLLOW_tree__in_element961

FOLLOW_SYNPRED_in_element968

public static final BitSet FOLLOW_SYNPRED_in_element968

FOLLOW_block_in_element970

public static final BitSet FOLLOW_block_in_element970

FOLLOW_FORCED_ACTION_in_element977

public static final BitSet FOLLOW_FORCED_ACTION_in_element977

FOLLOW_ACTION_in_element982

public static final BitSet FOLLOW_ACTION_in_element982

FOLLOW_SEMPRED_in_element987

public static final BitSet FOLLOW_SEMPRED_in_element987

FOLLOW_SYN_SEMPRED_in_element992

public static final BitSet FOLLOW_SYN_SEMPRED_in_element992

FOLLOW_BACKTRACK_SEMPRED_in_element998

public static final BitSet FOLLOW_BACKTRACK_SEMPRED_in_element998

FOLLOW_GATED_SEMPRED_in_element1007

public static final BitSet FOLLOW_GATED_SEMPRED_in_element1007

FOLLOW_EPSILON_in_element1012

public static final BitSet FOLLOW_EPSILON_in_element1012

FOLLOW_block_in_ebnf1023

public static final BitSet FOLLOW_block_in_ebnf1023

FOLLOW_OPTIONAL_in_ebnf1030

public static final BitSet FOLLOW_OPTIONAL_in_ebnf1030

FOLLOW_block_in_ebnf1032

public static final BitSet FOLLOW_block_in_ebnf1032

FOLLOW_CLOSURE_in_ebnf1041

public static final BitSet FOLLOW_CLOSURE_in_ebnf1041

FOLLOW_block_in_ebnf1043

public static final BitSet FOLLOW_block_in_ebnf1043

FOLLOW_POSITIVE_CLOSURE_in_ebnf1052

public static final BitSet FOLLOW_POSITIVE_CLOSURE_in_ebnf1052

FOLLOW_block_in_ebnf1054

public static final BitSet FOLLOW_block_in_ebnf1054

FOLLOW_TREE_BEGIN_in_tree_1068

public static final BitSet FOLLOW_TREE_BEGIN_in_tree_1068

FOLLOW_element_in_tree_1070

public static final BitSet FOLLOW_element_in_tree_1070

FOLLOW_RULE_REF_in_atom1085

public static final BitSet FOLLOW_RULE_REF_in_atom1085

FOLLOW_ARG_ACTION_in_atom1088

public static final BitSet FOLLOW_ARG_ACTION_in_atom1088

FOLLOW_TOKEN_REF_in_atom1101

public static final BitSet FOLLOW_TOKEN_REF_in_atom1101

FOLLOW_ARG_ACTION_in_atom1104

public static final BitSet FOLLOW_ARG_ACTION_in_atom1104

FOLLOW_CHAR_LITERAL_in_atom1118

public static final BitSet FOLLOW_CHAR_LITERAL_in_atom1118

FOLLOW_STRING_LITERAL_in_atom1129

public static final BitSet FOLLOW_STRING_LITERAL_in_atom1129

FOLLOW_WILDCARD_in_atom1136

public static final BitSet FOLLOW_WILDCARD_in_atom1136

FOLLOW_DOT_in_atom1142

public static final BitSet FOLLOW_DOT_in_atom1142

FOLLOW_ID_in_atom1144

public static final BitSet FOLLOW_ID_in_atom1144

FOLLOW_atom_in_atom1146

public static final BitSet FOLLOW_atom_in_atom1146

FOLLOW_set_in_ast_suffix0

public static final BitSet FOLLOW_set_in_ast_suffix0
Constructor Detail

AssignTokenTypesWalker

public AssignTokenTypesWalker(TreeNodeStream input)

AssignTokenTypesWalker

public AssignTokenTypesWalker(TreeNodeStream input,
                              RecognizerSharedState state)
Method Detail

getTokenNames

public String[] getTokenNames()
Overrides:
getTokenNames in class BaseRecognizer

getGrammarFileName

public String getGrammarFileName()
Overrides:
getGrammarFileName in class BaseRecognizer

reportError

public void reportError(RecognitionException ex)
Overrides:
reportError in class BaseRecognizer

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 Map<Object,Object> optionsSpec()
                                     throws RecognitionException
Throws:
RecognitionException

option

public final void option(Map<Object,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


Copyright © 2011. All Rights Reserved.