public class BasicSemanticChecks 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.channelSpec_return, GrammarTreeVisitor.channelsSpec_return, GrammarTreeVisitor.delegateGrammar_return, GrammarTreeVisitor.delegateGrammars_return, GrammarTreeVisitor.DFA38, 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 |
|---|---|
boolean |
checkAssocElementOption
When this is
true, the semantic checks will report
ErrorType.UNRECOGNIZED_ASSOC_OPTION where appropriate. |
ErrorManager |
errMgr |
Grammar |
g |
private boolean |
inFragmentRule
This is
true from the time discoverLexerRule(org.antlr.v4.tool.ast.RuleAST, org.antlr.v4.tool.ast.GrammarAST, java.util.List<org.antlr.v4.tool.ast.GrammarAST>, org.antlr.v4.tool.ast.GrammarAST) is called
for a lexer rule with the fragment modifier until
exitLexerRule(org.antlr.v4.tool.ast.GrammarAST) is called. |
protected int |
nonFragmentRuleCount
This field is used for reporting the
ErrorType.MODE_WITHOUT_RULES
error when necessary. |
RuleCollector |
ruleCollector |
static org.stringtemplate.v4.misc.MultiMap<java.lang.Integer,java.lang.Integer> |
validImportTypes
Set of valid imports.
|
ACTION, ACTION_CHAR_LITERAL, ACTION_ESC, ACTION_STRING_LITERAL, ALT, ALTLIST, ARG, ARG_ACTION, ARG_OR_CHARSET, ARGLIST, ASSIGN, AT, BLOCK, CATCH, CHANNELS, CHAR_RANGE, CLOSURE, COLON, COLONCOLON, COMBINED, COMMA, COMMENT, currentModeName, currentOuterAltNumber, currentOuterAltRoot, currentRuleAST, currentRuleName, dfa38, DOC_COMMENT, DOLLAR, DOT, ELEMENT_OPTIONS, EOF, EPSILON, ERRCHAR, ESC_SEQ, FINALLY, FOLLOW_ACTION_in_action596, FOLLOW_ACTION_in_actionElement1716, FOLLOW_ACTION_in_actionElement1724, FOLLOW_ACTION_in_block2467, FOLLOW_ACTION_in_element1905, FOLLOW_ACTION_in_element1934, FOLLOW_ACTION_in_elementOption2770, FOLLOW_ACTION_in_exceptionHandler990, FOLLOW_ACTION_in_finallyClause1017, FOLLOW_ACTION_in_lexerElement1465, FOLLOW_ACTION_in_lexerElement1494, FOLLOW_action_in_prequelConstruct234, FOLLOW_ACTION_in_ruleAction1131, FOLLOW_ALT_in_alternative1767, FOLLOW_ALT_in_alternative1780, FOLLOW_ALT_in_lexerElements1420, FOLLOW_alternative_in_block2470, FOLLOW_alternative_in_outerAlternative1354, FOLLOW_ARG_ACTION_in_exceptionHandler988, FOLLOW_ARG_ACTION_in_locals1047, FOLLOW_ARG_ACTION_in_rule809, FOLLOW_ARG_ACTION_in_ruleref2504, FOLLOW_ARG_ACTION_in_ruleReturns1072, FOLLOW_ASSIGN_in_delegateGrammar420, FOLLOW_ASSIGN_in_elementOption2720, FOLLOW_ASSIGN_in_elementOption2744, FOLLOW_ASSIGN_in_elementOption2764, FOLLOW_ASSIGN_in_elementOption2786, FOLLOW_ASSIGN_in_option295, FOLLOW_AT_in_action585, FOLLOW_AT_in_ruleAction1127, FOLLOW_atom_in_astOperand1996, FOLLOW_atom_in_element1893, FOLLOW_block_in_astOperand2013, FOLLOW_BLOCK_in_block2459, FOLLOW_block_in_element1974, FOLLOW_block_in_labeledLexerElement1555, FOLLOW_BLOCK_in_lexerBlock1580, FOLLOW_BLOCK_in_lexerRuleBlock1209, FOLLOW_BLOCK_in_ruleBlock1273, FOLLOW_block_in_subrule2071, FOLLOW_block_in_subrule2078, FOLLOW_blockSet_in_astOperand2004, FOLLOW_blockSet_in_atom2262, FOLLOW_blockSet_in_element1965, FOLLOW_blockSet_in_lexerAtom1629, FOLLOW_blockSet_in_lexerAtom1640, FOLLOW_blockSuffix_in_lexerSubrule2103, FOLLOW_blockSuffix_in_subrule2069, FOLLOW_CATCH_in_exceptionHandler986, FOLLOW_CHANNELS_in_channelsSpec532, FOLLOW_channelSpec_in_channelsSpec534, FOLLOW_channelsSpec_in_prequelConstruct224, FOLLOW_delegateGrammar_in_delegateGrammars391, FOLLOW_delegateGrammars_in_prequelConstruct204, FOLLOW_DOT_in_atom2200, FOLLOW_DOT_in_atom2211, FOLLOW_ebnfSuffix_in_blockSuffix2139, FOLLOW_element_in_alternative1772, FOLLOW_element_in_labeledElement2044, FOLLOW_ELEMENT_OPTIONS_in_elementOptions2667, FOLLOW_elementOption_in_elementOptions2669, FOLLOW_elementOptions_in_actionElement1726, FOLLOW_elementOptions_in_actionElement1744, FOLLOW_elementOptions_in_alternative1769, FOLLOW_elementOptions_in_alternative1782, FOLLOW_elementOptions_in_atom2227, FOLLOW_elementOptions_in_element1936, FOLLOW_elementOptions_in_element1949, FOLLOW_elementOptions_in_lexerAtom1653, FOLLOW_elementOptions_in_lexerElement1496, FOLLOW_elementOptions_in_lexerElement1509, FOLLOW_elementOptions_in_ruleref2507, FOLLOW_elementOptions_in_setElement2325, FOLLOW_elementOptions_in_setElement2339, FOLLOW_elementOptions_in_terminal2580, FOLLOW_elementOptions_in_terminal2619, FOLLOW_EPSILON_in_alternative1785, FOLLOW_EPSILON_in_lexerElement1517, FOLLOW_exceptionGroup_in_rule910, FOLLOW_exceptionHandler_in_exceptionGroup957, FOLLOW_FINALLY_in_finallyClause1015, FOLLOW_finallyClause_in_exceptionGroup960, FOLLOW_FRAGMENT_in_lexerRule712, FOLLOW_GRAMMAR_in_grammarSpec85, FOLLOW_ID_in_action589, FOLLOW_ID_in_action594, FOLLOW_ID_in_atom2202, FOLLOW_ID_in_atom2213, FOLLOW_ID_in_channelSpec557, FOLLOW_ID_in_delegateGrammar424, FOLLOW_ID_in_delegateGrammar428, FOLLOW_ID_in_delegateGrammar443, 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_labeledElement2042, FOLLOW_ID_in_labeledLexerElement1550, FOLLOW_ID_in_lexerCommand1813, FOLLOW_ID_in_lexerCommand1831, FOLLOW_ID_in_mode664, FOLLOW_ID_in_option297, FOLLOW_ID_in_ruleAction1129, FOLLOW_ID_in_throwsSpec1100, FOLLOW_ID_in_tokenSpec502, FOLLOW_IMPORT_in_delegateGrammars389, FOLLOW_INT_in_elementOption2792, FOLLOW_labeledElement_in_element1888, FOLLOW_labeledLexerElement_in_lexerElement1448, FOLLOW_LEXER_ACTION_CALL_in_lexerCommand1811, FOLLOW_LEXER_ALT_ACTION_in_lexerAlternative1376, FOLLOW_LEXER_CHAR_SET_in_lexerAtom1672, FOLLOW_LEXER_CHAR_SET_in_setElement2434, FOLLOW_lexerAlternative_in_lexerBlock1585, FOLLOW_lexerAlternative_in_lexerOuterAlternative1332, FOLLOW_lexerAtom_in_labeledLexerElement1553, FOLLOW_lexerAtom_in_lexerElement1453, FOLLOW_lexerBlock_in_lexerSubrule2105, FOLLOW_lexerBlock_in_lexerSubrule2112, FOLLOW_lexerCommand_in_lexerAlternative1380, FOLLOW_lexerCommandExpr_in_lexerCommand1815, FOLLOW_lexerElement_in_lexerElements1422, FOLLOW_lexerElements_in_lexerAlternative1378, FOLLOW_lexerElements_in_lexerAlternative1392, FOLLOW_lexerOuterAlternative_in_lexerRuleBlock1228, FOLLOW_lexerRule_in_mode668, FOLLOW_lexerRule_in_rules631, FOLLOW_lexerRuleBlock_in_lexerRule737, FOLLOW_lexerSubrule_in_lexerElement1458, FOLLOW_LOCALS_in_locals1045, FOLLOW_locals_in_rule848, FOLLOW_mode_in_grammarSpec125, FOLLOW_MODE_in_mode662, FOLLOW_NOT_in_astOperand2002, FOLLOW_NOT_in_astOperand2011, FOLLOW_NOT_in_element1963, FOLLOW_NOT_in_element1972, FOLLOW_NOT_in_lexerAtom1627, FOLLOW_option_in_optionsSpec261, FOLLOW_OPTIONS_in_optionsSpec259, FOLLOW_optionsSpec_in_block2461, FOLLOW_optionsSpec_in_lexerBlock1582, FOLLOW_optionsSpec_in_prequelConstruct194, FOLLOW_optionsSpec_in_rule863, FOLLOW_optionValue_in_option301, FOLLOW_outerAlternative_in_ruleBlock1292, FOLLOW_prequelConstruct_in_prequelConstructs167, FOLLOW_prequelConstructs_in_grammarSpec106, FOLLOW_range_in_element1957, FOLLOW_range_in_lexerAtom1682, FOLLOW_RANGE_in_range2544, FOLLOW_RANGE_in_setElement2403, FOLLOW_RETURNS_in_ruleReturns1070, FOLLOW_RULE_in_lexerRule694, FOLLOW_RULE_in_rule782, FOLLOW_rule_in_rules629, FOLLOW_RULE_REF_in_rule784, FOLLOW_RULE_REF_in_ruleref2500, FOLLOW_ruleAction_in_block2464, FOLLOW_ruleAction_in_rule877, FOLLOW_ruleBlock_in_rule908, FOLLOW_ruleModifier_in_rule798, FOLLOW_RULEMODIFIERS_in_lexerRule708, FOLLOW_RULEMODIFIERS_in_rule793, FOLLOW_ruleref_in_atom2215, FOLLOW_ruleref_in_atom2272, FOLLOW_ruleref_in_lexerAtom1692, FOLLOW_ruleReturns_in_rule822, FOLLOW_rules_in_grammarSpec123, FOLLOW_RULES_in_rules624, FOLLOW_SEMPRED_in_actionElement1734, FOLLOW_SEMPRED_in_actionElement1742, FOLLOW_SEMPRED_in_element1919, FOLLOW_SEMPRED_in_element1947, FOLLOW_SEMPRED_in_lexerElement1479, FOLLOW_SEMPRED_in_lexerElement1507, FOLLOW_SET_in_blockSet2297, FOLLOW_set_in_labeledElement2036, FOLLOW_set_in_labeledLexerElement1544, FOLLOW_setElement_in_blockSet2299, FOLLOW_STRING_LITERAL_in_elementOption2750, FOLLOW_STRING_LITERAL_in_range2546, FOLLOW_STRING_LITERAL_in_range2548, FOLLOW_STRING_LITERAL_in_setElement2323, FOLLOW_STRING_LITERAL_in_setElement2349, FOLLOW_STRING_LITERAL_in_setElement2407, FOLLOW_STRING_LITERAL_in_setElement2411, FOLLOW_STRING_LITERAL_in_terminal2578, FOLLOW_STRING_LITERAL_in_terminal2603, FOLLOW_subrule_in_element1898, FOLLOW_terminal_in_atom2204, FOLLOW_terminal_in_atom2254, FOLLOW_terminal_in_lexerAtom1616, FOLLOW_THROWS_in_throwsSpec1098, FOLLOW_throwsSpec_in_rule835, FOLLOW_TOKEN_REF_in_lexerRule696, FOLLOW_TOKEN_REF_in_setElement2337, FOLLOW_TOKEN_REF_in_setElement2374, FOLLOW_TOKEN_REF_in_terminal2617, FOLLOW_TOKEN_REF_in_terminal2630, FOLLOW_TOKENS_SPEC_in_tokensSpec477, FOLLOW_tokenSpec_in_tokensSpec479, FOLLOW_tokensSpec_in_prequelConstruct214, FOLLOW_WILDCARD_in_atom2225, FOLLOW_WILDCARD_in_atom2238, FOLLOW_WILDCARD_in_lexerAtom1651, FOLLOW_WILDCARD_in_lexerAtom1664, 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, UNICODE_EXTENDED_ESC, UnicodeBOM, WILDCARD, WS, WSCHARS, WSNLCHARS| Constructor and Description |
|---|
BasicSemanticChecks(Grammar g,
RuleCollector ruleCollector) |
| Modifier and Type | Method and Description |
|---|---|
void |
actionInAlt(ActionAST action) |
void |
blockOption(GrammarAST ID,
GrammarAST valueAST) |
(package private) void |
checkChannelDefinition(org.antlr.runtime.Token tokenID) |
protected void |
checkElementIsOuterMostInSingleAlt(GrammarAST tree)
Make sure that action is last element in outer alt; here action,
a2, z, and zz are bad, but a3 is ok:
(RULE A (BLOCK (ALT {action} 'a')))
(RULE B (BLOCK (ALT (BLOCK (ALT {a2} 'x') (ALT 'y')) {a3})))
(RULE C (BLOCK (ALT 'd' {z}) (ALT 'e' {zz})))
|
(package private) boolean |
checkElementOptions(GrammarASTWithOptions elem,
GrammarAST ID,
GrammarAST valueAST)
Check option is appropriate for elem; parent of ID is ELEMENT_OPTIONS
|
(package private) void |
checkGrammarName(org.antlr.runtime.Token nameToken) |
(package private) void |
checkImport(org.antlr.runtime.Token importID) |
(package private) void |
checkInvalidRuleDef(org.antlr.runtime.Token ruleID) |
(package private) void |
checkInvalidRuleRef(org.antlr.runtime.Token ruleID) |
(package private) void |
checkNumPrequels(java.util.List<GrammarAST> options,
java.util.List<GrammarAST> imports,
java.util.List<GrammarAST> tokens) |
(package private) void |
checkNumRules(GrammarAST rulesNode) |
(package private) boolean |
checkOptions(GrammarAST parent,
org.antlr.runtime.Token optionID,
GrammarAST valueAST)
Check option is appropriate for grammar, rule, subrule
|
(package private) boolean |
checkRuleRefOptions(RuleRefAST elem,
GrammarAST ID,
GrammarAST valueAST) |
(package private) void |
checkTokenDefinition(org.antlr.runtime.Token tokenID) |
(package private) boolean |
checkTokenOptions(TerminalAST elem,
GrammarAST ID,
GrammarAST valueAST) |
void |
defineChannel(GrammarAST ID) |
void |
defineToken(GrammarAST ID) |
void |
discoverGrammar(GrammarRootAST root,
GrammarAST ID) |
void |
discoverLexerRule(RuleAST rule,
GrammarAST ID,
java.util.List<GrammarAST> modifiers,
GrammarAST block) |
void |
discoverRule(RuleAST rule,
GrammarAST ID,
java.util.List<GrammarAST> modifiers,
ActionAST arg,
ActionAST returns,
GrammarAST thrws,
GrammarAST options,
ActionAST locals,
java.util.List<GrammarAST> actions,
GrammarAST block) |
void |
discoverRules(GrammarAST rules) |
void |
elementOption(GrammarASTWithOptions elem,
GrammarAST ID,
GrammarAST valueAST) |
protected void |
enterChannelsSpec(GrammarAST tree) |
protected void |
enterLabeledLexerElement(GrammarAST tree) |
protected void |
enterLexerCommand(GrammarAST tree) |
protected void |
enterLexerElement(GrammarAST tree) |
protected void |
enterMode(GrammarAST tree) |
protected void |
enterTerminal(GrammarAST tree) |
protected void |
exitLexerRule(GrammarAST tree) |
protected void |
exitMode(GrammarAST tree) |
void |
finishPrequels(GrammarAST firstPrequel) |
void |
finishRule(RuleAST rule,
GrammarAST ID,
GrammarAST block) |
ErrorManager |
getErrorManager() |
void |
grammarOption(GrammarAST ID,
GrammarAST valueAST) |
void |
importGrammar(GrammarAST label,
GrammarAST ID) |
void |
label(GrammarAST op,
GrammarAST ID,
GrammarAST element) |
(package private) boolean |
legalGrammarOption(java.lang.String key) |
void |
modeDef(GrammarAST m,
GrammarAST ID) |
void |
process() |
void |
ruleOption(GrammarAST ID,
GrammarAST valueAST) |
void |
ruleRef(GrammarAST ref,
ActionAST arg) |
action, actionElement, alternative, astOperand, atom, block, blockSet, blockSuffix, channelSpec, channelsSpec, delegateGrammar, delegateGrammars, discoverAlt, discoverOuterAlt, ebnfSuffix, element, elementOption, elementOptions, enterAction, enterActionElement, enterAlternative, enterAstOperand, enterAtom, enterBlock, enterBlockSet, enterBlockSuffix, enterChannelSpec, enterDelegateGrammar, enterDelegateGrammars, enterEbnfSuffix, enterElement, enterElementOption, enterElementOptions, enterExceptionGroup, enterExceptionHandler, enterFinallyClause, enterGrammarSpec, enterLabeledElement, enterLexerAlternative, enterLexerAtom, enterLexerBlock, enterLexerCommandExpr, enterLexerElements, enterLexerOuterAlternative, enterLexerRule, enterLexerRuleBlock, enterLexerSubrule, enterLocals, enterOption, enterOptionsSpec, enterOptionValue, enterOuterAlternative, enterPrequelConstruct, enterPrequelConstructs, enterRange, enterRule, enterRuleAction, enterRuleBlock, enterRuleModifier, enterRuleref, enterRuleReturns, enterRules, enterSetElement, enterSubrule, enterThrowsSpec, enterTokenSpec, enterTokensSpec, exceptionGroup, exceptionHandler, exitAction, exitActionElement, exitAlternative, exitAstOperand, exitAtom, exitBlock, exitBlockSet, exitBlockSuffix, exitChannelSpec, exitChannelsSpec, exitDelegateGrammar, exitDelegateGrammars, exitEbnfSuffix, exitElement, exitElementOption, exitElementOptions, exitExceptionGroup, exitExceptionHandler, exitFinallyClause, exitGrammarSpec, exitLabeledElement, exitLabeledLexerElement, exitLexerAlternative, exitLexerAtom, exitLexerBlock, exitLexerCommand, exitLexerCommandExpr, exitLexerElement, exitLexerElements, exitLexerOuterAlternative, exitLexerRuleBlock, exitLexerSubrule, exitLocals, 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, finishRules, getDelegates, getGrammarFileName, getTokenNames, globalNamedAction, grammarSpec, labeledElement, labeledLexerElement, lexerAlternative, lexerAtom, lexerBlock, lexerCallCommand, lexerCommand, lexerCommand, lexerCommandExpr, lexerElement, lexerElements, lexerOuterAlternative, lexerRule, lexerRuleBlock, lexerSubrule, locals, mode, option, optionsSpec, optionValue, outerAlternative, prequelConstruct, prequelConstructs, range, rule, ruleAction, ruleBlock, ruleCatch, ruleModifier, 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 static org.stringtemplate.v4.misc.MultiMap<java.lang.Integer,java.lang.Integer> validImportTypes
public Grammar g
public RuleCollector ruleCollector
public ErrorManager errMgr
public boolean checkAssocElementOption
true, the semantic checks will report
ErrorType.UNRECOGNIZED_ASSOC_OPTION where appropriate. This may
be set to false to disable this specific check.
The default value is true.
protected int nonFragmentRuleCount
ErrorType.MODE_WITHOUT_RULES
error when necessary.private boolean inFragmentRule
true from the time discoverLexerRule(org.antlr.v4.tool.ast.RuleAST, org.antlr.v4.tool.ast.GrammarAST, java.util.List<org.antlr.v4.tool.ast.GrammarAST>, org.antlr.v4.tool.ast.GrammarAST) is called
for a lexer rule with the fragment modifier until
exitLexerRule(org.antlr.v4.tool.ast.GrammarAST) is called.public BasicSemanticChecks(Grammar g, RuleCollector ruleCollector)
public ErrorManager getErrorManager()
getErrorManager in class GrammarTreeVisitorpublic void process()
public void discoverGrammar(GrammarRootAST root, GrammarAST ID)
discoverGrammar in class GrammarTreeVisitorpublic void finishPrequels(GrammarAST firstPrequel)
finishPrequels in class GrammarTreeVisitorpublic void importGrammar(GrammarAST label, GrammarAST ID)
importGrammar in class GrammarTreeVisitorpublic void discoverRules(GrammarAST rules)
discoverRules in class GrammarTreeVisitorprotected void enterMode(GrammarAST tree)
enterMode in class GrammarTreeVisitorprotected void exitMode(GrammarAST tree)
exitMode in class GrammarTreeVisitorpublic void modeDef(GrammarAST m, GrammarAST ID)
modeDef in class GrammarTreeVisitorpublic void discoverRule(RuleAST rule, GrammarAST ID, java.util.List<GrammarAST> modifiers, ActionAST arg, ActionAST returns, GrammarAST thrws, GrammarAST options, ActionAST locals, java.util.List<GrammarAST> actions, GrammarAST block)
discoverRule in class GrammarTreeVisitorpublic void discoverLexerRule(RuleAST rule, GrammarAST ID, java.util.List<GrammarAST> modifiers, GrammarAST block)
discoverLexerRule in class GrammarTreeVisitorprotected void exitLexerRule(GrammarAST tree)
exitLexerRule in class GrammarTreeVisitorpublic void ruleRef(GrammarAST ref, ActionAST arg)
ruleRef in class GrammarTreeVisitorpublic void ruleOption(GrammarAST ID, GrammarAST valueAST)
ruleOption in class GrammarTreeVisitorpublic void blockOption(GrammarAST ID, GrammarAST valueAST)
blockOption in class GrammarTreeVisitorpublic void grammarOption(GrammarAST ID, GrammarAST valueAST)
grammarOption in class GrammarTreeVisitorpublic void defineToken(GrammarAST ID)
defineToken in class GrammarTreeVisitorprotected void enterChannelsSpec(GrammarAST tree)
enterChannelsSpec in class GrammarTreeVisitorpublic void defineChannel(GrammarAST ID)
defineChannel in class GrammarTreeVisitorpublic void elementOption(GrammarASTWithOptions elem, GrammarAST ID, GrammarAST valueAST)
elementOption in class GrammarTreeVisitorpublic void finishRule(RuleAST rule, GrammarAST ID, GrammarAST block)
finishRule in class GrammarTreeVisitorvoid checkGrammarName(org.antlr.runtime.Token nameToken)
void checkNumRules(GrammarAST rulesNode)
void checkNumPrequels(java.util.List<GrammarAST> options, java.util.List<GrammarAST> imports, java.util.List<GrammarAST> tokens)
void checkInvalidRuleDef(org.antlr.runtime.Token ruleID)
void checkInvalidRuleRef(org.antlr.runtime.Token ruleID)
void checkTokenDefinition(org.antlr.runtime.Token tokenID)
void checkChannelDefinition(org.antlr.runtime.Token tokenID)
protected void enterLexerElement(GrammarAST tree)
enterLexerElement in class GrammarTreeVisitorprotected void enterLexerCommand(GrammarAST tree)
enterLexerCommand in class GrammarTreeVisitorpublic void actionInAlt(ActionAST action)
actionInAlt in class GrammarTreeVisitorprotected void checkElementIsOuterMostInSingleAlt(GrammarAST tree)
public void label(GrammarAST op, GrammarAST ID, GrammarAST element)
label in class GrammarTreeVisitorprotected void enterLabeledLexerElement(GrammarAST tree)
enterLabeledLexerElement in class GrammarTreeVisitorprotected void enterTerminal(GrammarAST tree)
enterTerminal in class GrammarTreeVisitorboolean checkOptions(GrammarAST parent, org.antlr.runtime.Token optionID, GrammarAST valueAST)
boolean checkElementOptions(GrammarASTWithOptions elem, GrammarAST ID, GrammarAST valueAST)
boolean checkRuleRefOptions(RuleRefAST elem, GrammarAST ID, GrammarAST valueAST)
boolean checkTokenOptions(TerminalAST elem, GrammarAST ID, GrammarAST valueAST)
boolean legalGrammarOption(java.lang.String key)
void checkImport(org.antlr.runtime.Token importID)