Package org.antlr.v4.semantics
Class SymbolChecks
- java.lang.Object
-
- org.antlr.v4.semantics.SymbolChecks
-
public class SymbolChecks extends Object
Check for symbol problems; no side-effects. Inefficient to walk rules and such multiple times, but I like isolating all error checking outside of code that actually defines symbols etc... Side-effect: strip away redef'd rules.
-
-
Field Summary
Fields Modifier and Type Field Description ErrorManager
errMgr
protected Set<String>
reservedNames
-
Constructor Summary
Constructors Constructor Description SymbolChecks(Grammar g, SymbolCollector collector)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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
checkForTokenConflicts(List<GrammarAST> tokenIDRefs)
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()
-
-
-
Field Detail
-
errMgr
public ErrorManager errMgr
-
-
Constructor Detail
-
SymbolChecks
public SymbolChecks(Grammar g, SymbolCollector collector)
-
-
Method Detail
-
process
public void process()
-
checkActionRedefinitions
public void checkActionRedefinitions(List<GrammarAST> actions)
-
checkForTokenConflicts
public void checkForTokenConflicts(List<GrammarAST> tokenIDRefs)
-
checkForLabelConflicts
public void checkForLabelConflicts(Collection<Rule> rules)
Make sure a label doesn't conflict with another symbol. Labels must not conflict with: rules, tokens, scope names, return values, parameters, and rule-scope dynamic attributes defined in surrounding rule. Also they must have same type for repeated defs.
-
checkForLabelConflict
public void checkForLabelConflict(Rule r, GrammarAST labelID)
-
checkForAttributeConflicts
public void checkForAttributeConflicts(Rule r)
-
checkDeclarationRuleConflicts
protected void checkDeclarationRuleConflicts(Rule r, AttributeDict attributes, Set<String> ruleNames, ErrorType errorType)
-
checkLocalConflictingDeclarations
protected void checkLocalConflictingDeclarations(Rule r, AttributeDict attributes, AttributeDict referenceAttributes, ErrorType errorType)
-
checkReservedNames
protected void checkReservedNames(Collection<Rule> rules)
-
checkForModeConflicts
public void checkForModeConflicts(Grammar g)
-
checkRuleArgs
public void checkRuleArgs(Grammar g, List<GrammarAST> rulerefs)
-
checkForQualifiedRuleIssues
public void checkForQualifiedRuleIssues(Grammar g, List<GrammarAST> qualifiedRuleRefs)
-
-