Fields Summary |
---|
protected static final short[] | _production_tableProduction table. |
protected static final short[] | _action_tableParse-action table. |
protected static final short[] | _reduce_tablereduce_goto table. |
protected CUP$XPathParser$actions | action_objInstance of action encapsulation class. |
public static final Vector | EmptyArgsUsed by function calls with no args. |
public static final VariableRef | DummyVarRefReference to non-existing variable. |
private Parser | _parserReference to the Parser class. |
private XSLTC | _xsltc |
private String | _expressionString representation of the expression being parsed. |
private int | _lineNumberLine number where this expression/pattern was declared. |
public SymbolTable | _symbolTableReference to the symbol table. |
Methods Summary |
---|
public int | EOF_sym()EOF Symbol index.return 0;
|
public short[][] | action_table()Access to parse-action table.
return _action_table;
|
public final void | addError(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg error)
_parser.reportError(Constants.ERROR, error);
|
public com.sun.org.apache.xalan.internal.xsltc.compiler.StepPattern | createStepPattern(int axis, java.lang.Object test, java.util.Vector predicates)This method is similar to findNodeType(int, Object) except that it
creates a StepPattern instead of just returning a node type. It also
differs in the way it handles "{uri}:*" and "{uri}:@*". The last two
patterns are expanded as "*[namespace-uri() = 'uri']" and
"@*[namespace-uri() = 'uri']", respectively. This expansion considerably
simplifies the grouping of patterns in the Mode class. For this
expansion to be correct, the priority of the pattern/template must be
set to -0.25 (when no other predicates are present).
int nodeType;
if (test == null) { // "*"
nodeType = (axis == Axis.ATTRIBUTE) ? NodeTest.ATTRIBUTE :
(axis == Axis.NAMESPACE) ? -1 : NodeTest.ELEMENT;
return new StepPattern(axis, nodeType, predicates);
}
else if (test instanceof Integer) {
nodeType = ((Integer) test).intValue();
return new StepPattern(axis, nodeType, predicates);
}
else {
QName name = (QName)test;
boolean setPriority = false;
if (axis == Axis.NAMESPACE) {
nodeType = (name.toString().equals("*")) ? -1
: _xsltc.registerNamespacePrefix(name);;
}
else {
final String uri = name.getNamespace();
final String local = name.getLocalPart();
final QName namespace_uri =
_parser.getQNameIgnoreDefaultNs("namespace-uri");
// Expand {uri}:* to *[namespace-uri() = 'uri'] - same for @*
if (uri != null && (local.equals("*") || local.equals("@*"))) {
if (predicates == null) {
predicates = new Vector(2);
}
// Priority is set by hand if no other predicates exist
setPriority = (predicates.size() == 0);
predicates.add(
new Predicate(
new EqualityExpr(Operators.EQ,
new NamespaceUriCall(namespace_uri),
new LiteralExpr(uri))));
}
if (local.equals("*")) {
nodeType = (axis == Axis.ATTRIBUTE) ? NodeTest.ATTRIBUTE
: NodeTest.ELEMENT;
}
else if (local.equals("@*")) {
nodeType = NodeTest.ATTRIBUTE;
}
else {
nodeType = (axis == Axis.ATTRIBUTE) ? _xsltc.registerAttribute(name)
: _xsltc.registerElement(name);
}
}
final StepPattern result = new StepPattern(axis, nodeType, predicates);
// Set priority for case prefix:* and prefix:@* (no predicates)
if (setPriority) {
result.setPriority(-0.25);
}
return result;
}
|
public com.sun.java_cup.internal.runtime.Symbol | do_action(int act_num, com.sun.java_cup.internal.runtime.lr_parser parser, java.util.Stack stack, int top)Invoke a user supplied parse action.
/* call code in generated class */
return action_obj.CUP$XPathParser$do_action(act_num, parser, stack, top);
|
public int | error_sym()error Symbol index.return 1;
|
public int | findNodeType(int axis, java.lang.Object test)
if (test == null) { // *
return (axis == Axis.ATTRIBUTE) ?
NodeTest.ATTRIBUTE :
(axis == Axis.NAMESPACE) ? -1 : NodeTest.ELEMENT;
}
else if (test instanceof Integer) {
return ((Integer)test).intValue();
}
else {
QName name = (QName)test;
if (axis == Axis.NAMESPACE) {
return (name.toString().equals("*")) ? -1
: _xsltc.registerNamespacePrefix(name);
}
if (name.getNamespace() == null) {
final String local = name.getLocalPart();
if (local.equals("*")) {
return (axis == Axis.ATTRIBUTE) ? NodeTest.ATTRIBUTE
: NodeTest.ELEMENT;
}
else if (local.equals("@*")) {
return NodeTest.ATTRIBUTE;
}
}
return (axis == Axis.ATTRIBUTE) ? _xsltc.registerAttribute(name)
: _xsltc.registerElement(name);
}
|
public int | getLineNumber()
return _lineNumber;
|
public com.sun.org.apache.xalan.internal.xsltc.compiler.QName | getQName(java.lang.String namespace, java.lang.String prefix, java.lang.String localname)
return _parser.getQName(namespace, prefix, localname);
|
public com.sun.org.apache.xalan.internal.xsltc.compiler.QName | getQNameIgnoreDefaultNs(java.lang.String name)
return _parser.getQNameIgnoreDefaultNs(name);
|
protected void | init_actions()Action encapsulation object initializer.
action_obj = new CUP$XPathParser$actions(this);
|
public com.sun.org.apache.xalan.internal.xsltc.compiler.RelativeLocationPath | insertStep(com.sun.org.apache.xalan.internal.xsltc.compiler.Step step, com.sun.org.apache.xalan.internal.xsltc.compiler.RelativeLocationPath rlp)
if (rlp instanceof Step) {
return new ParentLocationPath(step, (Step) rlp);
}
else if (rlp instanceof ParentLocationPath) {
final ParentLocationPath plp = (ParentLocationPath) rlp;
final RelativeLocationPath newrlp = insertStep(step, plp.getPath());
return new ParentLocationPath(newrlp, plp.getStep());
}
else {
addError(new ErrorMsg(ErrorMsg.INTERNAL_ERR, "XPathParser.insertStep"));
return rlp;
}
|
public boolean | isElementAxis(int axis)Returns true if the axis applies to elements only. The axes
child, attribute, namespace, descendant result in non-empty
nodesets only if the context node is of type element.
return (axis == Axis.CHILD || axis == Axis.ATTRIBUTE ||
axis == Axis.NAMESPACE || axis == Axis.DESCENDANT);
|
final com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode | lookupName(com.sun.org.apache.xalan.internal.xsltc.compiler.QName name)Lookup a variable or parameter in the symbol table given its name.
// Is it a local var or param ?
final SyntaxTreeNode result = _parser.lookupVariable(name);
if (result != null)
return(result);
else
return(_symbolTable.lookupName(name));
|
public com.sun.java_cup.internal.runtime.Symbol | parse(java.lang.String expression, int lineNumber)Parse the expression passed to the current scanner. If this
expression contains references to local variables and it will be
compiled in an external module (not in the main class) request
the current template to create a new variable stack frame.
try {
_expression = expression;
_lineNumber = lineNumber;
return super.parse();
}
catch (IllegalCharException e) {
ErrorMsg err = new ErrorMsg(ErrorMsg.ILLEGAL_CHAR_ERR,
lineNumber, e.getMessage());
_parser.reportError(Constants.FATAL, err);
}
return null;
|
public short[][] | production_table()Access to production table.
return _production_table;
|
public short[][] | reduce_table()Access to reduce_goto table.
return _reduce_table;
|
public void | report_error(java.lang.String message, java.lang.Object info)
final ErrorMsg err = new ErrorMsg(ErrorMsg.SYNTAX_ERR, _lineNumber,
_expression);
_parser.reportError(Constants.FATAL, err);
|
public void | report_fatal_error(java.lang.String message, java.lang.Object info)
// empty
|
public void | setCallsNodeset(boolean flag)
_xsltc.setCallsNodeset(flag);
|
public void | setHasIdCall(boolean flag)
_xsltc.setHasIdCall(flag);
|
public void | setMultiDocument(boolean flag)
_xsltc.setMultiDocument(flag);
|
public int | start_production()Indicates start production.return 0;
|
public int | start_state()Indicates start state.return 0;
|