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_block2329, FOLLOW_ACTION_in_element1836, FOLLOW_ACTION_in_element1865, FOLLOW_ACTION_in_elementOption2632, 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_alternative1714, FOLLOW_ALT_in_lexerElements1364, FOLLOW_alternative_in_block2332, FOLLOW_alternative_in_outerAlternative1298, FOLLOW_ARG_ACTION_in_exceptionHandler932, FOLLOW_ARG_ACTION_in_locals991, FOLLOW_ARG_ACTION_in_rule753, FOLLOW_ARG_ACTION_in_ruleref2366, FOLLOW_ARG_ACTION_in_ruleReturns1016, FOLLOW_ASSIGN_in_delegateGrammar413, FOLLOW_ASSIGN_in_elementOption2582, FOLLOW_ASSIGN_in_elementOption2606, FOLLOW_ASSIGN_in_elementOption2626, FOLLOW_ASSIGN_in_elementOption2648, FOLLOW_ASSIGN_in_option288, FOLLOW_AT_in_action523, FOLLOW_AT_in_ruleAction1071, FOLLOW_atom_in_astOperand1923, FOLLOW_atom_in_element1824, FOLLOW_block_in_astOperand1940, FOLLOW_BLOCK_in_block2321, FOLLOW_block_in_element1901, FOLLOW_block_in_labeledLexerElement1499, FOLLOW_BLOCK_in_lexerBlock1524, FOLLOW_BLOCK_in_lexerRuleBlock1153, FOLLOW_BLOCK_in_ruleBlock1217, FOLLOW_block_in_subrule1998, FOLLOW_block_in_subrule2005, FOLLOW_blockSet_in_astOperand1931, FOLLOW_blockSet_in_atom2189, FOLLOW_blockSet_in_element1892, FOLLOW_blockSet_in_lexerAtom1573, FOLLOW_blockSet_in_lexerAtom1584, FOLLOW_blockSuffix_in_lexerSubrule2030, FOLLOW_blockSuffix_in_subrule1996, 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_atom2127, FOLLOW_DOT_in_atom2138, FOLLOW_ebnfSuffix_in_blockSuffix2066, FOLLOW_element_in_alternative1706, FOLLOW_element_in_labeledElement1971, FOLLOW_ELEMENT_OPTIONS_in_elementOptions2529, FOLLOW_elementOption_in_elementOptions2531, FOLLOW_elementOptions_in_actionElement1660, FOLLOW_elementOptions_in_actionElement1678, FOLLOW_elementOptions_in_alternative1703, FOLLOW_elementOptions_in_atom2154, FOLLOW_elementOptions_in_element1867, FOLLOW_elementOptions_in_element1880, FOLLOW_elementOptions_in_lexerAtom1597, FOLLOW_elementOptions_in_lexerElement1440, FOLLOW_elementOptions_in_lexerElement1453, FOLLOW_elementOptions_in_ruleref2369, FOLLOW_elementOptions_in_terminal2442, FOLLOW_elementOptions_in_terminal2481, FOLLOW_EPSILON_in_alternative1716, 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_atom2129, FOLLOW_ID_in_atom2140, FOLLOW_ID_in_delegateGrammar417, FOLLOW_ID_in_delegateGrammar421, FOLLOW_ID_in_delegateGrammar436, FOLLOW_ID_in_elementOption2562, FOLLOW_ID_in_elementOption2586, FOLLOW_ID_in_elementOption2590, FOLLOW_ID_in_elementOption2608, FOLLOW_ID_in_elementOption2628, FOLLOW_ID_in_elementOption2650, FOLLOW_ID_in_grammarSpec87, FOLLOW_ID_in_labeledElement1969, FOLLOW_ID_in_labeledLexerElement1494, FOLLOW_ID_in_lexerCommand1744, FOLLOW_ID_in_lexerCommand1762, 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_elementOption2654, FOLLOW_labeledElement_in_element1819, FOLLOW_labeledLexerElement_in_lexerElement1392, FOLLOW_LEXER_ACTION_CALL_in_lexerCommand1742, FOLLOW_LEXER_ALT_ACTION_in_lexerAlternative1320, FOLLOW_LEXER_CHAR_SET_in_lexerAtom1616, FOLLOW_LEXER_CHAR_SET_in_setElement2296, FOLLOW_lexerAlternative_in_lexerBlock1529, FOLLOW_lexerAlternative_in_lexerOuterAlternative1276, FOLLOW_lexerAtom_in_labeledLexerElement1497, FOLLOW_lexerAtom_in_lexerElement1397, FOLLOW_lexerBlock_in_lexerSubrule2032, FOLLOW_lexerBlock_in_lexerSubrule2039, FOLLOW_lexerCommand_in_lexerAlternative1324, FOLLOW_lexerCommandExpr_in_lexerCommand1746, 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_astOperand1929, FOLLOW_NOT_in_astOperand1938, FOLLOW_NOT_in_element1890, FOLLOW_NOT_in_element1899, FOLLOW_NOT_in_lexerAtom1571, FOLLOW_option_in_optionsSpec254, FOLLOW_OPTIONS_in_optionsSpec252, FOLLOW_optionsSpec_in_block2323, 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_range2406, FOLLOW_RANGE_in_setElement2265, 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_ruleref2362, FOLLOW_ruleAction_in_block2326, FOLLOW_ruleAction_in_rule821, FOLLOW_ruleBlock_in_rule852, FOLLOW_ruleModifier_in_rule742, FOLLOW_RULEMODIFIERS_in_lexerRule649, FOLLOW_RULEMODIFIERS_in_rule737, FOLLOW_ruleref_in_atom2142, FOLLOW_ruleref_in_atom2199, FOLLOW_ruleReturns_in_rule766, FOLLOW_rules_in_grammarSpec126, FOLLOW_RULES_in_rules562, FOLLOW_SEMPRED_in_actionElement1668, FOLLOW_SEMPRED_in_actionElement1676, FOLLOW_SEMPRED_in_element1850, FOLLOW_SEMPRED_in_element1878, FOLLOW_SEMPRED_in_lexerElement1423, FOLLOW_SEMPRED_in_lexerElement1451, FOLLOW_SET_in_blockSet2224, FOLLOW_set_in_labeledElement1963, FOLLOW_set_in_labeledLexerElement1488, FOLLOW_setElement_in_blockSet2226, FOLLOW_STRING_LITERAL_in_elementOption2612, FOLLOW_STRING_LITERAL_in_range2408, FOLLOW_STRING_LITERAL_in_range2410, FOLLOW_STRING_LITERAL_in_setElement2249, FOLLOW_STRING_LITERAL_in_setElement2269, FOLLOW_STRING_LITERAL_in_setElement2273, FOLLOW_STRING_LITERAL_in_terminal2440, FOLLOW_STRING_LITERAL_in_terminal2465, FOLLOW_subrule_in_element1829, FOLLOW_terminal_in_atom2131, FOLLOW_terminal_in_atom2181, FOLLOW_terminal_in_lexerAtom1560, FOLLOW_THROWS_in_throwsSpec1042, FOLLOW_throwsSpec_in_rule779, FOLLOW_TOKEN_REF_in_lexerRule634, FOLLOW_TOKEN_REF_in_setElement2256, FOLLOW_TOKEN_REF_in_terminal2479, FOLLOW_TOKEN_REF_in_terminal2492, FOLLOW_TOKENS_SPEC_in_tokensSpec470, FOLLOW_tokenSpec_in_tokensSpec472, FOLLOW_tokensSpec_in_prequelConstruct217, FOLLOW_WILDCARD_in_atom2152, FOLLOW_WILDCARD_in_atom2165, 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, UnicodeBOM, 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–2014 ANTLR. All rights reserved.