Parser
v2.1

Parser
Class SubProductionProcessor

java.lang.Object
  |
  +--Parser.REProcessor
        |
        +--Parser.SubProductionProcessor
Direct Known Subclasses:
ProductionProcessor

public class SubProductionProcessor
extends REProcessor

The SubProductionProcessor class handles REProcessors as well as references to productions and subproductions. A subproduction is a part of a production. For instance, in the production Example ::= One (Two | Three)*, the One portion and the Two | Three portion would be separate subproductions. Effectively, the rule would be replaced with Example ::= A B*, where A ::= One and B ::= Two | Three.


Field Summary
protected  SubProductionProcessor[] subproduction
          A set of subproductions associated with a production (this includes a list of all other available productions).
protected  java.lang.String type
          A description of the production or subproduction (i.e.
 
Fields inherited from class Parser.REProcessor
ANDNOT, FOLLOW, MAYBE, OR, PLUS, STAR
 
Constructor Summary
SubProductionProcessor()
          Empty constructor.
SubProductionProcessor(SubProductionProcessor[] subproduction, java.lang.Object A, java.lang.Object B, byte mode, java.lang.String type)
          Constructs a new SubProductionProcessor with a specified set of SubProductionProcessors, specified objects to be matched, a mode of operation, and a type specification.
 
Method Summary
 RETree beginningMatches(java.lang.String input)
          Returns a tree if the beginning of the specified string is matched, otherwise returns null.
 RETree evaluate(java.lang.Object automaton, java.lang.String input)
          Returns the result of beginningMatches for the appropriate type (RE, REProcessor, or Integer).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected java.lang.String type
A description of the production or subproduction (i.e. the rule name).

subproduction

protected SubProductionProcessor[] subproduction
A set of subproductions associated with a production (this includes a list of all other available productions).
Constructor Detail

SubProductionProcessor

public SubProductionProcessor()
Empty constructor.

SubProductionProcessor

public SubProductionProcessor(SubProductionProcessor[] subproduction,
                              java.lang.Object A,
                              java.lang.Object B,
                              byte mode,
                              java.lang.String type)
Constructs a new SubProductionProcessor with a specified set of SubProductionProcessors, specified objects to be matched, a mode of operation, and a type specification.
Parameters:
subproduction - the set of SubProductionProcessors.
A - the left hand side of the operation.
B - the right hand side of the operation.
mode - the mode of operation.
type - a description of the production or subproduction.
Method Detail

beginningMatches

public RETree beginningMatches(java.lang.String input)
                        throws java.lang.Exception
Returns a tree if the beginning of the specified string is matched, otherwise returns null.
Overrides:
beginningMatches in class REProcessor
Parameters:
input - the string to be tested and parsed.
Returns:
a tree (match) or null (no match).

evaluate

public RETree evaluate(java.lang.Object automaton,
                       java.lang.String input)
                throws java.lang.Exception
Returns the result of beginningMatches for the appropriate type (RE, REProcessor, or Integer).
Overrides:
evaluate in class REProcessor
Parameters:
automaton - the RE or REProcessor to call beginningMatches on. If automaton is an Integer than beginningMatches is called on the REProcessor associated with the value.
input - the string to be tested and parsed.
Returns:
the result of beginningMatches being called on the specified object.

Parser
v2.1