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

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

public static class Grammar.NonTerminal
extends Grammar

The subclass of Grammar with 'isTerminal==false'. This class represents quantified non-terminals. By quantified I mean that it can be optional and/or repeatable (as represented in SSS grammar specifications by the symbols '?', '*' and '+'). This class is called 'NonTerminal' only as an abbreviation for 'QuantifiedNonTerminal'.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.sc3d.apt.sss.v3.Grammar
Grammar.Keyword, Grammar.NonTerminal, Grammar.Production, Grammar.Terminal
 
Field Summary
 boolean isOptional
          One of the flags passed to the constructor.
 boolean isRepeatable
          One of the flags passed to the constructor.
 int numProds
          The number of Productions.
 
Fields inherited from class org.sc3d.apt.sss.v3.Grammar
isTerminal
 
Constructor Summary
Grammar.NonTerminal(Grammar.NonTerminal that, boolean isOptional, boolean isRepeatable)
          Constructs a NonTerminal with the same productions as 'that' but different flags.
Grammar.NonTerminal(Grammar.Production[] prods, boolean isOptional, boolean isRepeatable)
          Constructs a NonTerminal.
 
Method Summary
 Grammar.Production get(int index)
          Returns the Production with index 'index'.
 java.lang.String toString()
          Returns a String representation of this NonTerminal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numProds

public final int numProds
The number of Productions.


isOptional

public final boolean isOptional
One of the flags passed to the constructor.


isRepeatable

public final boolean isRepeatable
One of the flags passed to the constructor.

Constructor Detail

Grammar.NonTerminal

public Grammar.NonTerminal(Grammar.Production[] prods,
                           boolean isOptional,
                           boolean isRepeatable)
Constructs a NonTerminal.

Parameters:
prods - an array of Productions that produce this NonTerminal, in order of preference. The array is not copied away, and must therefore not be modified hereafter.
isOptional - 'true' if zero copies of this non-terminal is acceptable, or 'false' to insist on at least one copy.
isRepeatable - 'true' if more than one copy of this non-terminal is acceptable, or 'false' to insist on at most one copy.

Grammar.NonTerminal

public Grammar.NonTerminal(Grammar.NonTerminal that,
                           boolean isOptional,
                           boolean isRepeatable)
Constructs a NonTerminal with the same productions as 'that' but different flags.

Method Detail

get

public Grammar.Production get(int index)
Returns the Production with index 'index'.


toString

public java.lang.String toString()
Returns a String representation of this NonTerminal.

Specified by:
toString in class Grammar