public class LRParser extends java.lang.Object implements GrammaticalParser
Modifier and Type | Class and Description |
---|---|
class |
LRParser.ParseSet |
Constructor and Description |
---|
LRParser(Grammar grammarIn,
int maxFormulaLengthIn)
Construct using reference to Grammar and a parameter signifying the
maximum length of a formula in the database.
|
Modifier and Type | Method and Description |
---|---|
void |
addSettings(SessionStore store)
(Optionally) add some settings to the global storage to improve load
times.
|
void |
load(boolean fromFile) |
int |
parseExpr(ParseTree[] parseTreeArrayIn,
Cnst formulaTypIn,
ParseNodeHolder[] parseNodeHolderExprIn,
int highestSeqIn)
LRParser - returns 'n' = the number of ParseTree objects generated for
the input formula and stored in parseTreeArray.
|
public LRParser(Grammar grammarIn, int maxFormulaLengthIn)
grammarIn
- Grammar objectmaxFormulaLengthIn
- gives us a hint about what to expect.public void addSettings(SessionStore store)
GrammaticalParser
addSettings
in interface GrammaticalParser
store
- The setting storagepublic void load(boolean fromFile)
public int parseExpr(ParseTree[] parseTreeArrayIn, Cnst formulaTypIn, ParseNodeHolder[] parseNodeHolderExprIn, int highestSeqIn) throws VerifyException
The user can control whether or not the first successful parse is returned by passing in an array of length = 1.
parseExpr
in interface GrammaticalParser
parseTreeArrayIn
- -- holds generated ParseTrees, therefore, length
must be greater than 0. The user can control whether or not
the first successful parse is returned by passing in an array
of length = 1. If the array length is greater than 1 the
function attempts to fill the array with alternate parses
(which if found, would indicate grammatical ambiguity.)
Returned ParseTree objects are stored in array order -- 0, 1,
2, ... -- and the contents of unused array entries is
unspecified. If more than one ParseTree is returned, the
returned ParseTrees are guaranteed to be different (no
duplicate ParseTrees are returned!)formulaTypIn
- -- Cnst Type Code of the Formula to be parsed. Note
that first symbol is the formula's Type Code. The Type Code is
used only when parsing a null expression (length zero), in
which case a Nulls Permitted Rule is sought.parseNodeHolderExprIn
- - Formula's Expression, preloaded into a
ParseNodeHolder[] (see
Formula.getParseNodeHolderExpr(mandVarHypArray).highestSeqIn
- -- restricts the parse to statements with a sequence
number less than or equal to highestSeq. Set this to
Integer.MAX_VALUE to enable grammatical parsing using all
available rules.VerifyException
- if an error occurred