Visitor to add generic nodes as semantic values.
For any production with pseudotype "generic" that
does not contain any direct left-recursions (which is also called a
generic node production), this visitor adds the appropriate
GenericNodeValue generic node value elements, which create a
xtc.tree.GNode generic node as the productions' semantic
value. The children of such a generic node are the matched
component values of the production, though voided elements, void
nonterminals, and character terminals are not included. If an
alternative assigns
CodeGenerator.VALUE either through a
binding or a semantic action, that alternative's semantic value is
the specified semantic value and not a newly generated generic
node. This visitor requires that all nested choices that do not
appear as the last element in a sequence have been lifted. It also
assumes that the entire grammar is contained in a single module.
Note that this visitor does not process generic productions
that contain direct left-recursions; they are processed by
DirectLeftRecurser .
author: Robert Grimm version: $Revision: 1.55 $
bind(Element e) Create a binding for the specified element.
public static boolean
isGeneric(FullProduction p) Determine whether the specified production is a generic node or a
generic recursion production.
Parameters: p - The production.
Create a binding for the specified element. This method also
adds the name of the bound variable to the end of the list of
children.
Parameters: e - The element to bind. The corresponding binding.
Determine whether the specified production is a generic node or a
generic recursion production.
Parameters: p - The production. true if the specified production is a genericnode or generic recursion production.
Determine whether the specified production is a generic node
production. A production is a generic node production if its
semantic value is an automatically generated generic node with
the component values as its children.
Parameters: p - The production. true if the specified production isa generic node production.
Determine whether the specified production is a generic recursion
production. A production is a generic recursion production if
its semantic value is an automatically generated generic node and
the production, as specified, contains one or more direct
left-recursions that can automatically be transformed into the
corresponding right-recursions.
See Also:DirectLeftRecurser Parameters: p - The production. true if the specified production isa generic recursion production.
Mark the specified production as a generic node production.
Parameters: p - The production. Parameters: verbose - The flag for whether to be verbose.
markGenericRecursion
public static void markGenericRecursion(FullProduction p, boolean verbose)(Code)
Mark the specified production as a generic recursion production.
Parameters: p - The production. Parameters: verbose - The flag for whether to be verbose.
Visit the specified element. This method provides the default
implementation for predicates, voided elements, character
terminals, (parser) actions, and value elements.