org.sc3d.apt.sss.v3
Class Tree.NonTerminal

java.lang.Object
  extended by org.sc3d.apt.sss.v3.Tree
      extended by org.sc3d.apt.sss.v3.Tree.NonTerminal
Enclosing class:
Tree

public static class Tree.NonTerminal
extends Tree

The subclass of Tree with 'isTerminal==false', which represents zero or more parse-trees all matching the same non-terminal of the grammar. In other words, this class represents a string that matches a Grammar.NonTerminal.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.sc3d.apt.sss.v3.Tree
Tree.NonTerminal, Tree.Production, Tree.Terminal
 
Field Summary
 int length
          The number of repeats that the parser found.
 
Fields inherited from class org.sc3d.apt.sss.v3.Tree
isTerminal
 
Constructor Summary
Tree.NonTerminal(Tree.Production[] repeats)
          Constructs a NonTerminal.
 
Method Summary
 Tree.Production get()
          Returns 'get(0)', or 'null' if 'length' is zero.
 Tree.Production get(int index)
          Returns the parse-tree of the repeat with index 'index'.
 
Methods inherited from class org.sc3d.apt.sss.v3.Tree
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

length

public final int length
The number of repeats that the parser found. If the Grammar.NonTerminal was marked as optional, this field may be zero, otherwise it must be non-zero. If the Grammar.NonTerminal was marked as repeatable, this field may be more than one, otherwise it must be at most one.

Constructor Detail

Tree.NonTerminal

public Tree.NonTerminal(Tree.Production[] repeats)
Constructs a NonTerminal.

Method Detail

get

public Tree.Production get(int index)
Returns the parse-tree of the repeat with index 'index'.


get

public Tree.Production get()
Returns 'get(0)', or 'null' if 'length' is zero.

Throws:
java.lang.IllegalArgumentException - if 'length' is greater than one.