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

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

public static class Grammar.Production
extends java.lang.Object

Represents a production of the grammar. A production gives a way of making a large syntactic thing out of smaller things. Every Production is identified by a 'name'.


Field Summary
 java.lang.String name
          The name of this Production.
 int numParts
          The number of parts.
 
Constructor Summary
Grammar.Production(java.lang.String name, Grammar[] parts)
          Constructs a Production.
 
Method Summary
 Grammar get(int index)
          Returns the part with index 'index'.
 java.lang.String toString()
          Returns a String representation of this Production.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public final java.lang.String name
The name of this Production. Conventionally, this takes the form of an SSS constant, because it refers to something defined in a grammar specification.


numParts

public final int numParts
The number of parts.

Constructor Detail

Grammar.Production

public Grammar.Production(java.lang.String name,
                          Grammar[] parts)
Constructs a Production.

Parameters:
name - the name of this Production.
parts - an array of Grammars describing the things that are needed in order to use this Production.
Throws:
java.lang.IllegalArgumentException - if all of the parts are optional NonTerminals, because SSS forbids a production from matching the empty string. In particular, there must be at least one part.
Method Detail

get

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


toString

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

Overrides:
toString in class java.lang.Object