Package com.saxonica.ee.optim
Class QuickXPathParser
java.lang.Object
com.saxonica.ee.optim.QuickXPathParser
- All Implemented Interfaces:
XPathParser.Accelerator
This class performs a quick parse of commonly encountered XPath expressions that conform
to common syntactic patterns. Instead of using the full recursive-descent parser, the
expression is tokenized, and the sequence of tokens is tested against a table of known
common sequences.
If the XPath expression supplied cannot be parsed (either because it is too complicated
or because it is invalid), the quick parser simply returns null and leaves the work to
the regular parser.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionparse
(Tokenizer t, StaticContext env, String expression, int start, int terminator) Attempt to parse an expression, provided it is very simple.
-
Constructor Details
-
QuickXPathParser
public QuickXPathParser()
-
-
Method Details
-
parse
public Expression parse(Tokenizer t, StaticContext env, String expression, int start, int terminator) Attempt to parse an expression, provided it is very simple.- Specified by:
parse
in interfaceXPathParser.Accelerator
- Parameters:
t
- the tokenizerenv
- the static contextexpression
- the string containing expression to be parsedstart
- start position within the input stringterminator
- either EOF or RCURLY, indicating how parsing should end- Returns:
- either the parsed expression, or null if it is erroneous or too complex to parse.
-