public class SymbolChecks extends Object
Modifier and Type | Field and Description |
---|---|
ErrorManager |
errMgr |
protected Set<String> |
reservedNames |
Constructor and Description |
---|
SymbolChecks(Grammar g,
SymbolCollector collector) |
Modifier and Type | Method and Description |
---|---|
void |
checkActionRedefinitions(List<GrammarAST> actions) |
protected void |
checkDeclarationRuleConflicts(Rule r,
AttributeDict attributes,
Set<String> ruleNames,
ErrorType errorType) |
void |
checkForAttributeConflicts(Rule r) |
void |
checkForLabelConflict(Rule r,
GrammarAST labelID) |
void |
checkForLabelConflicts(Collection<Rule> rules)
Make sure a label doesn't conflict with another symbol.
|
void |
checkForModeConflicts(Grammar g) |
void |
checkForQualifiedRuleIssues(Grammar g,
List<GrammarAST> qualifiedRuleRefs) |
void |
checkForUnreachableTokens(Grammar g)
Algorithm steps:
1.
|
protected void |
checkLocalConflictingDeclarations(Rule r,
AttributeDict attributes,
AttributeDict referenceAttributes,
ErrorType errorType) |
protected void |
checkReservedNames(Collection<Rule> rules) |
void |
checkRuleArgs(Grammar g,
List<GrammarAST> rulerefs) |
void |
process() |
public ErrorManager errMgr
public SymbolChecks(Grammar g, SymbolCollector collector)
public void process()
public void checkActionRedefinitions(List<GrammarAST> actions)
public void checkForLabelConflicts(Collection<Rule> rules)
public void checkForLabelConflict(Rule r, GrammarAST labelID)
public void checkForAttributeConflicts(Rule r)
protected void checkDeclarationRuleConflicts(Rule r, AttributeDict attributes, Set<String> ruleNames, ErrorType errorType)
protected void checkLocalConflictingDeclarations(Rule r, AttributeDict attributes, AttributeDict referenceAttributes, ErrorType errorType)
protected void checkReservedNames(Collection<Rule> rules)
public void checkForModeConflicts(Grammar g)
public void checkForUnreachableTokens(Grammar g)
getSingleTokenValues
)
2. Compare every string literal with each other (checkForOverlap
)
and throw TOKEN_UNREACHABLE warning if the same string found.
Complexity: O(m * n^2 / 2), approximately equals to O(n^2)
where m - number of modes, n - average number of lexer rules per mode.
See also testUnreachableTokens unit test for details.public void checkRuleArgs(Grammar g, List<GrammarAST> rulerefs)
public void checkForQualifiedRuleIssues(Grammar g, List<GrammarAST> qualifiedRuleRefs)
Copyright © 1992–2020 ANTLR. All rights reserved.