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.
-
Field Details
-
NOMINAL_NAME
-
NOMINAL_NUMBER
-
NOMINAL_STRING
-
-
Constructor Details
-
QuickXPathParser
public QuickXPathParser()
-
-
Method Details
-
parse
public Expression parse(Tokenizer t, StaticContext env, String expression, int start, Predicate<Tokenizer> finished) Attempt to parse an expression, provided it is very simple.- Specified by:
parsein interfaceXPathParser.Accelerator- Parameters:
t- the tokenizerenv- the static contextexpression- the string containing expression to be parsedstart- start position within the input stringfinished- 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.
-