Package com.saxonica.ee.optim
Class QuickXPathParser
- java.lang.Object
-
- com.saxonica.ee.optim.QuickXPathParser
-
- All Implemented Interfaces:
XPathParser.Accelerator
public class QuickXPathParser extends java.lang.Object implements 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 Constructor Description QuickXPathParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expression
parse(Tokenizer t, StaticContext env, java.lang.String expression, int start, int terminator)
Attempt to parse an expression, provided it is very simple.
-
-
-
Method Detail
-
parse
public Expression parse(Tokenizer t, StaticContext env, java.lang.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 tokenizerexpression
- the string containing expression to be parsedstart
- start position within the input stringterminator
- either EOF or RCURLY, indicating how parsing should endenv
- the static context- Returns:
- either the parsed expression, or null if it is erroneous or too complex to parse.
-
-