public class VariantSorter extends Visitor
| Modifier and Type | Class and Description |
|---|---|
class |
VariantSorter.Registrar
Visitor to register all generic node names with the type
operations class.
|
class |
VariantSorter.Typer
Visitor to determine a generic production's variant type.
|
| Modifier and Type | Field and Description |
|---|---|
protected Analyzer |
analyzer
The analyzer.
|
protected AST |
ast
The type operations.
|
protected java.util.List<Element> |
elements
The list of elements representing the current alternative.
|
protected VariantSorter.Typer |
gtyper
The generic production typer.
|
protected boolean |
hasChanged
The flag for whether productions have changed in push mode.
|
protected boolean |
isGeneric
The flag for whether the current production is generic.
|
protected boolean |
isPushMode
The flag for whether the current mode is push or pull.
|
protected java.util.Map<Node,Node> |
malformed
The set of AST nodes resulting in an error.
|
protected FullProduction |
production
The current production.
|
protected java.util.List<Production> |
productions
The productions to be processed in push mode.
|
protected Runtime |
runtime
The runtime.
|
protected java.util.List<Type> |
types
The current types.
|
| Constructor and Description |
|---|
VariantSorter(Runtime runtime,
Analyzer analyzer,
AST ast)
Create a new variant sorter.
|
| Modifier and Type | Method and Description |
|---|---|
protected Type |
merge(VariantT v1,
VariantT v2,
Production p)
Merge the two variants.
|
protected void |
pushPull(Module m)
Push and pull any variant types.
|
protected void |
recurse(Element e)
Recurse on the specified element.
|
protected void |
setType(Production p,
Type t)
Set the specified production's type to the specified type.
|
void |
visit(FullProduction p)
Visit the specified production.
|
void |
visit(Module m)
Visit the specified grammar.
|
void |
visit(OrderedChoice c)
Visit the specified choice.
|
void |
visit(Sequence s)
Visit the specified sequence.
|
dispatch, equals, hashCode, iterate, map, mapInPlace, unableToVisit, visitprotected final Runtime runtime
protected final Analyzer analyzer
protected final AST ast
protected final VariantSorter.Typer gtyper
protected boolean isPushMode
protected java.util.List<Production> productions
protected boolean hasChanged
protected java.util.List<Type> types
visit(FullProduction).protected FullProduction production
protected boolean isGeneric
protected java.util.List<Element> elements
protected Type merge(VariantT v1, VariantT v2, Production p)
v1 - The first variant.v2 - The second variant.p - The production for error reporting.protected void setType(Production p, Type t)
p - The production.t - The type.protected void pushPull(Module m)
m - The grammar.public void visit(Module m)
public void visit(FullProduction p)
public void visit(OrderedChoice c)
public void visit(Sequence s)
protected void recurse(Element e)
e - The element.Copyright © 2014. All Rights Reserved.