public class OPParser extends Object
OPToken| Constructor and Description |
|---|
OPParser(OPScanner scanner)
Construct a new OPParser initialized to gthe given Scanner
|
OPParser(Reader reader,
TokenTable table,
Set<CharSequence> setOperators)
Construct a new OPParser that parses the given Reader in the
language defined by the given TokenTable.
|
OPParser(String sExper,
TokenTable table,
Set<CharSequence> setOperators)
Construct a new OPParser that parses the given expression in the
language defined by the given TokenTable.
|
| Modifier and Type | Method and Description |
|---|---|
Term |
expression(int nRightBindingPower)
Parse the next expression into an Abstract Syntax Tree using the
given right binding power.
|
OPScanner |
getScanner()
Obtain the OPScanner that backs this parser
|
Term[] |
nodeList()
Parse a comma separated sequence of expressions to the of the tokens.
|
Term[] |
nodeList(String sEndMarker)
Parse a comma separated sequence of expressions upto the given end
marker.
|
Term[] |
nodeList(String sEndMarker,
boolean fEndStreamAllowed)
Parse a comma separated sequence of expressions upto the given end
marker.
|
<T extends Term> |
parse()
Parse the next expression into an Abstract Syntax Tree.
|
Term[] |
readNestedCommaSeparatedList(NestedBaseTokens nest)
Build an array of ASTNodes by processing the this tokens nest as
a comma separated list.
|
public OPParser(String sExper, TokenTable table, Set<CharSequence> setOperators)
sExper - string expression to parsetable - the TokenTable that defines the language to parsesetOperators - the operators this parser will usepublic OPParser(Reader reader, TokenTable table, Set<CharSequence> setOperators)
reader - Reader with the chars to parsetable - the TokenTable that defines the language to parsesetOperators - the operators this parser will usepublic OPParser(OPScanner scanner)
scanner - OPScanner that is already initializedpublic OPScanner getScanner()
public <T extends Term> T parse()
T - the term typepublic Term expression(int nRightBindingPower)
nRightBindingPower - defines how strong token must bind to the
left before halting parsingpublic Term[] nodeList(String sEndMarker)
sEndMarker - defines the symbol that ends the sequencepublic Term[] nodeList(String sEndMarker, boolean fEndStreamAllowed)
sEndMarker - defines the symbol that ends the sequencefEndStreamAllowed - flag to overide testing for sEndMarker if
at the end of streampublic Term[] nodeList()
public Term[] readNestedCommaSeparatedList(NestedBaseTokens nest)
nest - the nest of BaseTokens to process