Parser
v2.1

Parser
Class ProductionProcessor

java.lang.Object
  |
  +--Parser.REProcessor
        |
        +--Parser.SubProductionProcessor
              |
              +--Parser.ProductionProcessor

public class ProductionProcessor
extends SubProductionProcessor

The ProductionProcessor class processes entire production rules from a grammar.


Fields inherited from class Parser.SubProductionProcessor
subproduction, type
 
Fields inherited from class Parser.REProcessor
ANDNOT, FOLLOW, MAYBE, OR, PLUS, STAR
 
Constructor Summary
ProductionProcessor(boolean casesensitive, ProductionProcessor[] production, java.lang.String type, java.lang.Object[] parameters)
          Constructs a new ProductionProcessor with the specified production list, type, and list of parameters.
ProductionProcessor(java.lang.reflect.Method codeGen, boolean casesensitive, ProductionProcessor[] production, java.lang.String type, java.lang.Object[] parameters)
          Constructs a new ProductionProcessor with the specified production list, type, and list of parameters.
ProductionProcessor(ProductionProcessor[] production, java.lang.String type, java.lang.Object[] parameters)
          Constructs a new ProductionProcessor with the specified production list, type, and list of parameters.
 
Method Summary
 RETree beginningMatches(java.lang.String input)
          Returns a tree if the beginning of the specified string is matched, otherwise returns null.
 void initializeProcessors()
          Initializes usable subproduction processor array by grouping production processors and subproduction processors.
 
Methods inherited from class Parser.SubProductionProcessor
evaluate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProductionProcessor

public ProductionProcessor(ProductionProcessor[] production,
                           java.lang.String type,
                           java.lang.Object[] parameters)
                    throws java.lang.Exception
Constructs a new ProductionProcessor with the specified production list, type, and list of parameters.
Parameters:
production - the list of all production rules.
type - the type description.
parameters - production description, elements can be Integer or String types where Integer denotes a reference to another production and String represents a regular expression.

ProductionProcessor

public ProductionProcessor(boolean casesensitive,
                           ProductionProcessor[] production,
                           java.lang.String type,
                           java.lang.Object[] parameters)
                    throws java.lang.Exception
Constructs a new ProductionProcessor with the specified production list, type, and list of parameters.
Parameters:
casesensitive - case sensitivity of parser.
production - the list of all production rules.
type - the type description.
parameters - production description, elements can be Integer or String types where Integer denotes a reference to another production and String represents a regular expression.

ProductionProcessor

public ProductionProcessor(java.lang.reflect.Method codeGen,
                           boolean casesensitive,
                           ProductionProcessor[] production,
                           java.lang.String type,
                           java.lang.Object[] parameters)
                    throws java.lang.Exception
Constructs a new ProductionProcessor with the specified production list, type, and list of parameters.
Parameters:
codeGen - a function used for automatic code generation.
casesensitive - case sensitivity of parser.
production - the list of all production rules.
type - the type description.
parameters - production description, elements can be Integer or String types where Integer denotes a reference to another production and String represents a regular expression.
Method Detail

initializeProcessors

public void initializeProcessors()
Initializes usable subproduction processor array by grouping production processors and subproduction processors. This function must be called exactly once for each production immediately after all productions are defined (this provides dynamic referencing).

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 SubProductionProcessor
Parameters:
input - the string to be tested and parsed.
Returns:
a tree (match) or null (no match).

Parser
v2.1