public class MetaDataSetter extends Visitor
Properties.GENERIC and
Properties.RECURSIVE have been appropriately set. Also
note that this visitor does not create meta-data records; they must
be created with the meta-data creator
before applying this visitor. Further note that this visitor does
not determine usage and self counts, as they need to be
(repeatedly) determined during dead
production elimination. Finally, note that this visitor assumes
that the entire grammar is contained in a single module.| Modifier and Type | Field and Description |
|---|---|
protected Analyzer |
analyzer
The analyzer utility.
|
protected AST |
ast
The type operations.
|
protected java.util.List<Type> |
boundRepetitions
The structure of bound repetitions.
|
protected boolean |
createsNodeValue
Flag for whether the current production may create a node value.
|
protected boolean |
hasParseTree
Flag for whether the grammar has the
parseTree attribute. |
static java.util.regex.Pattern |
IMPORT
The regular expression for matching import declarations.
|
protected boolean |
isBound
Flag for whether the next element is bound.
|
protected boolean |
isFirstElement
Flag for whether the current element is the first element of a
sequence.
|
protected boolean |
isLastInPredicate
Flag for whether the current element is the last element in a
predicate.
|
protected boolean |
isNotFollowedBy
Flag for whether we are analyzing a not-followed-by predicate.
|
protected boolean |
isOptional
Flag for whether the current sequence is optional.
|
protected boolean |
isPredicate
Flag for whether we are analyzing a predicate.
|
protected boolean |
isRepeated
Flag for whether the current sequence is repeated.
|
protected boolean |
isTopLevel
Flag for whether the current element is the top-level element of
a production.
|
protected int |
optionLevel
The current nesting level for options.
|
protected java.util.List<Type> |
options
The structure of options.
|
protected int |
repetitionLevel
The current nesting level for repetitions.
|
protected java.util.List<java.lang.Boolean> |
repetitions
The structure of repetitions.
|
protected boolean |
requiresBaseIndex
Flag for whether a production requires a base index variable.
|
protected boolean |
requiresChar
Flag for whether a production requires a character variable.
|
protected boolean |
requiresIndex
Flag for whether a production requires an index variable.
|
protected boolean |
requiresLocatable
Flag for whether the grammar requires
Locatable. |
protected boolean |
requiresPredIndex
Flag for whether a production requires a predicate index variable.
|
protected boolean |
requiresPredMatch
Flag for whether a production requires a predicate matched variable.
|
protected boolean |
requiresPredResult
Flag for whether a production requires a predicate result variable.
|
protected boolean |
requiresResult
Flag for whether a production requires a result variable.
|
protected Runtime |
runtime
The runtime.
|
protected boolean |
withLocation
Flag for whether the grammar has the
withLocation attribute. |
| Constructor and Description |
|---|
MetaDataSetter(Runtime runtime,
Analyzer analyzer,
AST ast)
Create a new meta-data setter.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
hasDirectLocation()
Determine whether the current production can annotate a node with
its location relative to
CodeGenerator.VALUE. |
protected void |
importType(java.lang.String name)
Import the specified fully qualified type.
|
protected boolean |
isNotFollowedBy()
Determine whether we are processing a not-followed-by predicate.
|
void |
visit(Action a)
Analyze the specified action.
|
void |
visit(ActionBaseValue v)
Analyze the specified action base value.
|
void |
visit(AnyChar a)
Analyze the specified any character element.
|
void |
visit(Binding b)
Analyze the specified binding.
|
void |
visit(CharCase c)
Analyze the specified character case.
|
void |
visit(CharSwitch s)
Analyzer the specified character switch.
|
void |
visit(Element e)
Analyze the specified element.
|
void |
visit(FollowedBy p)
Analyze the specified followed-by predicate.
|
void |
visit(GenericActionValue v)
Analyze the specified generic action value.
|
void |
visit(GenericValue v)
Analyze the specified generic value.
|
void |
visit(Module m)
Analyze the specified grammar.
|
void |
visit(NonTerminal nt)
Analyze the specified nonterminal.
|
void |
visit(NotFollowedBy p)
Analyze the specified not-followed-by predicate.
|
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(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(TokenValue v)
Analyze the specified token value.
|
void |
visit(VoidedElement v)
Analyze the specified voided element.
|
dispatch, equals, hashCode, iterate, map, mapInPlace, unableToVisit, visitpublic static final java.util.regex.Pattern IMPORT
protected final Runtime runtime
protected final Analyzer analyzer
protected final AST ast
protected boolean withLocation
withLocation attribute.protected boolean hasParseTree
parseTree attribute.protected boolean requiresLocatable
Locatable.protected boolean requiresChar
protected boolean requiresIndex
protected boolean requiresResult
protected boolean requiresPredIndex
protected boolean requiresPredResult
protected boolean requiresPredMatch
protected boolean requiresBaseIndex
protected java.util.List<java.lang.Boolean> repetitions
protected java.util.List<Type> boundRepetitions
protected java.util.List<Type> options
protected boolean createsNodeValue
protected boolean isTopLevel
protected boolean isRepeated
protected boolean isOptional
protected boolean isFirstElement
protected boolean isBound
protected boolean isPredicate
protected boolean isNotFollowedBy
protected boolean isLastInPredicate
protected int repetitionLevel
protected int optionLevel
protected void importType(java.lang.String name)
name - The type name.public void visit(Module m)
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(FollowedBy p)
protected boolean isNotFollowedBy()
true if we are processing a not-followed-by
predicate.public void visit(NotFollowedBy 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(AnyChar a)
public void visit(StringLiteral l)
public void visit(CharCase c)
public void visit(CharSwitch s)
public void visit(Terminal t)
public void visit(Action a)
public void visit(ParserAction pa)
protected boolean hasDirectLocation()
CodeGenerator.VALUE.true if the location annotation can be
optimized.public void visit(TokenValue v)
public void visit(ActionBaseValue v)
public void visit(GenericValue v)
public void visit(GenericActionValue v)
public void visit(Element e)
Copyright © 2014. All Rights Reserved.