xtc.parser
Class Transformer.Desugarer

java.lang.Object
  extended by xtc.tree.Visitor
      extended by xtc.parser.Transformer.Desugarer
Enclosing class:
Transformer

public class Transformer.Desugarer
extends Visitor

Visitor to desugar repetitions and options. This visitor assumes that a production's top-level element is an ordered choice with a sequence for each alternative.


Constructor Summary
Transformer.Desugarer()
          Create a new desugarer.
 
Method Summary
protected  void process(Sequence s, NonTerminal nt)
          Process the specified sequence.
 Element visit(Option o)
          Visit the specified option.
 void visit(Production p)
          Visit the specified production.
 Element visit(Repetition r)
          Visit the specified repetition.
 
Methods inherited from class xtc.tree.Visitor
dispatch, equals, hashCode, iterate, map, mapInPlace, unableToVisit, visit
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transformer.Desugarer

public Transformer.Desugarer()
Create a new desugarer.

Method Detail

process

protected void process(Sequence s,
                       NonTerminal nt)
Process the specified sequence. This method adds a nonterminal and value element at the end of the specified sequence, recursing into the sequences of any ordered choice appearing as a sequence's last element. The current production must be a void, text-only, or token-level production.

Parameters:
s - The sequence.
nt - The nonterminal or null if no nonterminal should be added.

visit

public void visit(Production p)
Visit the specified production.


visit

public Element visit(Repetition r)
Visit the specified repetition.


visit

public Element visit(Option o)
Visit the specified option.



Copyright © 2012. All Rights Reserved.