public class Compiler extends OpMap
m_currentPattern, MAPINDEX_LENGTH
Constructor and Description |
---|
Compiler()
Construct a Compiler instance that has a null error listener and a
null source locator.
|
Compiler(ErrorListener errorHandler,
SourceLocator locator,
FunctionTable fTable)
Construct a Compiler object with a specific ErrorListener and
SourceLocator where the expression is located.
|
Modifier and Type | Method and Description |
---|---|
protected Expression |
and(int opPos)
Compile an 'and' operation.
|
protected Expression |
arg(int opPos)
Compile a function argument.
|
void |
assertion(boolean b,
String msg)
Tell the user of an assertion error, and probably throw an
exception.
|
protected Expression |
bool(int opPos)
Compile a 'boolean(...)' operation.
|
Expression |
compile(int opPos)
Execute the XPath object from a given opcode position.
|
int |
countPredicates(int opPos)
Count the number of predicates in the step.
|
protected Expression |
div(int opPos)
Compile a 'div' operation.
|
protected Expression |
equals(int opPos)
Compile a '=' operation.
|
void |
error(String msg,
Object[] args)
Tell the user of an error, and probably throw an
exception.
|
Expression[] |
getCompiledPredicates(int opPos)
Compile a zero or more predicates for a given match pattern.
|
int |
getLocationPathDepth()
Get the level of the location path or union being constructed.
|
PrefixResolver |
getNamespaceContext()
Get the current namespace context for the xpath.
|
int |
getWhatToShow(int opPos)
Get a
NodeFilter bit set that tells what
to show for a given node test. |
protected Expression |
group(int opPos)
Compile an expression group.
|
protected Expression |
gt(int opPos)
Compile a '>' operation.
|
protected Expression |
gte(int opPos)
Compile a '>=' operation.
|
protected Expression |
literal(int opPos)
Compile a literal string value.
|
Expression |
locationPath(int opPos)
Compile a location path.
|
Expression |
locationPathPattern(int opPos)
Compile a location match pattern unit expression.
|
protected Expression |
lt(int opPos)
Compile a '<' operation.
|
protected Expression |
lte(int opPos)
Compile a '<=' operation.
|
protected Expression |
matchPattern(int opPos)
Compile an entire match pattern expression.
|
protected Expression |
minus(int opPos)
Compile a '-' operation.
|
protected Expression |
mod(int opPos)
Compile a 'mod' operation.
|
protected Expression |
mult(int opPos)
Compile a '*' operation.
|
protected Expression |
neg(int opPos)
Compile a unary '-' operation.
|
protected Expression |
notequals(int opPos)
Compile a '!=' operation.
|
protected Expression |
number(int opPos)
Compile a 'number(...)' operation.
|
protected Expression |
numberlit(int opPos)
Compile a literal number value.
|
protected Expression |
or(int opPos)
Compile an 'or' operation.
|
protected Expression |
plus(int opPos)
Compile a '+' operation.
|
Expression |
predicate(int opPos)
Compile a location step predicate expression.
|
void |
setNamespaceContext(PrefixResolver pr)
Set the current namespace context for the xpath.
|
protected StepPattern |
stepPattern(int opPos,
int stepCount,
StepPattern ancestorPattern)
Compile a step pattern unit expression, used for both location paths
and match patterns.
|
protected Expression |
string(int opPos)
Compile a 'string(...)' operation.
|
protected Expression |
union(int opPos)
Compile a location path union.
|
protected Expression |
variable(int opPos)
Compile a variable reference.
|
void |
warn(String msg,
Object[] args)
Warn the user of an problem.
|
getArgLength, getArgLengthOfStep, getFirstChildPos, getFirstChildPosOfStep, getFirstPredicateOpPos, getNextOpPos, getNextOpPos, getNextStepPos, getOp, getOpMap, getPatternString, getStepLocalName, getStepNS, getStepTestType, getToken, getTokenQueue, getTokenQueueSize, setOp, toString
public Compiler(ErrorListener errorHandler, SourceLocator locator, FunctionTable fTable)
errorHandler
- Error listener where messages will be sent, or null
if messages should be sent to System err.locator
- The location object where the expression lives, which
may be null, but which, if not null, must be valid over
the long haul, in other words, it will not be cloned.fTable
- The FunctionTable object where the xpath build-in
functions are stored.public Compiler()
public Expression compile(int opPos) throws TransformerException
opPos
- The current position in the xpath.m_opMap array.TransformerException
- if there is a syntax or other error.protected Expression or(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Or
instance.TransformerException
- if a error occurs creating the Expression.protected Expression and(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.And
instance.TransformerException
- if a error occurs creating the Expression.protected Expression notequals(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.NotEquals
instance.TransformerException
- if a error occurs creating the Expression.protected Expression equals(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Equals
instance.TransformerException
- if a error occurs creating the Expression.protected Expression lte(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Lte
instance.TransformerException
- if a error occurs creating the Expression.protected Expression lt(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Lt
instance.TransformerException
- if a error occurs creating the Expression.protected Expression gte(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Gte
instance.TransformerException
- if a error occurs creating the Expression.protected Expression gt(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Gt
instance.TransformerException
- if a error occurs creating the Expression.protected Expression plus(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Plus
instance.TransformerException
- if a error occurs creating the Expression.protected Expression minus(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Minus
instance.TransformerException
- if a error occurs creating the Expression.protected Expression mult(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Mult
instance.TransformerException
- if a error occurs creating the Expression.protected Expression div(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Div
instance.TransformerException
- if a error occurs creating the Expression.protected Expression mod(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Mod
instance.TransformerException
- if a error occurs creating the Expression.protected Expression neg(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Neg
instance.TransformerException
- if a error occurs creating the Expression.protected Expression string(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.String
instance.TransformerException
- if a error occurs creating the Expression.protected Expression bool(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Bool
instance.TransformerException
- if a error occurs creating the Expression.protected Expression number(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Number
instance.TransformerException
- if a error occurs creating the Expression.protected Expression literal(int opPos)
opPos
- The current position in the m_opMap array.XString
instance.TransformerException
- if a error occurs creating the Expression.protected Expression numberlit(int opPos)
opPos
- The current position in the m_opMap array.XNumber
instance.TransformerException
- if a error occurs creating the Expression.protected Expression variable(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.Variable
instance.TransformerException
- if a error occurs creating the Expression.protected Expression group(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.TransformerException
- if a error occurs creating the Expression.protected Expression arg(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.TransformerException
- if a error occurs creating the Expression.protected Expression union(int opPos) throws TransformerException
LocPathIterator
children.opPos
- The current position in the m_opMap array.LocPathIterator
instance.TransformerException
- if a error occurs creating the Expression.public int getLocationPathDepth()
public Expression locationPath(int opPos) throws TransformerException
AxesWalker
children.opPos
- The current position in the m_opMap array.LocPathIterator
instance.TransformerException
- if a error occurs creating the Expression.public Expression predicate(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.TransformerException
- if a error occurs creating the Expression.protected Expression matchPattern(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.UnionPattern
instance.TransformerException
- if a error occurs creating the Expression.public Expression locationPathPattern(int opPos) throws TransformerException
opPos
- The current position in the m_opMap array.StepPattern
instance.TransformerException
- if a error occurs creating the Expression.public int getWhatToShow(int opPos)
NodeFilter
bit set that tells what
to show for a given node test.opPos
- the op map position for the location step.NodeFilter
bit set that tells what
to show for a given node test.protected StepPattern stepPattern(int opPos, int stepCount, StepPattern ancestorPattern) throws TransformerException
opPos
- The current position in the m_opMap array.stepCount
- The number of steps to expect.ancestorPattern
- The owning StepPattern, which may be null.StepPattern
instance.TransformerException
- if a error occurs creating the Expression.public Expression[] getCompiledPredicates(int opPos) throws TransformerException
opPos
- The position of the first predicate the m_opMap array.Expression
instances.TransformerException
- if a error occurs creating the Expression.public int countPredicates(int opPos) throws TransformerException
opPos
- The position of the first predicate the m_opMap array.TransformerException
- if a error occurs creating the Expression.public void warn(String msg, Object[] args) throws TransformerException
msg
- An error msgkey that corresponds to one of the constants found
in XPATHErrorResources
, which is
a key for a format string.args
- An array of arguments represented in the format string, which
may be null.TransformerException
- if the current ErrorListoner determines to
throw an exception.public void assertion(boolean b, String msg)
b
- If false, a runtime exception will be thrown.msg
- The assertion message, which should be informative.RuntimeException
- if the b argument is false.public void error(String msg, Object[] args) throws TransformerException
error
in class OpMap
msg
- An error msgkey that corresponds to one of the constants found
in XPATHErrorResources
, which is
a key for a format string.args
- An array of arguments represented in the format string, which
may be null.TransformerException
- if the current ErrorListoner determines to
throw an exception.public PrefixResolver getNamespaceContext()
public void setNamespaceContext(PrefixResolver pr)
pr
- The resolver for prefixes in the XPath expression.Copyright © 2018 JBoss by Red Hat. All rights reserved.