public class RuleCollector extends GrammarTreeVisitor
GrammarTreeVisitor.action_return, GrammarTreeVisitor.actionElement_return, GrammarTreeVisitor.alternative_return, GrammarTreeVisitor.astOperand_return, GrammarTreeVisitor.atom_return, GrammarTreeVisitor.block_return, GrammarTreeVisitor.blockSet_return, GrammarTreeVisitor.blockSuffix_return, GrammarTreeVisitor.delegateGrammar_return, GrammarTreeVisitor.delegateGrammars_return, GrammarTreeVisitor.ebnfSuffix_return, GrammarTreeVisitor.element_return, GrammarTreeVisitor.elementOption_return, GrammarTreeVisitor.elementOptions_return, GrammarTreeVisitor.exceptionGroup_return, GrammarTreeVisitor.exceptionHandler_return, GrammarTreeVisitor.finallyClause_return, GrammarTreeVisitor.grammarSpec_return, GrammarTreeVisitor.labeledElement_return, GrammarTreeVisitor.labeledLexerElement_return, GrammarTreeVisitor.lexerAlternative_return, GrammarTreeVisitor.lexerAtom_return, GrammarTreeVisitor.lexerBlock_return, GrammarTreeVisitor.lexerCommand_return, GrammarTreeVisitor.lexerCommandExpr_return, GrammarTreeVisitor.lexerElement_return, GrammarTreeVisitor.lexerElements_return, GrammarTreeVisitor.lexerOuterAlternative_return, GrammarTreeVisitor.lexerRule_return, GrammarTreeVisitor.lexerRuleBlock_return, GrammarTreeVisitor.lexerSubrule_return, GrammarTreeVisitor.locals_return, GrammarTreeVisitor.mode_return, GrammarTreeVisitor.option_return, GrammarTreeVisitor.optionsSpec_return, GrammarTreeVisitor.optionValue_return, GrammarTreeVisitor.outerAlternative_return, GrammarTreeVisitor.prequelConstruct_return, GrammarTreeVisitor.prequelConstructs_return, GrammarTreeVisitor.range_return, GrammarTreeVisitor.rule_return, GrammarTreeVisitor.ruleAction_return, GrammarTreeVisitor.ruleBlock_return, GrammarTreeVisitor.ruleModifier_return, GrammarTreeVisitor.ruleref_return, GrammarTreeVisitor.ruleReturns_return, GrammarTreeVisitor.rules_return, GrammarTreeVisitor.setElement_return, GrammarTreeVisitor.subrule_return, GrammarTreeVisitor.terminal_return, GrammarTreeVisitor.throwsSpec_return, GrammarTreeVisitor.tokenSpec_return, GrammarTreeVisitor.tokensSpec_return| Modifier and Type | Field and Description |
|---|---|
Map<String,String> |
altLabelToRuleName |
Grammar |
g
which grammar are we checking
|
OrderedHashMap<String,Rule> |
rules |
org.stringtemplate.v4.misc.MultiMap<String,GrammarAST> |
ruleToAltLabels |
ACTION, ACTION_CHAR_LITERAL, ACTION_ESC, ACTION_STRING_LITERAL, ALT, ALTLIST, ARG, ARG_ACTION, ARG_OR_CHARSET, ARGLIST, ASSIGN, AT, BLOCK, CATCH, CHAR_RANGE, CLOSURE, COLON, COLONCOLON, COMBINED, COMMA, COMMENT, currentModeName, currentOuterAltNumber, currentOuterAltRoot, currentRuleAST, currentRuleName, DOC_COMMENT, DOLLAR, DOT, ELEMENT_OPTIONS, EOF, EPSILON, ERRCHAR, ESC_SEQ, FINALLY, FOLLOW_ACTION_in_action534, FOLLOW_ACTION_in_actionElement1821, FOLLOW_ACTION_in_actionElement1829, FOLLOW_ACTION_in_block2497, FOLLOW_ACTION_in_element2004, FOLLOW_ACTION_in_element2033, FOLLOW_ACTION_in_elementOption2797, FOLLOW_ACTION_in_exceptionHandler1105, FOLLOW_ACTION_in_finallyClause1132, FOLLOW_ACTION_in_lexerElement1580, FOLLOW_ACTION_in_lexerElement1609, FOLLOW_action_in_prequelConstruct227, FOLLOW_ACTION_in_ruleAction1246, FOLLOW_ALT_in_alternative1872, FOLLOW_ALT_in_alternative1882, FOLLOW_ALT_in_lexerElements1535, FOLLOW_alternative_in_block2500, FOLLOW_alternative_in_outerAlternative1469, FOLLOW_ARG_ACTION_in_exceptionHandler1103, FOLLOW_ARG_ACTION_in_locals1162, FOLLOW_ARG_ACTION_in_rule763, FOLLOW_ARG_ACTION_in_rule945, FOLLOW_ARG_ACTION_in_ruleref2534, FOLLOW_ARG_ACTION_in_ruleReturns1187, FOLLOW_ASSIGN_in_delegateGrammar413, FOLLOW_ASSIGN_in_elementOption2747, FOLLOW_ASSIGN_in_elementOption2771, FOLLOW_ASSIGN_in_elementOption2791, FOLLOW_ASSIGN_in_elementOption2813, FOLLOW_ASSIGN_in_option288, FOLLOW_AT_in_action523, FOLLOW_AT_in_ruleAction1242, FOLLOW_atom_in_astOperand2091, FOLLOW_atom_in_element1992, FOLLOW_block_in_astOperand2108, FOLLOW_BLOCK_in_block2489, FOLLOW_block_in_element2069, FOLLOW_block_in_labeledLexerElement1670, FOLLOW_BLOCK_in_lexerBlock1695, FOLLOW_BLOCK_in_lexerRuleBlock1324, FOLLOW_BLOCK_in_ruleBlock1388, FOLLOW_block_in_subrule2166, FOLLOW_block_in_subrule2173, FOLLOW_blockSet_in_astOperand2099, FOLLOW_blockSet_in_atom2357, FOLLOW_blockSet_in_element2060, FOLLOW_blockSet_in_lexerAtom1744, FOLLOW_blockSet_in_lexerAtom1755, FOLLOW_blockSuffix_in_lexerSubrule2198, FOLLOW_blockSuffix_in_subrule2164, FOLLOW_CATCH_in_exceptionHandler1101, FOLLOW_delegateGrammar_in_delegateGrammars384, FOLLOW_delegateGrammars_in_prequelConstruct207, FOLLOW_DOC_COMMENT_in_grammarSpec91, FOLLOW_DOC_COMMENT_in_lexerRule644, FOLLOW_DOC_COMMENT_in_rule742, FOLLOW_DOC_COMMENT_in_rule925, FOLLOW_DOT_in_atom2295, FOLLOW_DOT_in_atom2306, FOLLOW_ebnfSuffix_in_blockSuffix2234, FOLLOW_element_in_alternative1874, FOLLOW_element_in_labeledElement2139, FOLLOW_ELEMENT_OPTIONS_in_elementOptions2694, FOLLOW_elementOption_in_elementOptions2696, FOLLOW_elementOptions_in_actionElement1831, FOLLOW_elementOptions_in_actionElement1849, FOLLOW_elementOptions_in_atom2322, FOLLOW_elementOptions_in_element2035, FOLLOW_elementOptions_in_element2048, FOLLOW_elementOptions_in_lexerAtom1768, FOLLOW_elementOptions_in_lexerElement1611, FOLLOW_elementOptions_in_lexerElement1624, FOLLOW_elementOptions_in_terminal2607, FOLLOW_elementOptions_in_terminal2646, FOLLOW_EPSILON_in_alternative1884, FOLLOW_EPSILON_in_lexerElement1632, FOLLOW_exceptionGroup_in_rule1034, FOLLOW_exceptionGroup_in_rule864, FOLLOW_exceptionHandler_in_exceptionGroup1072, FOLLOW_FINALLY_in_finallyClause1130, FOLLOW_finallyClause_in_exceptionGroup1075, FOLLOW_FRAGMENT_in_lexerRule653, FOLLOW_GRAMMAR_in_grammarSpec85, FOLLOW_ID_in_action527, FOLLOW_ID_in_action532, FOLLOW_ID_in_atom2297, FOLLOW_ID_in_atom2308, FOLLOW_ID_in_delegateGrammar417, FOLLOW_ID_in_delegateGrammar421, FOLLOW_ID_in_delegateGrammar436, FOLLOW_ID_in_elementOption2727, FOLLOW_ID_in_elementOption2751, FOLLOW_ID_in_elementOption2755, FOLLOW_ID_in_elementOption2773, FOLLOW_ID_in_elementOption2793, FOLLOW_ID_in_elementOption2815, FOLLOW_ID_in_grammarSpec87, FOLLOW_ID_in_labeledElement2137, FOLLOW_ID_in_labeledLexerElement1665, FOLLOW_ID_in_lexerCommand1912, FOLLOW_ID_in_lexerCommand1930, FOLLOW_ID_in_mode602, FOLLOW_ID_in_option290, FOLLOW_ID_in_ruleAction1244, FOLLOW_ID_in_throwsSpec1215, FOLLOW_ID_in_tokenSpec495, FOLLOW_IMPORT_in_delegateGrammars382, FOLLOW_INT_in_elementOption2819, FOLLOW_labeledElement_in_element1987, FOLLOW_labeledLexerElement_in_lexerElement1563, FOLLOW_LEXER_ACTION_CALL_in_lexerCommand1910, FOLLOW_LEXER_ALT_ACTION_in_lexerAlternative1491, FOLLOW_LEXER_CHAR_SET_in_lexerAtom1787, FOLLOW_LEXER_CHAR_SET_in_setElement2464, FOLLOW_lexerAlternative_in_lexerBlock1700, FOLLOW_lexerAlternative_in_lexerOuterAlternative1447, FOLLOW_lexerAtom_in_labeledLexerElement1668, FOLLOW_lexerAtom_in_lexerElement1568, FOLLOW_lexerBlock_in_lexerSubrule2200, FOLLOW_lexerBlock_in_lexerSubrule2207, FOLLOW_lexerCommand_in_lexerAlternative1495, FOLLOW_lexerCommandExpr_in_lexerCommand1914, FOLLOW_lexerElement_in_lexerElements1537, FOLLOW_lexerElements_in_lexerAlternative1493, FOLLOW_lexerElements_in_lexerAlternative1507, FOLLOW_lexerOuterAlternative_in_lexerRuleBlock1343, FOLLOW_lexerRule_in_mode606, FOLLOW_lexerRule_in_rules569, FOLLOW_lexerRuleBlock_in_lexerRule678, FOLLOW_lexerSubrule_in_lexerElement1573, FOLLOW_LOCALS_in_locals1160, FOLLOW_locals_in_rule802, FOLLOW_locals_in_rule984, FOLLOW_mode_in_grammarSpec128, FOLLOW_MODE_in_mode600, FOLLOW_NOT_in_astOperand2097, FOLLOW_NOT_in_astOperand2106, FOLLOW_NOT_in_element2058, FOLLOW_NOT_in_element2067, FOLLOW_NOT_in_lexerAtom1742, FOLLOW_option_in_optionsSpec254, FOLLOW_OPTIONS_in_optionsSpec252, FOLLOW_optionsSpec_in_block2491, FOLLOW_optionsSpec_in_lexerBlock1697, FOLLOW_optionsSpec_in_prequelConstruct197, FOLLOW_optionsSpec_in_rule817, FOLLOW_optionsSpec_in_rule999, FOLLOW_optionValue_in_option294, FOLLOW_outerAlternative_in_ruleBlock1407, FOLLOW_prequelConstruct_in_prequelConstructs170, FOLLOW_prequelConstructs_in_grammarSpec109, FOLLOW_range_in_lexerAtom1797, FOLLOW_RANGE_in_range2571, FOLLOW_RANGE_in_setElement2433, FOLLOW_RETURNS_in_ruleReturns1185, FOLLOW_RULE_in_lexerRule632, FOLLOW_RULE_in_rule733, FOLLOW_RULE_in_rule918, FOLLOW_rule_in_rules567, FOLLOW_RULE_REF_in_rule735, FOLLOW_RULE_REF_in_rule920, FOLLOW_RULE_REF_in_ruleref2530, FOLLOW_ruleAction_in_block2494, FOLLOW_ruleAction_in_rule1013, FOLLOW_ruleAction_in_rule831, FOLLOW_ruleBlock_in_rule1032, FOLLOW_ruleBlock_in_rule862, FOLLOW_ruleModifier_in_rule752, FOLLOW_ruleModifier_in_rule935, FOLLOW_RULEMODIFIERS_in_lexerRule649, FOLLOW_RULEMODIFIERS_in_rule747, FOLLOW_RULEMODIFIERS_in_rule930, FOLLOW_ruleref_in_atom2310, FOLLOW_ruleref_in_atom2367, FOLLOW_ruleReturns_in_rule776, FOLLOW_ruleReturns_in_rule958, FOLLOW_rules_in_grammarSpec126, FOLLOW_RULES_in_rules562, FOLLOW_SEMPRED_in_actionElement1839, FOLLOW_SEMPRED_in_actionElement1847, FOLLOW_SEMPRED_in_element2018, FOLLOW_SEMPRED_in_element2046, FOLLOW_SEMPRED_in_lexerElement1594, FOLLOW_SEMPRED_in_lexerElement1622, FOLLOW_SET_in_blockSet2392, FOLLOW_set_in_labeledElement2131, FOLLOW_set_in_labeledLexerElement1659, FOLLOW_setElement_in_blockSet2394, FOLLOW_STRING_LITERAL_in_elementOption2777, FOLLOW_STRING_LITERAL_in_range2573, FOLLOW_STRING_LITERAL_in_range2575, FOLLOW_STRING_LITERAL_in_setElement2417, FOLLOW_STRING_LITERAL_in_setElement2437, FOLLOW_STRING_LITERAL_in_setElement2441, FOLLOW_STRING_LITERAL_in_terminal2605, FOLLOW_STRING_LITERAL_in_terminal2630, FOLLOW_subrule_in_element1997, FOLLOW_terminal_in_atom2299, FOLLOW_terminal_in_atom2349, FOLLOW_terminal_in_lexerAtom1731, FOLLOW_THROWS_in_throwsSpec1213, FOLLOW_throwsSpec_in_rule789, FOLLOW_throwsSpec_in_rule971, FOLLOW_TOKEN_REF_in_lexerRule634, FOLLOW_TOKEN_REF_in_setElement2424, FOLLOW_TOKEN_REF_in_terminal2644, FOLLOW_TOKEN_REF_in_terminal2657, FOLLOW_TOKENS_SPEC_in_tokensSpec470, FOLLOW_tokenSpec_in_tokensSpec472, FOLLOW_tokensSpec_in_prequelConstruct217, FOLLOW_WILDCARD_in_atom2320, FOLLOW_WILDCARD_in_atom2333, FOLLOW_WILDCARD_in_lexerAtom1766, FOLLOW_WILDCARD_in_lexerAtom1779, FRAGMENT, GRAMMAR, grammarName, GT, HEX_DIGIT, ID, IMPORT, INITACTION, INT, LABEL, LEXER, LEXER_ACTION_CALL, LEXER_ALT_ACTION, LEXER_CHAR_SET, LIST, LOCALS, LPAREN, LT, MODE, NameChar, NameStartChar, NESTED_ACTION, NLCHARS, NOT, OPTIONAL, OPTIONS, OR, PARSER, PLUS, PLUS_ASSIGN, POSITIVE_CLOSURE, POUND, PREC_RULE, PRIVATE, PROTECTED, PUBLIC, QUESTION, RANGE, RARROW, RBRACE, RESULT, RET, RETURNS, rewriteEBNFLevel, RPAREN, RULE, RULE_REF, RULEACTIONS, RULEMODIFIERS, RULES, SEMI, SEMPRED, SET, SRC, STAR, STRING_LITERAL, SYNPRED, TEMPLATE, THROWS, TOKEN_REF, tokenNames, TOKENS_SPEC, TREE_GRAMMAR, UNICODE_ESC, WILDCARD, WS, WSCHARS, WSNLCHARS| Constructor and Description |
|---|
RuleCollector(Grammar g) |
| Modifier and Type | Method and Description |
|---|---|
void |
discoverLexerRule(RuleAST rule,
GrammarAST ID,
List<GrammarAST> modifiers,
GrammarAST block) |
void |
discoverOuterAlt(AltAST alt) |
void |
discoverRule(RuleAST rule,
GrammarAST ID,
List<GrammarAST> modifiers,
ActionAST arg,
ActionAST returns,
GrammarAST thrws,
GrammarAST options,
ActionAST locals,
List<GrammarAST> actions,
GrammarAST block) |
void |
process(GrammarAST ast) |
action, actionElement, actionInAlt, alternative, astOperand, atom, block, blockOption, blockSet, blockSuffix, defineToken, delegateGrammar, delegateGrammars, discoverAlt, discoverGrammar, discoverRules, ebnfSuffix, element, elementOption, elementOption, elementOptions, enterAction, enterActionElement, enterAlternative, enterAstOperand, enterAtom, enterBlock, enterBlockSet, enterBlockSuffix, enterDelegateGrammar, enterDelegateGrammars, enterEbnfSuffix, enterElement, enterElementOption, enterElementOptions, enterExceptionGroup, enterExceptionHandler, enterFinallyClause, enterGrammarSpec, enterLabeledElement, enterLabeledLexerElement, enterLexerAlternative, enterLexerAtom, enterLexerBlock, enterLexerCommand, enterLexerCommandExpr, enterLexerElement, enterLexerElements, enterLexerOuterAlternative, enterLexerRule, enterLexerRuleBlock, enterLexerSubrule, enterLocals, enterMode, enterOption, enterOptionsSpec, enterOptionValue, enterOuterAlternative, enterPrequelConstruct, enterPrequelConstructs, enterRange, enterRule, enterRuleAction, enterRuleBlock, enterRuleModifier, enterRuleref, enterRuleReturns, enterRules, enterSetElement, enterSubrule, enterTerminal, enterThrowsSpec, enterTokenSpec, enterTokensSpec, exceptionGroup, exceptionHandler, exitAction, exitActionElement, exitAlternative, exitAstOperand, exitAtom, exitBlock, exitBlockSet, exitBlockSuffix, exitDelegateGrammar, exitDelegateGrammars, exitEbnfSuffix, exitElement, exitElementOption, exitElementOptions, exitExceptionGroup, exitExceptionHandler, exitFinallyClause, exitGrammarSpec, exitLabeledElement, exitLabeledLexerElement, exitLexerAlternative, exitLexerAtom, exitLexerBlock, exitLexerCommand, exitLexerCommandExpr, exitLexerElement, exitLexerElements, exitLexerOuterAlternative, exitLexerRule, exitLexerRuleBlock, exitLexerSubrule, exitLocals, exitMode, exitOption, exitOptionsSpec, exitOptionValue, exitOuterAlternative, exitPrequelConstruct, exitPrequelConstructs, exitRange, exitRule, exitRuleAction, exitRuleBlock, exitRuleModifier, exitRuleref, exitRuleReturns, exitRules, exitSetElement, exitSubrule, exitTerminal, exitThrowsSpec, exitTokenSpec, exitTokensSpec, finallyAction, finallyClause, finishAlt, finishGrammar, finishLexerRule, finishOuterAlt, finishPrequels, finishRule, finishRules, getDelegates, getErrorManager, getGrammarFileName, getTokenNames, globalNamedAction, grammarOption, grammarSpec, importGrammar, label, labeledElement, labeledLexerElement, lexerAlternative, lexerAtom, lexerBlock, lexerCallCommand, lexerCommand, lexerCommand, lexerCommandExpr, lexerElement, lexerElements, lexerOuterAlternative, lexerRule, lexerRuleBlock, lexerSubrule, locals, mode, modeDef, option, optionsSpec, optionValue, outerAlternative, prequelConstruct, prequelConstructs, range, rule, ruleAction, ruleBlock, ruleCatch, ruleModifier, ruleOption, ruleref, ruleRef, ruleReturns, rules, sempredInAlt, setElement, stringRef, subrule, terminal, throwsSpec, tokenRef, tokenSpec, tokensSpec, traceIn, traceOut, visit, visitGrammar, wildcardRefgetAncestor, getCurrentInputSymbol, getErrorHeader, getErrorMessage, getMissingSymbol, getSourceName, getTreeNodeStream, inContext, inContext, matchAny, recoverFromMismatchedToken, reset, setTreeNodeStreamalreadyParsedRule, beginResync, combineFollows, computeContextSensitiveRuleFOLLOW, computeErrorRecoverySet, consumeUntil, consumeUntil, displayRecognitionError, emitErrorMessage, endResync, failed, getBacktrackingLevel, getNumberOfSyntaxErrors, getRuleInvocationStack, getRuleInvocationStack, getRuleMemoization, getRuleMemoizationCacheSize, getTokenErrorDisplay, match, memoize, mismatchIsMissingToken, mismatchIsUnwantedToken, pushFollow, recover, recoverFromMismatchedSet, reportError, setBacktrackingLevel, toStrings, traceIn, traceOutpublic Grammar g
public OrderedHashMap<String,Rule> rules
public org.stringtemplate.v4.misc.MultiMap<String,GrammarAST> ruleToAltLabels
public RuleCollector(Grammar g)
public void process(GrammarAST ast)
public void discoverRule(RuleAST rule, GrammarAST ID, List<GrammarAST> modifiers, ActionAST arg, ActionAST returns, GrammarAST thrws, GrammarAST options, ActionAST locals, List<GrammarAST> actions, GrammarAST block)
discoverRule in class GrammarTreeVisitorpublic void discoverOuterAlt(AltAST alt)
discoverOuterAlt in class GrammarTreeVisitorpublic void discoverLexerRule(RuleAST rule, GrammarAST ID, List<GrammarAST> modifiers, GrammarAST block)
discoverLexerRule in class GrammarTreeVisitorCopyright © 1992-2013 ANTLR. All Rights Reserved.