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.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.throwsSpec_return, GrammarTreeVisitor.tokenSpec_return, GrammarTreeVisitor.tokensSpec_return| Modifier and Type | Field and Description |
|---|---|
Map<String,String> |
altLabelToRuleName |
Rule |
currentRule |
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_actionElement1804, FOLLOW_ACTION_in_actionElement1812, FOLLOW_ACTION_in_block2480, FOLLOW_ACTION_in_element1987, FOLLOW_ACTION_in_element2016, FOLLOW_ACTION_in_elementOption2770, FOLLOW_ACTION_in_exceptionHandler1093, FOLLOW_ACTION_in_finallyClause1120, FOLLOW_ACTION_in_lexerElement1568, FOLLOW_ACTION_in_lexerElement1597, FOLLOW_action_in_prequelConstruct227, FOLLOW_ACTION_in_ruleAction1234, FOLLOW_ALT_in_alternative1855, FOLLOW_ALT_in_alternative1865, FOLLOW_ALT_in_lexerElements1523, FOLLOW_alternative_in_block2483, FOLLOW_alternative_in_outerAlternative1457, FOLLOW_ARG_ACTION_in_exceptionHandler1091, FOLLOW_ARG_ACTION_in_locals1150, FOLLOW_ARG_ACTION_in_rule751, FOLLOW_ARG_ACTION_in_rule933, FOLLOW_ARG_ACTION_in_ruleref2517, FOLLOW_ARG_ACTION_in_ruleReturns1175, FOLLOW_ASSIGN_in_delegateGrammar413, FOLLOW_ASSIGN_in_elementOption2720, FOLLOW_ASSIGN_in_elementOption2744, FOLLOW_ASSIGN_in_elementOption2764, FOLLOW_ASSIGN_in_elementOption2786, FOLLOW_ASSIGN_in_option288, FOLLOW_AT_in_action523, FOLLOW_AT_in_ruleAction1230, FOLLOW_atom_in_astOperand2074, FOLLOW_atom_in_element1975, FOLLOW_block_in_astOperand2091, FOLLOW_BLOCK_in_block2472, FOLLOW_block_in_element2052, FOLLOW_block_in_labeledLexerElement1653, FOLLOW_BLOCK_in_lexerBlock1678, FOLLOW_BLOCK_in_lexerRuleBlock1312, FOLLOW_BLOCK_in_ruleBlock1376, FOLLOW_block_in_subrule2149, FOLLOW_block_in_subrule2156, FOLLOW_blockSet_in_astOperand2082, FOLLOW_blockSet_in_atom2340, FOLLOW_blockSet_in_element2043, FOLLOW_blockSet_in_lexerAtom1727, FOLLOW_blockSet_in_lexerAtom1738, FOLLOW_blockSuffix_in_lexerSubrule2181, FOLLOW_blockSuffix_in_subrule2147, FOLLOW_CATCH_in_exceptionHandler1089, FOLLOW_delegateGrammar_in_delegateGrammars384, FOLLOW_delegateGrammars_in_prequelConstruct207, FOLLOW_DOC_COMMENT_in_grammarSpec91, FOLLOW_DOC_COMMENT_in_lexerRule632, FOLLOW_DOC_COMMENT_in_rule730, FOLLOW_DOC_COMMENT_in_rule913, FOLLOW_DOT_in_atom2278, FOLLOW_DOT_in_atom2289, FOLLOW_ebnfSuffix_in_blockSuffix2217, FOLLOW_element_in_alternative1857, FOLLOW_element_in_labeledElement2122, FOLLOW_ELEMENT_OPTIONS_in_elementOptions2667, FOLLOW_elementOption_in_elementOptions2669, FOLLOW_elementOptions_in_actionElement1814, FOLLOW_elementOptions_in_actionElement1832, FOLLOW_elementOptions_in_atom2305, FOLLOW_elementOptions_in_element2018, FOLLOW_elementOptions_in_element2031, FOLLOW_elementOptions_in_lexerAtom1751, FOLLOW_elementOptions_in_lexerElement1599, FOLLOW_elementOptions_in_lexerElement1612, FOLLOW_elementOptions_in_terminal2580, FOLLOW_elementOptions_in_terminal2619, FOLLOW_EPSILON_in_alternative1867, FOLLOW_exceptionGroup_in_rule1022, FOLLOW_exceptionGroup_in_rule852, FOLLOW_exceptionHandler_in_exceptionGroup1060, FOLLOW_FINALLY_in_finallyClause1118, FOLLOW_finallyClause_in_exceptionGroup1063, FOLLOW_FRAGMENT_in_lexerRule641, FOLLOW_GRAMMAR_in_grammarSpec85, FOLLOW_ID_in_action527, FOLLOW_ID_in_action532, FOLLOW_ID_in_atom2280, FOLLOW_ID_in_atom2291, FOLLOW_ID_in_delegateGrammar417, FOLLOW_ID_in_delegateGrammar421, FOLLOW_ID_in_delegateGrammar436, FOLLOW_ID_in_elementOption2700, FOLLOW_ID_in_elementOption2724, FOLLOW_ID_in_elementOption2728, FOLLOW_ID_in_elementOption2746, FOLLOW_ID_in_elementOption2766, FOLLOW_ID_in_elementOption2788, FOLLOW_ID_in_grammarSpec87, FOLLOW_ID_in_labeledElement2120, FOLLOW_ID_in_labeledLexerElement1648, FOLLOW_ID_in_lexerCommand1895, FOLLOW_ID_in_lexerCommand1913, FOLLOW_ID_in_mode591, FOLLOW_ID_in_option290, FOLLOW_ID_in_ruleAction1232, FOLLOW_ID_in_throwsSpec1203, FOLLOW_ID_in_tokenSpec495, FOLLOW_IMPORT_in_delegateGrammars382, FOLLOW_INT_in_elementOption2792, FOLLOW_labeledElement_in_element1970, FOLLOW_labeledLexerElement_in_lexerElement1551, FOLLOW_LEXER_ACTION_CALL_in_lexerCommand1893, FOLLOW_LEXER_ALT_ACTION_in_lexerAlternative1479, FOLLOW_LEXER_CHAR_SET_in_lexerAtom1770, FOLLOW_LEXER_CHAR_SET_in_setElement2447, FOLLOW_lexerAlternative_in_lexerBlock1683, FOLLOW_lexerAlternative_in_lexerOuterAlternative1435, FOLLOW_lexerAtom_in_labeledLexerElement1651, FOLLOW_lexerAtom_in_lexerElement1556, FOLLOW_lexerBlock_in_lexerSubrule2183, FOLLOW_lexerBlock_in_lexerSubrule2190, FOLLOW_lexerCommand_in_lexerAlternative1483, FOLLOW_lexerCommandExpr_in_lexerCommand1897, FOLLOW_lexerElement_in_lexerElements1525, FOLLOW_lexerElements_in_lexerAlternative1481, FOLLOW_lexerElements_in_lexerAlternative1495, FOLLOW_lexerOuterAlternative_in_lexerRuleBlock1331, FOLLOW_lexerRule_in_mode595, FOLLOW_lexerRule_in_rules569, FOLLOW_lexerRuleBlock_in_lexerRule666, FOLLOW_lexerSubrule_in_lexerElement1561, FOLLOW_LOCALS_in_locals1148, FOLLOW_locals_in_rule790, FOLLOW_locals_in_rule972, FOLLOW_mode_in_grammarSpec128, FOLLOW_MODE_in_mode589, FOLLOW_NOT_in_astOperand2080, FOLLOW_NOT_in_astOperand2089, FOLLOW_NOT_in_element2041, FOLLOW_NOT_in_element2050, FOLLOW_NOT_in_lexerAtom1725, FOLLOW_option_in_optionsSpec254, FOLLOW_OPTIONS_in_optionsSpec252, FOLLOW_optionsSpec_in_block2474, FOLLOW_optionsSpec_in_lexerBlock1680, FOLLOW_optionsSpec_in_prequelConstruct197, FOLLOW_optionsSpec_in_rule805, FOLLOW_optionsSpec_in_rule987, FOLLOW_optionValue_in_option294, FOLLOW_outerAlternative_in_ruleBlock1395, FOLLOW_prequelConstruct_in_prequelConstructs170, FOLLOW_prequelConstructs_in_grammarSpec109, FOLLOW_range_in_lexerAtom1780, FOLLOW_RANGE_in_range2554, FOLLOW_RANGE_in_setElement2416, FOLLOW_RETURNS_in_ruleReturns1173, FOLLOW_RULE_in_lexerRule620, FOLLOW_RULE_in_rule721, FOLLOW_RULE_in_rule906, FOLLOW_rule_in_rules567, FOLLOW_RULE_REF_in_rule723, FOLLOW_RULE_REF_in_rule908, FOLLOW_RULE_REF_in_ruleref2513, FOLLOW_ruleAction_in_block2477, FOLLOW_ruleAction_in_rule1001, FOLLOW_ruleAction_in_rule819, FOLLOW_ruleBlock_in_rule1020, FOLLOW_ruleBlock_in_rule850, FOLLOW_ruleModifier_in_rule740, FOLLOW_ruleModifier_in_rule923, FOLLOW_RULEMODIFIERS_in_lexerRule637, FOLLOW_RULEMODIFIERS_in_rule735, FOLLOW_RULEMODIFIERS_in_rule918, FOLLOW_ruleref_in_atom2293, FOLLOW_ruleref_in_atom2350, FOLLOW_ruleReturns_in_rule764, FOLLOW_ruleReturns_in_rule946, FOLLOW_rules_in_grammarSpec126, FOLLOW_RULES_in_rules562, FOLLOW_SEMPRED_in_actionElement1822, FOLLOW_SEMPRED_in_actionElement1830, FOLLOW_SEMPRED_in_element2001, FOLLOW_SEMPRED_in_element2029, FOLLOW_SEMPRED_in_lexerElement1582, FOLLOW_SEMPRED_in_lexerElement1610, FOLLOW_SET_in_blockSet2375, FOLLOW_set_in_labeledElement2114, FOLLOW_set_in_labeledLexerElement1642, FOLLOW_setElement_in_blockSet2377, FOLLOW_STRING_LITERAL_in_elementOption2750, FOLLOW_STRING_LITERAL_in_range2556, FOLLOW_STRING_LITERAL_in_range2558, FOLLOW_STRING_LITERAL_in_setElement2400, FOLLOW_STRING_LITERAL_in_setElement2420, FOLLOW_STRING_LITERAL_in_setElement2424, FOLLOW_STRING_LITERAL_in_terminal2578, FOLLOW_STRING_LITERAL_in_terminal2603, FOLLOW_subrule_in_element1980, FOLLOW_terminal_in_atom2282, FOLLOW_terminal_in_atom2332, FOLLOW_terminal_in_lexerAtom1714, FOLLOW_THROWS_in_throwsSpec1201, FOLLOW_throwsSpec_in_rule777, FOLLOW_throwsSpec_in_rule959, FOLLOW_TOKEN_REF_in_lexerRule622, FOLLOW_TOKEN_REF_in_setElement2407, FOLLOW_TOKEN_REF_in_terminal2617, FOLLOW_TOKEN_REF_in_terminal2630, FOLLOW_TOKENS_SPEC_in_tokensSpec470, FOLLOW_tokenSpec_in_tokensSpec472, FOLLOW_tokensSpec_in_prequelConstruct217, FOLLOW_WILDCARD_in_atom2303, FOLLOW_WILDCARD_in_atom2316, FOLLOW_WILDCARD_in_lexerAtom1749, FOLLOW_WILDCARD_in_lexerAtom1762, 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,
GrammarAST 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 Rule currentRule
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, GrammarAST 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 © 2012. All Rights Reserved.