Top Fields Constructors Methods
org.antlr.v4.semantics

public Class RuleCollector

extends GrammarTreeVisitor
Class Inheritance
Imports
org.antlr.v4.analysis.LeftRecursiveRuleAnalyzer, org.antlr.v4.misc.OrderedHashMap, .Utils, org.antlr.v4.parse.GrammarTreeVisitor, .ScopeParser, org.antlr.v4.tool.*, org.antlr.v4.tool.ast.ActionAST, .AltAST, .GrammarAST, .RuleAST, org.stringtemplate.v4.misc.MultiMap, java.util.HashMap, .List, .Map

Field Summary

Modifier and TypeField and Description
public Map<String, String>
public ErrorManager
public Grammar
g

which grammar are we checking

private boolean
public OrderedHashMap<String, Rule>
public MultiMap<String, GrammarAST>
Inherited from org.antlr.v4.parse.GrammarTreeVisitor:
ACTIONACTION_CHAR_LITERALACTION_ESCACTION_STRING_LITERALALTARG_ACTIONARG_OR_CHARSETASSIGNATBLOCKCATCHCHANNELSCLOSURECOLONCOLONCOLONCOMBINEDCOMMACOMMENTcurrentModeNamecurrentOuterAltNumbercurrentOuterAltRootcurrentRuleASTcurrentRuleNamedfa38DOC_COMMENTDOLLARDOTELEMENT_OPTIONSEOFEPSILONERRCHARESC_SEQFINALLYFOLLOW_ACTION_in_action596FOLLOW_ACTION_in_actionElement1679FOLLOW_ACTION_in_actionElement1687FOLLOW_ACTION_in_block2430FOLLOW_ACTION_in_element1868FOLLOW_ACTION_in_element1897FOLLOW_ACTION_in_elementOption2733FOLLOW_ACTION_in_exceptionHandler998FOLLOW_ACTION_in_finallyClause1025FOLLOW_ACTION_in_lexerElement1468FOLLOW_ACTION_in_lexerElement1497FOLLOW_action_in_prequelConstruct234FOLLOW_ACTION_in_ruleAction1139FOLLOW_ALT_in_alternative1730FOLLOW_ALT_in_alternative1743FOLLOW_ALT_in_lexerElements1428FOLLOW_alternative_in_block2433FOLLOW_alternative_in_outerAlternative1362FOLLOW_ARG_ACTION_in_exceptionHandler996FOLLOW_ARG_ACTION_in_locals1055FOLLOW_ARG_ACTION_in_rule817FOLLOW_ARG_ACTION_in_ruleref2467FOLLOW_ARG_ACTION_in_ruleReturns1080FOLLOW_ASSIGN_in_delegateGrammar420FOLLOW_ASSIGN_in_elementOption2683FOLLOW_ASSIGN_in_elementOption2707FOLLOW_ASSIGN_in_elementOption2727FOLLOW_ASSIGN_in_elementOption2749FOLLOW_ASSIGN_in_option295FOLLOW_AT_in_action585FOLLOW_AT_in_ruleAction1135FOLLOW_atom_in_astOperand1959FOLLOW_atom_in_element1856FOLLOW_block_in_astOperand1976FOLLOW_BLOCK_in_block2422FOLLOW_block_in_element1937FOLLOW_BLOCK_in_lexerBlock1543FOLLOW_BLOCK_in_lexerRuleBlock1217FOLLOW_BLOCK_in_ruleBlock1281FOLLOW_block_in_subrule2034FOLLOW_block_in_subrule2041FOLLOW_blockSet_in_astOperand1967FOLLOW_blockSet_in_atom2225FOLLOW_blockSet_in_element1928FOLLOW_blockSet_in_lexerAtom1592FOLLOW_blockSet_in_lexerAtom1603FOLLOW_blockSuffix_in_lexerSubrule2066FOLLOW_blockSuffix_in_subrule2032FOLLOW_CATCH_in_exceptionHandler994FOLLOW_CHANNELS_in_channelsSpec532FOLLOW_channelSpec_in_channelsSpec534FOLLOW_channelsSpec_in_prequelConstruct224FOLLOW_delegateGrammar_in_delegateGrammars391FOLLOW_delegateGrammars_in_prequelConstruct204FOLLOW_DOT_in_atom2163FOLLOW_DOT_in_atom2174FOLLOW_ebnfSuffix_in_blockSuffix2102FOLLOW_element_in_alternative1735FOLLOW_element_in_labeledElement2007FOLLOW_ELEMENT_OPTIONS_in_elementOptions2630FOLLOW_elementOption_in_elementOptions2632FOLLOW_elementOptions_in_actionElement1689FOLLOW_elementOptions_in_actionElement1707FOLLOW_elementOptions_in_alternative1732FOLLOW_elementOptions_in_alternative1745FOLLOW_elementOptions_in_atom2190FOLLOW_elementOptions_in_element1899FOLLOW_elementOptions_in_element1912FOLLOW_elementOptions_in_lexerAtom1616FOLLOW_elementOptions_in_lexerElement1499FOLLOW_elementOptions_in_lexerElement1512FOLLOW_elementOptions_in_ruleref2470FOLLOW_elementOptions_in_setElement2288FOLLOW_elementOptions_in_setElement2302FOLLOW_elementOptions_in_terminal2543FOLLOW_elementOptions_in_terminal2582FOLLOW_EPSILON_in_alternative1748FOLLOW_EPSILON_in_lexerElement1520FOLLOW_exceptionGroup_in_rule918FOLLOW_exceptionHandler_in_exceptionGroup965FOLLOW_FINALLY_in_finallyClause1023FOLLOW_finallyClause_in_exceptionGroup968FOLLOW_FRAGMENT_in_lexerRule712FOLLOW_GRAMMAR_in_grammarSpec85FOLLOW_ID_in_action589FOLLOW_ID_in_action594FOLLOW_ID_in_atom2165FOLLOW_ID_in_atom2176FOLLOW_ID_in_channelSpec557FOLLOW_ID_in_delegateGrammar424FOLLOW_ID_in_delegateGrammar428FOLLOW_ID_in_delegateGrammar443FOLLOW_ID_in_elementOption2663FOLLOW_ID_in_elementOption2687FOLLOW_ID_in_elementOption2691FOLLOW_ID_in_elementOption2709FOLLOW_ID_in_elementOption2729FOLLOW_ID_in_elementOption2751FOLLOW_ID_in_grammarSpec87FOLLOW_ID_in_labeledElement2005FOLLOW_ID_in_lexerCommand1776FOLLOW_ID_in_lexerCommand1794FOLLOW_ID_in_mode664FOLLOW_ID_in_option297FOLLOW_ID_in_ruleAction1137FOLLOW_ID_in_throwsSpec1108FOLLOW_ID_in_tokenSpec502FOLLOW_IMPORT_in_delegateGrammars389FOLLOW_INT_in_elementOption2755FOLLOW_labeledElement_in_element1851FOLLOW_LEXER_ACTION_CALL_in_lexerCommand1774FOLLOW_LEXER_ALT_ACTION_in_lexerAlternative1384FOLLOW_LEXER_CHAR_SET_in_lexerAtom1635FOLLOW_LEXER_CHAR_SET_in_setElement2397FOLLOW_lexerAlternative_in_lexerBlock1548FOLLOW_lexerAlternative_in_lexerOuterAlternative1340FOLLOW_lexerAtom_in_lexerElement1456FOLLOW_lexerBlock_in_lexerSubrule2068FOLLOW_lexerBlock_in_lexerSubrule2075FOLLOW_lexerCommand_in_lexerAlternative1388FOLLOW_lexerCommandExpr_in_lexerCommand1778FOLLOW_lexerElement_in_lexerElements1430FOLLOW_lexerElements_in_lexerAlternative1386FOLLOW_lexerElements_in_lexerAlternative1400FOLLOW_lexerOuterAlternative_in_lexerRuleBlock1236FOLLOW_lexerRule_in_mode668FOLLOW_lexerRule_in_rules631FOLLOW_lexerRuleBlock_in_lexerRule745FOLLOW_lexerSubrule_in_lexerElement1461FOLLOW_LOCALS_in_locals1053FOLLOW_locals_in_rule856FOLLOW_mode_in_grammarSpec125FOLLOW_MODE_in_mode662FOLLOW_NOT_in_astOperand1965FOLLOW_NOT_in_astOperand1974FOLLOW_NOT_in_element1926FOLLOW_NOT_in_element1935FOLLOW_NOT_in_lexerAtom1590FOLLOW_option_in_optionsSpec261FOLLOW_OPTIONS_in_optionsSpec259FOLLOW_optionsSpec_in_block2424FOLLOW_optionsSpec_in_lexerBlock1545FOLLOW_optionsSpec_in_lexerRule724FOLLOW_optionsSpec_in_prequelConstruct194FOLLOW_optionsSpec_in_rule871FOLLOW_optionValue_in_option301FOLLOW_outerAlternative_in_ruleBlock1300FOLLOW_prequelConstruct_in_prequelConstructs167FOLLOW_prequelConstructs_in_grammarSpec106FOLLOW_range_in_element1920FOLLOW_range_in_lexerAtom1645FOLLOW_RANGE_in_range2507FOLLOW_RANGE_in_setElement2366FOLLOW_RETURNS_in_ruleReturns1078FOLLOW_RULE_in_lexerRule694FOLLOW_RULE_in_rule790FOLLOW_rule_in_rules629FOLLOW_RULE_REF_in_rule792FOLLOW_RULE_REF_in_ruleref2463FOLLOW_ruleAction_in_block2427FOLLOW_ruleAction_in_rule885FOLLOW_ruleBlock_in_rule916FOLLOW_ruleModifier_in_rule806FOLLOW_RULEMODIFIERS_in_lexerRule708FOLLOW_RULEMODIFIERS_in_rule801FOLLOW_ruleref_in_atom2178FOLLOW_ruleref_in_atom2235FOLLOW_ruleref_in_lexerAtom1655FOLLOW_ruleReturns_in_rule830FOLLOW_rules_in_grammarSpec123FOLLOW_RULES_in_rules624FOLLOW_SEMPRED_in_actionElement1697FOLLOW_SEMPRED_in_actionElement1705FOLLOW_SEMPRED_in_element1882FOLLOW_SEMPRED_in_element1910FOLLOW_SEMPRED_in_lexerElement1482FOLLOW_SEMPRED_in_lexerElement1510FOLLOW_SET_in_blockSet2260FOLLOW_set_in_labeledElement1999FOLLOW_setElement_in_blockSet2262FOLLOW_STRING_LITERAL_in_elementOption2713FOLLOW_STRING_LITERAL_in_range2509FOLLOW_STRING_LITERAL_in_range2511FOLLOW_STRING_LITERAL_in_setElement2286FOLLOW_STRING_LITERAL_in_setElement2312FOLLOW_STRING_LITERAL_in_setElement2370FOLLOW_STRING_LITERAL_in_setElement2374FOLLOW_STRING_LITERAL_in_terminal2541FOLLOW_STRING_LITERAL_in_terminal2566FOLLOW_subrule_in_element1861FOLLOW_terminal_in_atom2167FOLLOW_terminal_in_atom2217FOLLOW_terminal_in_lexerAtom1579FOLLOW_THROWS_in_throwsSpec1106FOLLOW_throwsSpec_in_rule843FOLLOW_TOKEN_REF_in_lexerRule696FOLLOW_TOKEN_REF_in_setElement2300FOLLOW_TOKEN_REF_in_setElement2337FOLLOW_TOKEN_REF_in_terminal2580FOLLOW_TOKEN_REF_in_terminal2593FOLLOW_TOKENS_SPEC_in_tokensSpec477FOLLOW_tokenSpec_in_tokensSpec479FOLLOW_tokensSpec_in_prequelConstruct214FOLLOW_WILDCARD_in_atom2188FOLLOW_WILDCARD_in_atom2201FOLLOW_WILDCARD_in_lexerAtom1614FOLLOW_WILDCARD_in_lexerAtom1627FRAGMENTGRAMMARgrammarNameGTHEX_DIGITIDIMPORTINTLEXERLEXER_ACTION_CALLLEXER_ALT_ACTIONLEXER_CHAR_SETLOCALSLPARENLTMODENameCharNameStartCharNESTED_ACTIONNLCHARSNOTOPTIONALOPTIONSORPARSERPLUSPLUS_ASSIGNPOSITIVE_CLOSUREPOUNDPRIVATEPROTECTEDPUBLICQUESTIONRANGERARROWRBRACERETURNSrewriteEBNFLevelRPARENRULERULE_REFRULEMODIFIERSRULESSEMISEMPREDSETSRCSTARSTRING_LITERALTHROWSTOKEN_REFtokenNamesTOKENS_SPECUNICODE_ESCUNICODE_EXTENDED_ESCUnicodeBOMWILDCARDWSWSCHARSWSNLCHARS

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
private Boolean
public ErrorManager
public void
public void
Inherited from org.antlr.v4.parse.GrammarTreeVisitor:
actionactionElementactionInAltalternativeastOperandatomblockblockOptionblockSetblockSuffixchannelSpecchannelsSpecdefineChanneldefineTokendelegateGrammardelegateGrammarsdiscoverAltdiscoverGrammardiscoverRulesebnfSuffixelementelementOptionelementOptionelementOptionsenterActionenterActionElemententerAlternativeenterAstOperandenterAtomenterBlockenterBlockSetenterBlockSuffixenterChannelSpecenterChannelsSpecenterDelegateGrammarenterDelegateGrammarsenterEbnfSuffixenterElemententerElementOptionenterElementOptionsenterExceptionGroupenterExceptionHandlerenterFinallyClauseenterGrammarSpecenterLabeledElemententerLexerAlternativeenterLexerAtomenterLexerBlockenterLexerCommandenterLexerCommandExprenterLexerElemententerLexerElementsenterLexerOuterAlternativeenterLexerRuleenterLexerRuleBlockenterLexerSubruleenterLocalsenterModeenterOptionenterOptionsSpecenterOptionValueenterOuterAlternativeenterPrequelConstructenterPrequelConstructsenterRangeenterRuleenterRuleActionenterRuleBlockenterRuleModifierenterRulerefenterRuleReturnsenterRulesenterSetElemententerSubruleenterTerminalenterThrowsSpecenterTokenSpecenterTokensSpecexceptionGroupexceptionHandlerexitActionexitActionElementexitAlternativeexitAstOperandexitAtomexitBlockexitBlockSetexitBlockSuffixexitChannelSpecexitChannelsSpecexitDelegateGrammarexitDelegateGrammarsexitEbnfSuffixexitElementexitElementOptionexitElementOptionsexitExceptionGroupexitExceptionHandlerexitFinallyClauseexitGrammarSpecexitLabeledElementexitLexerAlternativeexitLexerAtomexitLexerBlockexitLexerCommandexitLexerCommandExprexitLexerElementexitLexerElementsexitLexerOuterAlternativeexitLexerRuleexitLexerRuleBlockexitLexerSubruleexitLocalsexitModeexitOptionexitOptionsSpecexitOptionValueexitOuterAlternativeexitPrequelConstructexitPrequelConstructsexitRangeexitRuleexitRuleActionexitRuleBlockexitRuleModifierexitRulerefexitRuleReturnsexitRulesexitSetElementexitSubruleexitTerminalexitThrowsSpecexitTokenSpecexitTokensSpecfinallyActionfinallyClausefinishAltfinishGrammarfinishLexerRulefinishOuterAltfinishPrequelsfinishRulefinishRulesgetDelegatesgetGrammarFileNamegetTokenNamesglobalNamedActiongrammarSpecimportGrammarlabellabeledElementlexerAlternativelexerAtomlexerBlocklexerCallCommandlexerCommandlexerCommandlexerCommandExprlexerElementlexerElementslexerOuterAlternativelexerRulelexerRuleBlocklexerSubrulelocalsmodemodeDefoptionoptionsSpecoptionValueouterAlternativeprequelConstructprequelConstructsrangeruleruleActionruleBlockruleCatchruleModifierruleOptionruleRefrulerefruleReturnsrulessempredInAltsetElementstringRefsubruleterminalthrowsSpectokenReftokenSpectokensSpectraceIntraceOutvisitvisitGrammarwildcardRef

