public class Resolver extends Visitor
marks text-only
productions as such. It also detects left
recursions and marks direct left recursions. Furthermore, it sets
a grammar's Properties.GENERIC and Properties.RECURSIVE properties as appropriate.| Modifier and Type | Field and Description |
|---|---|
protected Analyzer |
analyzer
The analyzer utility.
|
protected AST |
ast
The type operations.
|
protected java.util.Map<NonTerminal,NonTerminal> |
badNTs
The identity hash map of erroneous nonterminals.
|
protected boolean |
hasState
The flag for whether the current module has a stateful attribute.
|
protected boolean |
isMofunctor
The flag for whether the current module is a mofunctor.
|
protected boolean |
isPredicate
Flag for whether the current expression is a predicate.
|
protected int |
phase
The current checking phase.
|
protected Runtime |
runtime
The runtime.
|
protected java.util.Set<SequenceName> |
sequenceNames
The set of sequence names for the current production.
|
| Constructor and Description |
|---|
Resolver(Runtime runtime,
Analyzer analyzer,
AST ast)
Create a new resolver.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
apply(AlternativeAddition p1,
FullProduction p2)
Apply the specified alternative addition to the specified full
production.
|
protected void |
apply(AlternativeRemoval p1,
FullProduction p2)
Apply the specified alternative removal to the specified full
production.
|
protected void |
apply(ProductionOverride p1,
FullProduction p2)
Apply the specified production override to the specified full
production.
|
protected void |
applyModifications(Grammar g)
Apply any module modifications.
|
protected java.util.List<Attribute> |
check(Grammar g)
Perform basic checking for the specified grammar.
|
protected void |
checkExplicit(Grammar g)
Check that explicit productions do not match the empty input.
|
protected void |
checkRecursions(Grammar g)
Check for left-recursive productions.
|
protected void |
checkRepetitions(Grammar g)
Check repetitions for elements that accept the empty input.
|
protected Module |
combine(Grammar g,
java.util.List<Attribute> attributes)
Combine the modules in the specified grammar.
|
protected void |
internTypes(Grammar g)
Intern the grammar's types.
|
protected Grammar |
load(Module m)
Load all dependent modules.
|
protected Module |
load(java.lang.String name)
Load the module with the specified name.
|
protected void |
rename(Module module,
ModuleMap renaming)
Rename the specified module.
|
protected void |
signature(Module m)
Print the specified module's signature.
|
protected Production |
strip(Production p)
Strip the specified production's ordered choice.
|
void |
visit(Action a)
Analyze the specified action.
|
void |
visit(Binding b)
Analyze the specified binding.
|
void |
visit(CharClass c)
Analyze the specified character class.
|
void |
visit(InternalElement e)
Analyze the specified internal element.
|
java.lang.Object |
visit(Module m)
Visit the specified module.
|
void |
visit(NodeMarker m)
Analyze the specified node marker.
|
void |
visit(NonTerminal nt)
Analyze the specified nonterminal.
|
void |
visit(NullLiteral l)
Analyze the specified null literal.
|
void |
visit(Option o)
Analyze the specified option.
|
void |
visit(OrderedChoice c)
Analyze the specified ordered choice.
|
void |
visit(ParserAction pa)
Analyze the specified parser action.
|
void |
visit(Predicate p)
Analyze the specified predicate.
|
void |
visit(Production p)
Analyze the specified production.
|
void |
visit(Repetition r)
Analyze the specified repetition.
|
void |
visit(SemanticPredicate p)
Analyze the specified semantic predicate.
|
void |
visit(Sequence s)
Analyze the specified sequence.
|
void |
visit(StringLiteral l)
Analyze the specified string literal.
|
void |
visit(StringMatch m)
Analyze the specified string match.
|
void |
visit(Terminal t)
Analyze the specified terminal.
|
void |
visit(VoidedElement v)
Analyze the specified voided element.
|
dispatch, equals, hashCode, iterate, map, mapInPlace, unableToVisit, visitprotected final Runtime runtime
protected final Analyzer analyzer
protected final AST ast
protected int phase
protected java.util.Map<NonTerminal,NonTerminal> badNTs
protected boolean hasState
protected boolean isMofunctor
protected boolean isPredicate
protected java.util.Set<SequenceName> sequenceNames
protected void signature(Module m)
m - The module.protected Module load(java.lang.String name) throws java.io.IOException, ParseException
name - The name.IllegalArgmentException - Signals that the file is too large.java.io.FileNotFoundException - Signals that the file does not exist.java.io.IOException - Signals an exceptional condition while accessing the file.ParseException - Signals a parse error.protected void rename(Module module, ModuleMap renaming)
name, the module's dependencies, and each production's qualified name (if it is not null).module - The module.renaming - The renaming.protected Production strip(Production p)
p - The production to strip.Analyzer.stripChoices(xtc.parser.OrderedChoice)protected void apply(AlternativeAddition p1, FullProduction p2)
p1 - The alternative addition.p2 - The full production.protected void apply(AlternativeRemoval p1, FullProduction p2)
p1 - The alternative removal.p2 - The full production.protected void apply(ProductionOverride p1, FullProduction p2)
p1 - The production override.p2 - The full production.protected Grammar load(Module m)
m - The module.null in the
case of errors.protected java.util.List<Attribute> check(Grammar g)
g - The grammar.protected void applyModifications(Grammar g)
modification field has been correctly
initialized.g - The grammar.protected void internTypes(Grammar g)
g - The grammar.protected void checkRecursions(Grammar g)
g - The grammar.protected void checkRepetitions(Grammar g)
g - The grammar.protected void checkExplicit(Grammar g)
g - The grammar.protected Module combine(Grammar g, java.util.List<Attribute> attributes)
g - The grammar.attributes - The list of global attributes.public java.lang.Object visit(Module m)
m - The module to resolve.null on an error condition.public void visit(Production p)
public void visit(OrderedChoice c)
public void visit(Repetition r)
public void visit(Option o)
public void visit(Sequence s)
public void visit(Predicate p)
public void visit(SemanticPredicate p)
public void visit(VoidedElement v)
public void visit(Binding b)
public void visit(StringMatch m)
public void visit(NonTerminal nt)
public void visit(Terminal t)
public void visit(StringLiteral l)
public void visit(CharClass c)
public void visit(NullLiteral l)
public void visit(NodeMarker m)
public void visit(Action a)
public void visit(ParserAction pa)
public void visit(InternalElement e)
Copyright © 2014. All Rights Reserved.