| java.lang.Object xtc.tree.Visitor xtc.parser.Transformer
Transformer | public class Transformer extends Visitor (Code) | | Visitor to transform productions. This visitor lifts repetitions,
options, and nested choices into their own productions, desugars
reptitions and options, and adds the appropriate semantic values to
expressions that require them. It also ensures that all options
and syntactic predicates are sequences, thus fullfilling the
requirements for
CodeGenerator code generation . Before
applying this visitor on a grammar, the grammar must have been
Simplifier simplified and all text-only productions should
be marked as such by applying the
TextTester visitor.
author: Robert Grimm version: $Revision: 1.2 $ |
Field Summary | |
final protected Analyzer | analyzer The analyzer utility. | protected boolean | isBound The flag for whether the current element is bound. | protected boolean | isLastElement The flag for whether the current element is the last element in a
sequence. | protected boolean | isPredicate The flag for whether we are currently processing a predicate. | protected boolean | isTextOnly The flag for whether the current production is text-only. | protected boolean | isTopLevel The flag for whether the current element is top-level. | protected boolean | isVoid The flag for whether the current production is void. | protected boolean | transformInPlace The flag for whether to transform ordered choices, repetition,
and options in place, instead of creating a new production. |
isBound | protected boolean isBound(Code) | | The flag for whether the current element is bound.
|
isLastElement | protected boolean isLastElement(Code) | | The flag for whether the current element is the last element in a
sequence.
|
isPredicate | protected boolean isPredicate(Code) | | The flag for whether we are currently processing a predicate.
|
isTextOnly | protected boolean isTextOnly(Code) | | The flag for whether the current production is text-only.
|
isTopLevel | protected boolean isTopLevel(Code) | | The flag for whether the current element is top-level.
|
isVoid | protected boolean isVoid(Code) | | The flag for whether the current production is void.
|
transformInPlace | protected boolean transformInPlace(Code) | | The flag for whether to transform ordered choices, repetition,
and options in place, instead of creating a new production.
|
Transformer | public Transformer(Analyzer analyzer)(Code) | | Create a new transformer.
Parameters: analyzer - The analyzer utility for the new transformer. |
repeatable | protected boolean repeatable()(Code) | | Determine whether the current production may contain repetitions.
A production may contain repetitions if it is transient void or
transient text-only and if the corresponding optimization option
("-Orepeated ") is set.
|
visit | public void visit(Grammar g)(Code) | | Visit the specified grammar.
|
visit | public Element visit(UnaryOperator op)(Code) | | Visit the specified unary operator. This method provides the
default implementation for bindings and string matches.
|
visit | public Element visit(Element e)(Code) | | Visit the specified element. This method provides the default
implementation for nonterminals, terminals, actions, and value
elements.
|
|
|