xtc.parser
Class ProductionVoider

java.lang.Object
  extended by xtc.tree.Visitor
      extended by xtc.parser.GrammarVisitor
          extended by xtc.parser.ProductionVoider

public class ProductionVoider
extends GrammarVisitor

Visitor to turn the semantic value of a production to void. This visitor converts non-void productions whose semantic values are never bound to void productions. As a practical matter, it only converts productions that do not contain (parser) actions.

This visitor assumes that the entire grammar is contained in a single module.

Version:
$Revision: 1.39 $
Author:
Robert Grimm

Nested Class Summary
static class ProductionVoider.Tester
          Visitor to determine which productions are voidable.
 
Field Summary
 
Fields inherited from class xtc.parser.GrammarVisitor
analyzer, isBound, isLastElement, isPredicate, isRepeatedOnce, isTopLevel, isVoided, needsSequence, runtime, transformInPlace
 
Constructor Summary
ProductionVoider(Runtime runtime, Analyzer analyzer)
          Create a new production voider.
 
Method Summary
 Element visit(Binding b)
          Visit the specified binding.
 java.lang.Object visit(Module m)
          Visit the specified grammar.
 Element visit(ValueElement e)
          Visit the specified value element.
 Element visit(VoidedElement v)
          Visit the specified voided element.
 
Methods inherited from class xtc.parser.GrammarVisitor
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
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

ProductionVoider

public ProductionVoider(Runtime runtime,
                        Analyzer analyzer)
Create a new production voider.

Parameters:
runtime - The runtime.
analyzer - The analyzer utility.
Method Detail

visit

public java.lang.Object visit(Module m)
Visit the specified grammar.

Overrides:
visit in class GrammarVisitor

visit

public Element visit(VoidedElement v)
Visit the specified voided element.

Overrides:
visit in class GrammarVisitor

visit

public Element visit(Binding b)
Visit the specified binding.

Overrides:
visit in class GrammarVisitor

visit

public Element visit(ValueElement e)
Visit the specified value element.



Copyright © 2012. All Rights Reserved.