|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.expr.ExpressionParser
public class ExpressionParser
Parser for XPath expressions and XSLT patterns. This code was originally inspired by James Clark's xt but has been totally rewritten (several times)
Nested Class Summary | |
---|---|
static class |
ExpressionParser.ForClause
|
Constructor Summary | |
---|---|
ExpressionParser()
|
Method Summary | |
---|---|
Stack |
getRangeVariableStack()
Get the range variable stack. |
Tokenizer |
getTokenizer()
Get the tokenizer (the lexical analyzer) |
boolean |
isCompileWithTracing()
Determine whether trace hooks are included in the compiled code. |
LocalNameTest |
makeLocalNameTest(short nodeType,
String localName)
Make a LocalNameTest (*:name) |
int |
makeNameCode(String qname,
boolean useDefault)
Make a NameCode, using this Element as the context for namespace resolution |
NamespaceTest |
makeNamespaceTest(short nodeType,
String prefix)
Make a NamespaceTest (name:*) |
NameTest |
makeNameTest(short nodeType,
String qname,
boolean useDefault)
Make a NameTest, using the static context for namespace resolution |
Expression |
parse(String expression,
int start,
int terminator,
int lineNumber,
StaticContext env)
Parse a string representing an expression |
Pattern |
parsePattern(String pattern,
StaticContext env)
Parse a string representing an XSLT pattern |
SequenceType |
parseSequenceType(String input,
StaticContext env)
Parse a string representing a sequence type |
void |
setCompileWithTracing(boolean trueOrFalse)
Set whether trace hooks are to be included in the compiled code. |
void |
setRangeVariableStack(Stack stack)
Set the range variable stack. |
void |
setScanOnly(boolean scanOnly)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExpressionParser()
Method Detail |
---|
public void setCompileWithTracing(boolean trueOrFalse)
trueOrFalse
- true if trace code is to be compiled in, false otherwisepublic boolean isCompileWithTracing()
public Tokenizer getTokenizer()
public Expression parse(String expression, int start, int terminator, int lineNumber, StaticContext env) throws StaticError
expression
- the expression expressed as a Stringstart
- offset within the string where parsing is to startterminator
- character to treat as terminating the expressionlineNumber
- location of the start of the expression, for diagnosticsenv
- the static context for the expression
StaticError
- if the expression contains a syntax errorpublic Pattern parsePattern(String pattern, StaticContext env) throws StaticError
pattern
- the pattern expressed as a Stringenv
- the static context for the pattern
StaticError
- if the pattern contains a syntax errorpublic SequenceType parseSequenceType(String input, StaticContext env) throws StaticError
input
- the string, which should conform to the XPath SequenceType
productionenv
- the static context
StaticError
- if any error is encounteredpublic Stack getRangeVariableStack()
public void setRangeVariableStack(Stack stack)
public final int makeNameCode(String qname, boolean useDefault) throws StaticError
qname
- The name as written, in the form "[prefix:]localname"useDefault
- Defines the action when there is no prefix. If
true, use the default namespace URI for element names. If false,
use no namespace URI (as for attribute names).
StaticError
- if the name is invalid, or the prefix
undeclaredpublic NameTest makeNameTest(short nodeType, String qname, boolean useDefault) throws StaticError
nodeType
- the type of node required (identified by a constant in
class Type)qname
- the lexical QName of the required nodeuseDefault
- true if the default namespace should be used when
the QName is unprefixed
StaticError
- if the QName is invalidpublic NamespaceTest makeNamespaceTest(short nodeType, String prefix) throws StaticError
nodeType
- integer code identifying the type of node requiredprefix
- the namespace prefix
StaticError
- if the namespace prefix is not declaredpublic LocalNameTest makeLocalNameTest(short nodeType, String localName) throws StaticError
nodeType
- the kind of node to be matchedlocalName
- the requred local name
StaticError
- if the local name is invalidpublic void setScanOnly(boolean scanOnly)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |