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_actionElement1650, FOLLOW_ACTION_in_actionElement1658, FOLLOW_ACTION_in_block2326, FOLLOW_ACTION_in_element1833, FOLLOW_ACTION_in_element1862, FOLLOW_ACTION_in_elementOption2626, FOLLOW_ACTION_in_exceptionHandler934, FOLLOW_ACTION_in_finallyClause961, FOLLOW_ACTION_in_lexerElement1409, FOLLOW_ACTION_in_lexerElement1438, FOLLOW_action_in_prequelConstruct227, FOLLOW_ACTION_in_ruleAction1075, FOLLOW_ALT_in_alternative1701, FOLLOW_ALT_in_alternative1711, FOLLOW_ALT_in_lexerElements1364, FOLLOW_alternative_in_block2329, FOLLOW_alternative_in_outerAlternative1298, FOLLOW_ARG_ACTION_in_exceptionHandler932, FOLLOW_ARG_ACTION_in_locals991, FOLLOW_ARG_ACTION_in_rule753, FOLLOW_ARG_ACTION_in_ruleref2363, FOLLOW_ARG_ACTION_in_ruleReturns1016, FOLLOW_ASSIGN_in_delegateGrammar413, FOLLOW_ASSIGN_in_elementOption2576, FOLLOW_ASSIGN_in_elementOption2600, FOLLOW_ASSIGN_in_elementOption2620, FOLLOW_ASSIGN_in_elementOption2642, FOLLOW_ASSIGN_in_option288, FOLLOW_AT_in_action523, FOLLOW_AT_in_ruleAction1071, FOLLOW_atom_in_astOperand1920, FOLLOW_atom_in_element1821, FOLLOW_block_in_astOperand1937, FOLLOW_BLOCK_in_block2318, FOLLOW_block_in_element1898, FOLLOW_block_in_labeledLexerElement1499, FOLLOW_BLOCK_in_lexerBlock1524, FOLLOW_BLOCK_in_lexerRuleBlock1153, FOLLOW_BLOCK_in_ruleBlock1217, FOLLOW_block_in_subrule1995, FOLLOW_block_in_subrule2002, FOLLOW_blockSet_in_astOperand1928, FOLLOW_blockSet_in_atom2186, FOLLOW_blockSet_in_element1889, FOLLOW_blockSet_in_lexerAtom1573, FOLLOW_blockSet_in_lexerAtom1584, FOLLOW_blockSuffix_in_lexerSubrule2027, FOLLOW_blockSuffix_in_subrule1993, FOLLOW_CATCH_in_exceptionHandler930, FOLLOW_delegateGrammar_in_delegateGrammars384, FOLLOW_delegateGrammars_in_prequelConstruct207, FOLLOW_DOC_COMMENT_in_grammarSpec91, FOLLOW_DOC_COMMENT_in_lexerRule644, FOLLOW_DOC_COMMENT_in_rule732, FOLLOW_DOT_in_atom2124, FOLLOW_DOT_in_atom2135, FOLLOW_ebnfSuffix_in_blockSuffix2063, FOLLOW_element_in_alternative1703, FOLLOW_element_in_labeledElement1968, FOLLOW_ELEMENT_OPTIONS_in_elementOptions2523, FOLLOW_elementOption_in_elementOptions2525, FOLLOW_elementOptions_in_actionElement1660, FOLLOW_elementOptions_in_actionElement1678, FOLLOW_elementOptions_in_atom2151, FOLLOW_elementOptions_in_element1864, FOLLOW_elementOptions_in_element1877, FOLLOW_elementOptions_in_lexerAtom1597, FOLLOW_elementOptions_in_lexerElement1440, FOLLOW_elementOptions_in_lexerElement1453, FOLLOW_elementOptions_in_terminal2436, FOLLOW_elementOptions_in_terminal2475, FOLLOW_EPSILON_in_alternative1713, FOLLOW_EPSILON_in_lexerElement1461, FOLLOW_exceptionGroup_in_rule854, FOLLOW_exceptionHandler_in_exceptionGroup901, FOLLOW_FINALLY_in_finallyClause959, FOLLOW_finallyClause_in_exceptionGroup904, FOLLOW_FRAGMENT_in_lexerRule653, FOLLOW_GRAMMAR_in_grammarSpec85, FOLLOW_ID_in_action527, FOLLOW_ID_in_action532, FOLLOW_ID_in_atom2126, FOLLOW_ID_in_atom2137, FOLLOW_ID_in_delegateGrammar417, FOLLOW_ID_in_delegateGrammar421, FOLLOW_ID_in_delegateGrammar436, FOLLOW_ID_in_elementOption2556, FOLLOW_ID_in_elementOption2580, FOLLOW_ID_in_elementOption2584, FOLLOW_ID_in_elementOption2602, FOLLOW_ID_in_elementOption2622, FOLLOW_ID_in_elementOption2644, FOLLOW_ID_in_grammarSpec87, FOLLOW_ID_in_labeledElement1966, FOLLOW_ID_in_labeledLexerElement1494, FOLLOW_ID_in_lexerCommand1741, FOLLOW_ID_in_lexerCommand1759, FOLLOW_ID_in_mode602, FOLLOW_ID_in_option290, FOLLOW_ID_in_ruleAction1073, FOLLOW_ID_in_throwsSpec1044, FOLLOW_ID_in_tokenSpec495, FOLLOW_IMPORT_in_delegateGrammars382, FOLLOW_INT_in_elementOption2648, FOLLOW_labeledElement_in_element1816, FOLLOW_labeledLexerElement_in_lexerElement1392, FOLLOW_LEXER_ACTION_CALL_in_lexerCommand1739, FOLLOW_LEXER_ALT_ACTION_in_lexerAlternative1320, FOLLOW_LEXER_CHAR_SET_in_lexerAtom1616, FOLLOW_LEXER_CHAR_SET_in_setElement2293, FOLLOW_lexerAlternative_in_lexerBlock1529, FOLLOW_lexerAlternative_in_lexerOuterAlternative1276, FOLLOW_lexerAtom_in_labeledLexerElement1497, FOLLOW_lexerAtom_in_lexerElement1397, FOLLOW_lexerBlock_in_lexerSubrule2029, FOLLOW_lexerBlock_in_lexerSubrule2036, FOLLOW_lexerCommand_in_lexerAlternative1324, FOLLOW_lexerCommandExpr_in_lexerCommand1743, FOLLOW_lexerElement_in_lexerElements1366, FOLLOW_lexerElements_in_lexerAlternative1322, FOLLOW_lexerElements_in_lexerAlternative1336, FOLLOW_lexerOuterAlternative_in_lexerRuleBlock1172, FOLLOW_lexerRule_in_mode606, FOLLOW_lexerRule_in_rules569, FOLLOW_lexerRuleBlock_in_lexerRule678, FOLLOW_lexerSubrule_in_lexerElement1402, FOLLOW_LOCALS_in_locals989, FOLLOW_locals_in_rule792, FOLLOW_mode_in_grammarSpec128, FOLLOW_MODE_in_mode600, FOLLOW_NOT_in_astOperand1926, FOLLOW_NOT_in_astOperand1935, FOLLOW_NOT_in_element1887, FOLLOW_NOT_in_element1896, FOLLOW_NOT_in_lexerAtom1571, FOLLOW_option_in_optionsSpec254, FOLLOW_OPTIONS_in_optionsSpec252, FOLLOW_optionsSpec_in_block2320, FOLLOW_optionsSpec_in_lexerBlock1526, FOLLOW_optionsSpec_in_prequelConstruct197, FOLLOW_optionsSpec_in_rule807, FOLLOW_optionValue_in_option294, FOLLOW_outerAlternative_in_ruleBlock1236, FOLLOW_prequelConstruct_in_prequelConstructs170, FOLLOW_prequelConstructs_in_grammarSpec109, FOLLOW_range_in_lexerAtom1626, FOLLOW_RANGE_in_range2400, FOLLOW_RANGE_in_setElement2262, FOLLOW_RETURNS_in_ruleReturns1014, FOLLOW_RULE_in_lexerRule632, FOLLOW_RULE_in_rule723, FOLLOW_rule_in_rules567, FOLLOW_RULE_REF_in_rule725, FOLLOW_RULE_REF_in_ruleref2359, FOLLOW_ruleAction_in_block2323, FOLLOW_ruleAction_in_rule821, FOLLOW_ruleBlock_in_rule852, FOLLOW_ruleModifier_in_rule742, FOLLOW_RULEMODIFIERS_in_lexerRule649, FOLLOW_RULEMODIFIERS_in_rule737, FOLLOW_ruleref_in_atom2139, FOLLOW_ruleref_in_atom2196, FOLLOW_ruleReturns_in_rule766, FOLLOW_rules_in_grammarSpec126, FOLLOW_RULES_in_rules562, FOLLOW_SEMPRED_in_actionElement1668, FOLLOW_SEMPRED_in_actionElement1676, FOLLOW_SEMPRED_in_element1847, FOLLOW_SEMPRED_in_element1875, FOLLOW_SEMPRED_in_lexerElement1423, FOLLOW_SEMPRED_in_lexerElement1451, FOLLOW_SET_in_blockSet2221, FOLLOW_set_in_labeledElement1960, FOLLOW_set_in_labeledLexerElement1488, FOLLOW_setElement_in_blockSet2223, FOLLOW_STRING_LITERAL_in_elementOption2606, FOLLOW_STRING_LITERAL_in_range2402, FOLLOW_STRING_LITERAL_in_range2404, FOLLOW_STRING_LITERAL_in_setElement2246, FOLLOW_STRING_LITERAL_in_setElement2266, FOLLOW_STRING_LITERAL_in_setElement2270, FOLLOW_STRING_LITERAL_in_terminal2434, FOLLOW_STRING_LITERAL_in_terminal2459, FOLLOW_subrule_in_element1826, FOLLOW_terminal_in_atom2128, FOLLOW_terminal_in_atom2178, FOLLOW_terminal_in_lexerAtom1560, FOLLOW_THROWS_in_throwsSpec1042, FOLLOW_throwsSpec_in_rule779, FOLLOW_TOKEN_REF_in_lexerRule634, FOLLOW_TOKEN_REF_in_setElement2253, FOLLOW_TOKEN_REF_in_terminal2473, FOLLOW_TOKEN_REF_in_terminal2486, FOLLOW_TOKENS_SPEC_in_tokensSpec470, FOLLOW_tokenSpec_in_tokensSpec472, FOLLOW_tokensSpec_in_prequelConstruct217, FOLLOW_WILDCARD_in_atom2149, FOLLOW_WILDCARD_in_atom2162, FOLLOW_WILDCARD_in_lexerAtom1595, FOLLOW_WILDCARD_in_lexerAtom1608, 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.