xtc.parser
Class Annotator.Detector

java.lang.Object
  extended by xtc.tree.Visitor
      extended by xtc.parser.Annotator.Detector
Enclosing class:
Annotator

public class Annotator.Detector
extends Visitor

A visitor to detect whether productions need to be rewritten. This visitor detects non-left-recursive generic or list-valued productions that contain:

  1. a bindable element with a list value preceded by one or more valuable elements, but no bindable elements;
  2. a bindable element with a list value followed by one or more valuable elements, but no more bindable elements.
For each such production, this visitor sets the Properties.SPLIT property. For each (flattened) alternative that contains any of the two cases, it also annotates the last sequence with a Annotator.IndexPair. The first index is non-negative for the first case. The second index is non-negative for the second case.


Field Summary
protected  java.util.List<Element> elements
          The list of elements.
protected  boolean needToSplit
          The flag for whether the production needs to be split.
 
Constructor Summary
Annotator.Detector()
          Create a new detector.
 
Method Summary
 void visit(FullProduction p)
          Visit the specified production.
 void visit(Module m)
          Visit the specified module.
 void visit(OrderedChoice c)
          Visit the specified choice.
 void visit(Sequence s)
          Visit the specified sequence.
 
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
 

Field Detail

needToSplit

protected boolean needToSplit
The flag for whether the production needs to be split.


elements

protected java.util.List<Element> elements
The list of elements.

Constructor Detail

Annotator.Detector

public Annotator.Detector()
Create a new detector.

Method Detail

visit

public void visit(Module m)
Visit the specified module.


visit

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


visit

public void visit(OrderedChoice c)
Visit the specified choice.


visit

public void visit(Sequence s)
Visit the specified sequence.



Copyright © 2012. All Rights Reserved.