xtc.parser
Class GenericVoider

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

public class GenericVoider
extends GrammarVisitor

Visitor to turn generic productions into void productions. Note that this visitor also voids productions that have Node or GNode as their types.

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

Version:
$Revision: 1.11 $
Author:
Robert Grimm

Field Summary
 
Fields inherited from class xtc.parser.GrammarVisitor
analyzer, isBound, isLastElement, isPredicate, isRepeatedOnce, isTopLevel, isVoided, needsSequence, runtime, transformInPlace
 
Constructor Summary
GenericVoider(Runtime runtime, Analyzer analyzer)
          Create a new generic voider.
 
Method Summary
protected  Element check(UnaryOperator op)
          Check the specified binding or string match.
 Element visit(Binding b)
          Visit the specified binding.
 java.lang.Object visit(Module m)
          Visit the specified grammar.
 Element visit(StringMatch m)
          Visit the specified string match.
 
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

GenericVoider

public GenericVoider(Runtime runtime,
                     Analyzer analyzer)
Create a new generic voider.

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

check

protected Element check(UnaryOperator op)
Check the specified binding or string match. If the bound or matched element has been voided by this visitor, this method reports an error. However, bindings to yyValue in voided productions are eliminated.

Parameters:
op - The binding or string match.
Returns:
The checked element.

visit

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

Overrides:
visit in class GrammarVisitor

visit

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

Overrides:
visit in class GrammarVisitor

visit

public Element visit(StringMatch m)
Visit the specified string match.

Overrides:
visit in class GrammarVisitor


Copyright © 2012. All Rights Reserved.