Field Detail

altLabelToRuleNameback to summary
public Map<String, String> altLabelToRuleName
errMgrback to summary
public ErrorManager errMgr
gback to summary
public Grammar g

which grammar are we checking

grammarCaseInsensitiveback to summary
private boolean grammarCaseInsensitive
rulesback to summary
public OrderedHashMap<String, Rule> rules
ruleToAltLabelsback to summary
public MultiMap<String, GrammarAST> ruleToAltLabels

Constructor Detail

RuleCollectorback to summary
public RuleCollector(Grammar g)

Method Detail

discoverLexerRuleback to summary
public void discoverLexerRule(RuleAST rule, GrammarAST ID, List<GrammarAST> modifiers, GrammarAST options, GrammarAST block)

Overrides org.antlr.v4.parse.GrammarTreeVisitor.discoverLexerRule.

Annotations
@Override
discoverOuterAltback to summary
public void discoverOuterAlt(AltAST alt)

Overrides org.antlr.v4.parse.GrammarTreeVisitor.discoverOuterAlt.

Annotations
@Override
discoverRuleback to summary
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)

Overrides org.antlr.v4.parse.GrammarTreeVisitor.discoverRule.

Annotations
@Override
getCaseInsensitiveValueback to summary
private Boolean getCaseInsensitiveValue(GrammarAST optionID, GrammarAST valueAST)
getErrorManagerback to summary
public ErrorManager getErrorManager()

Overrides org.antlr.v4.parse.GrammarTreeVisitor.getErrorManager.

Annotations
@Override
grammarOptionback to summary
public void grammarOption(GrammarAST ID, GrammarAST valueAST)

Overrides org.antlr.v4.parse.GrammarTreeVisitor.grammarOption.

Annotations
@Override
processback to summary
public void process(GrammarAST ast)