1 // created by jay 0.7 (c) 1998 Axel.Schreiner@informatik.uni-osnabrueck.de
6 // Author - Piers Haken <piersh@friskit.com>
9 // TODO: FUNCTION_CALL should be a QName, not just a NCName
10 // TODO: PROCESSING_INSTRUCTION's optional parameter
11 // TODO: flatten argument/predicate lists in place
14 using System.Xml.XPath;
16 namespace Mono.Xml.XPath
18 public class XPathParser
20 internal object yyparseDebug (Tokenizer tok)
22 return yyparse (tok, new yydebug.yyDebugSimple ());
27 /** simplified error message.
28 @see <a href="#yyerror(java.lang.String, java.lang.String[])">yyerror</a>
30 public void yyerror (string message) {
31 yyerror(message, null);
34 /** (syntax) error message.
35 Can be overwritten to control message format.
36 @param message text to be displayed.
37 @param expected vector of acceptable tokens, if available.
39 public void yyerror (string message, string[] expected) {
40 if ((expected != null) && (expected.Length > 0)) {
41 System.Console.Write (message+", expecting");
42 for (int n = 0; n < expected.Length; ++ n)
43 System.Console.Write (" "+expected[n]);
44 System.Console.WriteLine ();
46 System.Console.WriteLine (message);
49 /** debugging support, requires the package jay.yydebug.
50 Set to null to suppress debugging messages.
52 protected yydebug.yyDebug debug;
54 protected static int yyFinal = 25;
55 public static string [] yyRule = {
59 "OrExpr : OrExpr OR AndExpr",
60 "AndExpr : EqualityExpr",
61 "AndExpr : AndExpr AND EqualityExpr",
62 "EqualityExpr : RelationalExpr",
63 "EqualityExpr : EqualityExpr EQ RelationalExpr",
64 "EqualityExpr : EqualityExpr NE RelationalExpr",
65 "RelationalExpr : AdditiveExpr",
66 "RelationalExpr : RelationalExpr LT AdditiveExpr",
67 "RelationalExpr : RelationalExpr GT AdditiveExpr",
68 "RelationalExpr : RelationalExpr LE AdditiveExpr",
69 "RelationalExpr : RelationalExpr GE AdditiveExpr",
70 "AdditiveExpr : MultiplicativeExpr",
71 "AdditiveExpr : AdditiveExpr PLUS MultiplicativeExpr",
72 "AdditiveExpr : AdditiveExpr MINUS MultiplicativeExpr",
73 "MultiplicativeExpr : UnaryExpr",
74 "MultiplicativeExpr : MultiplicativeExpr ASTERISK UnaryExpr",
75 "MultiplicativeExpr : MultiplicativeExpr DIV UnaryExpr",
76 "MultiplicativeExpr : MultiplicativeExpr MOD UnaryExpr",
77 "UnaryExpr : UnionExpr",
78 "UnaryExpr : MINUS UnaryExpr",
79 "UnionExpr : PathExpr",
80 "UnionExpr : UnionExpr BAR PathExpr",
81 "PathExpr : RelativeLocationPath",
83 "PathExpr : SLASH RelativeLocationPath",
84 "PathExpr : SLASH2 RelativeLocationPath",
85 "PathExpr : FilterExpr",
86 "PathExpr : FilterExpr SLASH RelativeLocationPath",
87 "PathExpr : FilterExpr SLASH2 RelativeLocationPath",
88 "RelativeLocationPath : Step",
89 "RelativeLocationPath : RelativeLocationPath SLASH Step",
90 "RelativeLocationPath : RelativeLocationPath SLASH2 Step",
91 "Step : AxisSpecifier QName ZeroOrMorePredicates",
92 "Step : AxisSpecifier ASTERISK ZeroOrMorePredicates",
93 "Step : AxisSpecifier NodeType PAREN_OPEN OptionalLiteral PAREN_CLOSE ZeroOrMorePredicates",
98 "AxisSpecifier : AxisName COLON2",
101 "NodeType : PROCESSING_INSTRUCTION",
103 "FilterExpr : PrimaryExpr",
104 "FilterExpr : FilterExpr Predicate",
105 "PrimaryExpr : DOLLAR QName",
106 "PrimaryExpr : PAREN_OPEN Expr PAREN_CLOSE",
107 "PrimaryExpr : LITERAL",
108 "PrimaryExpr : NUMBER",
109 "PrimaryExpr : FunctionCall",
110 "FunctionCall : FUNCTION_NAME PAREN_OPEN OptionalArgumentList PAREN_CLOSE",
111 "OptionalArgumentList :",
112 "OptionalArgumentList : Expr OptionalArgumentListTail",
113 "OptionalArgumentListTail :",
114 "OptionalArgumentListTail : COMMA Expr OptionalArgumentListTail",
115 "ZeroOrMorePredicates :",
116 "ZeroOrMorePredicates : Predicate ZeroOrMorePredicates",
117 "Predicate : BRACKET_OPEN Expr BRACKET_CLOSE",
118 "AxisName : ANCESTOR",
119 "AxisName : ANCESTOR_OR_SELF",
120 "AxisName : ATTRIBUTE",
122 "AxisName : DESCENDANT",
123 "AxisName : DESCENDANT_OR_SELF",
124 "AxisName : FOLLOWING",
125 "AxisName : FOLLOWING_SIBLING",
126 "AxisName : NAMESPACE",
128 "AxisName : PRECEDING",
129 "AxisName : PRECEDING_SIBLING",
132 "OptionalLiteral : LITERAL",
134 "QName : NCName COLON ASTERISK",
135 "QName : NCName COLON NCName",
137 protected static string [] yyName = {
138 "end-of-file",null,null,null,null,null,null,null,null,null,null,null,
139 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
140 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
141 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
142 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
143 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
144 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
145 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
146 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
147 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
148 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
149 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
150 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
151 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
152 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
153 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
154 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
155 null,null,null,null,null,null,null,null,null,null,null,null,null,null,
156 null,null,null,null,null,null,null,"ERROR","EOF","SLASH","SLASH2",
157 "DOT","DOT2","COLON","COLON2","COMMA","AT","FUNCTION_NAME",
158 "BRACKET_OPEN","BRACKET_CLOSE","PAREN_OPEN","PAREN_CLOSE","AND","OR",
159 "DIV","MOD","PLUS","MINUS","ASTERISK","DOLLAR","BAR","EQ","NE","LE",
160 "GE","LT","GT","ANCESTOR","ANCESTOR_OR_SELF","ATTRIBUTE","CHILD",
161 "DESCENDANT","DESCENDANT_OR_SELF","FOLLOWING","FOLLOWING_SIBLING",
162 "NAMESPACE","PARENT","PRECEDING","PRECEDING_SIBLING","SELF","COMMENT",
163 "TEXT","PROCESSING_INSTRUCTION","NODE","NUMBER","LITERAL","NCName",
166 /** index-checked interface to yyName[].
167 @param token single character or %token value.
168 @return token name or [illegal] or [unknown].
170 public static string yyname (int token) {
171 if ((token < 0) || (token > yyName.Length)) return "[illegal]";
173 if ((name = yyName[token]) != null) return name;
177 /** computes list of expected tokens on error by tracing the tables.
178 @param state for which to compute the list.
179 @return list of token names.
181 protected string[] yyExpecting (int state) {
182 int token, n, len = 0;
183 bool[] ok = new bool[yyName.Length];
185 if ((n = yySindex[state]) != 0)
186 for (token = n < 0 ? -n : 0;
187 (token < yyName.Length) && (n+token < yyTable.Length); ++ token)
188 if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
192 if ((n = yyRindex[state]) != 0)
193 for (token = n < 0 ? -n : 0;
194 (token < yyName.Length) && (n+token < yyTable.Length); ++ token)
195 if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
200 string [] result = new string[len];
201 for (n = token = 0; n < len; ++ token)
202 if (ok[token]) result[n++] = yyName[token];
206 /** the generated parser, with debugging messages.
207 Maintains a state and a value stack, currently with fixed maximum size.
208 @param yyLex scanner.
209 @param yydebug debug message writer implementing yyDebug, or null.
210 @return result of the last reduction, if any.
211 @throws yyException on irrecoverable parse error.
213 public Object yyparse (yyParser.yyInput yyLex, Object yyd)
215 this.debug = (yydebug.yyDebug)yyd;
216 return yyparse(yyLex);
219 /** initial size and increment of the state/value stack [default 256].
220 This is not final so that it can be overwritten outside of invocations
225 /** executed at the beginning of a reduce action.
226 Used as $$ = yyDefault($1), prior to the user-specified action, if any.
227 Can be overwritten to provide deep copy, etc.
228 @param first value for $1, or null.
231 protected Object yyDefault (Object first) {
235 /** the generated parser.
236 Maintains a state and a value stack, currently with fixed maximum size.
237 @param yyLex scanner.
238 @return result of the last reduction, if any.
239 @throws yyException on irrecoverable parse error.
241 public Object yyparse (yyParser.yyInput yyLex)
243 if (yyMax <= 0) yyMax = 256; // initial size
244 int yyState = 0; // state stack ptr
245 int [] yyStates = new int[yyMax]; // state stack
246 Object yyVal = null; // value stack ptr
247 Object [] yyVals = new Object[yyMax]; // value stack
248 int yyToken = -1; // current input
249 int yyErrorFlag = 0; // #tks to shift
257 if (yyTop >= yyStates.Length) { // dynamically increase
258 int[] i = new int[yyStates.Length+yyMax];
259 System.Array.Copy(yyStates, i, 0);
261 Object[] o = new Object[yyVals.Length+yyMax];
262 System.Array.Copy(yyVals, o, 0);
265 yyStates[yyTop] = yyState;
266 yyVals[yyTop] = yyVal;
267 if (debug != null) debug.push(yyState, yyVal);
269 yyDiscarded: for (;;) { // discarding a token does not change stack
271 if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
273 yyToken = yyLex.advance() ? yyLex.token() : 0;
275 debug.lex(yyState, yyToken, yyname(yyToken), yyLex.value());
277 if ((yyN = yySindex[yyState]) != 0 && ((yyN += yyToken) >= 0)
278 && (yyN < yyTable.Length) && (yyCheck[yyN] == yyToken)) {
280 debug.shift(yyState, yyTable[yyN], yyErrorFlag-1);
281 yyState = yyTable[yyN]; // shift to yyN
282 yyVal = yyLex.value();
284 if (yyErrorFlag > 0) -- yyErrorFlag;
287 if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0
288 && yyN < yyTable.Length && yyCheck[yyN] == yyToken)
289 yyN = yyTable[yyN]; // reduce (yyN)
291 switch (yyErrorFlag) {
294 yyerror("syntax error", yyExpecting(yyState));
295 if (debug != null) debug.error("syntax error");
300 if ((yyN = yySindex[yyStates[yyTop]]) != 0
301 && (yyN += Token.yyErrorCode) >= 0 && yyN < yyTable.Length
302 && yyCheck[yyN] == Token.yyErrorCode) {
304 debug.shift(yyStates[yyTop], yyTable[yyN], 3);
305 yyState = yyTable[yyN];
306 yyVal = yyLex.value();
309 if (debug != null) debug.pop(yyStates[yyTop]);
310 } while (-- yyTop >= 0);
311 if (debug != null) debug.reject();
312 throw new yyParser.yyException("irrecoverable syntax error");
316 if (debug != null) debug.reject();
317 throw new yyParser.yyException("irrecoverable syntax error at end-of-file");
320 debug.discard(yyState, yyToken, yyname(yyToken),
323 goto yyDiscarded; // leave stack alone
326 int yyV = yyTop + 1-yyLen[yyN];
328 debug.reduce(yyState, yyStates[yyV-1], yyN, yyRule[yyN], yyLen[yyN]);
329 yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
332 // line 112 "Parser.jay"
334 yyVal = new ExprOR ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
338 // line 120 "Parser.jay"
340 yyVal = new ExprAND ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
344 // line 128 "Parser.jay"
346 yyVal = new ExprEQ ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
350 // line 132 "Parser.jay"
352 yyVal = new ExprNE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
356 // line 140 "Parser.jay"
358 yyVal = new ExprLT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
362 // line 144 "Parser.jay"
364 yyVal = new ExprGT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
368 // line 148 "Parser.jay"
370 yyVal = new ExprLE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
374 // line 152 "Parser.jay"
376 yyVal = new ExprGE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
380 // line 160 "Parser.jay"
382 yyVal = new ExprPLUS ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
386 // line 164 "Parser.jay"
388 yyVal = new ExprMINUS ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
392 // line 172 "Parser.jay"
394 yyVal = new ExprMULT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
398 // line 176 "Parser.jay"
400 yyVal = new ExprDIV ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
404 // line 180 "Parser.jay"
406 yyVal = new ExprMOD ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
410 // line 188 "Parser.jay"
412 yyVal = new ExprNEG ((Expression) yyVals[0+yyTop]);
416 // line 196 "Parser.jay"
418 yyVal = new ExprUNION ((NodeSet) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
422 // line 204 "Parser.jay"
424 yyVal = new ExprRoot ();
428 // line 208 "Parser.jay"
430 yyVal = new ExprSLASH (new ExprRoot (), (NodeSet) yyVals[0+yyTop]);
434 // line 212 "Parser.jay"
436 ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
437 yyVal = new ExprSLASH (new ExprSLASH (new ExprRoot (), exprStep), (NodeSet) yyVals[0+yyTop]);
441 // line 218 "Parser.jay"
443 yyVal = new ExprSLASH ((NodeSet) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
447 // line 222 "Parser.jay"
449 ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
450 yyVal = new ExprSLASH (new ExprSLASH ((NodeSet) yyVals[-2+yyTop], exprStep), (NodeSet) yyVals[0+yyTop]);
454 // line 231 "Parser.jay"
456 yyVal = new ExprSLASH ((NodeSet) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
460 // line 235 "Parser.jay"
462 ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
463 yyVal = new ExprSLASH (new ExprSLASH ((NodeSet) yyVals[-2+yyTop], exprStep), (NodeSet) yyVals[0+yyTop]);
467 // line 243 "Parser.jay"
469 yyVal = new ExprStep (new NodeNameTest ((Axes) yyVals[-2+yyTop], (QName) yyVals[-1+yyTop]), (ExprPredicates) yyVals[0+yyTop]);
473 // line 247 "Parser.jay"
475 yyVal = new ExprStep (new NodeTypeTest ((Axes) yyVals[-2+yyTop]), (ExprPredicates) yyVals[0+yyTop]);
479 // line 256 "Parser.jay"
481 yyVal = new ExprStep (new NodeTypeTest ((Axes) yyVals[-5+yyTop], (XPathNodeType) yyVals[-4+yyTop], (String) yyVals[-2+yyTop]), (ExprPredicates) yyVals[0+yyTop]);
485 // line 260 "Parser.jay"
487 yyVal = new ExprStep (new NodeTypeTest (Axes.Self, XPathNodeType.All));
491 // line 264 "Parser.jay"
493 yyVal = new ExprStep (new NodeTypeTest (Axes.Parent, XPathNodeType.All));
497 // line 271 "Parser.jay"
503 // line 275 "Parser.jay"
505 yyVal = Axes.Attribute;
509 // line 279 "Parser.jay"
511 yyVal = yyVals[-1+yyTop];
515 // line 285 "Parser.jay"
516 { yyVal = XPathNodeType.Comment; }
519 // line 286 "Parser.jay"
520 { yyVal = XPathNodeType.Text; }
523 // line 287 "Parser.jay"
524 { yyVal = XPathNodeType.ProcessingInstruction; }
527 // line 288 "Parser.jay"
528 { yyVal = XPathNodeType.All; }
531 // line 295 "Parser.jay"
533 yyVal = new ExprFilter ((Expression) yyVals[-1+yyTop], (Expression) yyVals[0+yyTop]);
537 // line 302 "Parser.jay"
539 yyVal = new ExprVariable ((QName) yyVals[0+yyTop]);
543 // line 306 "Parser.jay"
545 yyVal = yyVals[-1+yyTop];
549 // line 310 "Parser.jay"
551 yyVal = new ExprLiteral ((String) yyVals[0+yyTop]);
555 // line 314 "Parser.jay"
557 yyVal = new ExprNumber ((double) yyVals[0+yyTop]);
561 // line 322 "Parser.jay"
563 yyVal = new ExprFunctionCall ((String) yyVals[-3+yyTop], (FunctionArguments) yyVals[-1+yyTop]);
567 // line 330 "Parser.jay"
569 yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]);
573 // line 338 "Parser.jay"
575 yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]);
579 // line 347 "Parser.jay"
581 yyVal = new ExprPredicates ((Expression) yyVals[-1+yyTop], (ExprPredicates) yyVals[0+yyTop]);
585 // line 354 "Parser.jay"
587 yyVal = yyVals[-1+yyTop];
591 // line 360 "Parser.jay"
592 { yyVal = Axes.Ancestor; }
595 // line 361 "Parser.jay"
596 { yyVal = Axes.AncestorOrSelf; }
599 // line 362 "Parser.jay"
600 { yyVal = Axes.Attribute; }
603 // line 363 "Parser.jay"
604 { yyVal = Axes.Child; }
607 // line 364 "Parser.jay"
608 { yyVal = Axes.Descendant; }
611 // line 365 "Parser.jay"
612 { yyVal = Axes.DescendantOrSelf; }
615 // line 366 "Parser.jay"
616 { yyVal = Axes.Following; }
619 // line 367 "Parser.jay"
620 { yyVal = Axes.FollowingSibling; }
623 // line 368 "Parser.jay"
624 { yyVal = Axes.Namespace; }
627 // line 369 "Parser.jay"
628 { yyVal = Axes.Parent; }
631 // line 370 "Parser.jay"
632 { yyVal = Axes.Preceding; }
635 // line 371 "Parser.jay"
636 { yyVal = Axes.PrecedingSibling; }
639 // line 372 "Parser.jay"
640 { yyVal = Axes.Self; }
643 // line 382 "Parser.jay"
645 yyVal = new NCName ((String) yyVals[0+yyTop]);
649 // line 386 "Parser.jay"
651 yyVal = new QName ((String) yyVals[-2+yyTop], null);
655 // line 390 "Parser.jay"
657 yyVal = new QName ((String) yyVals[-2+yyTop], (String) yyVals[0+yyTop]);
663 yyState = yyStates[yyTop];
664 int yyM = yyLhs[yyN];
665 if (yyState == 0 && yyM == 0) {
666 if (debug != null) debug.shift(0, yyFinal);
669 yyToken = yyLex.advance() ? yyLex.token() : 0;
671 debug.lex(yyState, yyToken,yyname(yyToken), yyLex.value());
674 if (debug != null) debug.accept(yyVal);
679 if (((yyN = yyGindex[yyM]) != 0) && ((yyN += yyState) >= 0)
680 && (yyN < yyTable.Length) && (yyCheck[yyN] == yyState))
681 yyState = yyTable[yyN];
683 yyState = yyDgoto[yyM];
684 if (debug != null) debug.shift(yyStates[yyTop], yyState);
690 static short [] yyLhs = { -1,
691 0, 1, 1, 2, 2, 3, 3, 3, 4, 4,
692 4, 4, 4, 5, 5, 5, 6, 6, 6, 6,
693 7, 7, 8, 8, 9, 9, 9, 9, 9, 9,
694 9, 10, 10, 10, 12, 12, 12, 12, 12, 13,
695 13, 13, 16, 16, 16, 16, 11, 11, 19, 19,
696 19, 19, 19, 21, 22, 22, 23, 23, 15, 15,
697 20, 18, 18, 18, 18, 18, 18, 18, 18, 18,
698 18, 18, 18, 18, 17, 17, 14, 14, 14,
700 static short [] yyLen = { 2,
701 1, 1, 3, 1, 3, 1, 3, 3, 1, 3,
702 3, 3, 3, 1, 3, 3, 1, 3, 3, 3,
703 1, 2, 1, 3, 1, 1, 2, 2, 1, 3,
704 3, 1, 3, 3, 3, 3, 6, 1, 1, 0,
705 1, 2, 1, 1, 1, 1, 1, 2, 2, 3,
706 1, 1, 1, 4, 0, 2, 0, 3, 0, 2,
707 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
708 1, 1, 1, 1, 0, 1, 1, 3, 3,
710 static short [] yyDefRed = { 0,
711 0, 0, 38, 39, 41, 0, 0, 0, 0, 62,
712 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
713 73, 74, 52, 51, 0, 0, 0, 0, 0, 0,
714 0, 17, 0, 23, 0, 0, 32, 0, 0, 47,
715 53, 0, 0, 0, 0, 22, 0, 49, 0, 0,
716 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
717 0, 0, 0, 0, 0, 0, 0, 48, 0, 43,
718 44, 45, 46, 0, 0, 42, 0, 0, 50, 0,
719 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
720 19, 20, 18, 24, 33, 34, 0, 0, 0, 36,
721 0, 35, 0, 0, 56, 54, 78, 79, 61, 60,
724 protected static short [] yyDgoto = { 25,
725 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
726 36, 37, 38, 48, 100, 75, 112, 39, 40, 101,
729 protected static short [] yySindex = { -188,
730 -85, -85, 0, 0, 0, -258, -188, -188, -297, 0,
731 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
732 0, 0, 0, 0, 0, -215, -257, -253, -265, -245,
733 -261, 0, -221, 0, -218, -252, 0, -256, -203, 0,
734 0, -218, -218, -188, -209, 0, -200, 0, -188, -188,
735 -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,
736 -188, -130, -85, -85, -85, -85, -188, 0, -204, 0,
737 0, 0, 0, -204, -195, 0, -199, -194, 0, -268,
738 -257, -253, -265, -265, -245, -245, -245, -245, -261, -261,
739 0, 0, 0, 0, 0, 0, -218, -218, -202, 0,
740 -204, 0, -229, -188, 0, 0, 0, 0, 0, 0,
741 0, -191, -199, -204, 0, 0,
743 protected static short [] yyRindex = { -182,
744 1, -182, 0, 0, 0, 0, -182, -182, 0, 0,
745 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
746 0, 0, 0, 0, 0, 253, 65, 23, 435, 319,
747 244, 0, 222, 0, 90, 112, 0, 0, 0, 0,
748 0, 134, 156, -267, 0, 0, 40, 0, -182, -182,
749 -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,
750 -182, -182, -182, -182, -182, -182, -182, 0, 68, 0,
751 0, 0, 0, 68, 0, 0, -190, 0, 0, 0,
752 510, 501, 457, 479, 347, 369, 391, 413, 267, 289,
753 0, 0, 0, 0, 0, 0, 178, 200, 0, 0,
754 68, 0, -187, -182, 0, 0, 0, 0, 0, 0,
755 0, 0, -190, 68, 0, 0,
757 protected static short [] yyGindex = { -7,
758 0, 34, 35, -3, -29, -1, -6, 0, 24, 4,
759 0, -12, 0, 49, -71, 0, 0, 0, 0, 52,
762 protected static short [] yyTable = { 45,
763 26, 46, 102, 55, 42, 43, 65, 66, 47, 107,
764 40, 44, 59, 60, 50, 67, 61, 53, 54, 55,
765 56, 69, 4, 85, 86, 87, 88, 51, 52, 110,
766 57, 58, 40, 40, 40, 40, 77, 108, 40, 77,
767 63, 64, 116, 70, 71, 72, 73, 83, 84, 47,
768 95, 96, 91, 92, 93, 89, 90, 49, 62, 99,
769 76, 79, 80, 67, 2, 104, 109, 59, 97, 98,
770 1, 2, 3, 4, 103, 111, 106, 5, 6, 114,
771 57, 7, 81, 75, 82, 94, 74, 68, 8, 25,
772 9, 115, 0, 0, 0, 40, 113, 0, 10, 11,
773 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
774 22, 29, 0, 0, 0, 23, 24, 40, 40, 40,
775 40, 0, 0, 40, 0, 0, 0, 0, 1, 2,
776 3, 4, 0, 27, 0, 5, 6, 0, 0, 7,
777 0, 0, 0, 0, 0, 0, 0, 0, 9, 0,
778 0, 0, 0, 0, 0, 28, 10, 11, 12, 13,
779 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
780 0, 0, 0, 23, 24, 3, 4, 30, 0, 0,
781 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
782 0, 0, 0, 0, 0, 0, 0, 0, 0, 31,
783 0, 10, 11, 12, 13, 14, 15, 16, 17, 18,
784 19, 20, 21, 22, 0, 0, 0, 0, 0, 0,
785 0, 21, 0, 0, 0, 0, 0, 0, 0, 0,
786 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
787 0, 0, 0, 14, 0, 0, 0, 0, 0, 0,
788 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
789 0, 0, 0, 0, 0, 26, 15, 0, 0, 26,
790 0, 26, 26, 26, 26, 26, 26, 26, 26, 0,
791 26, 26, 26, 26, 26, 26, 26, 4, 16, 0,
792 0, 4, 0, 4, 4, 4, 0, 0, 77, 77,
793 40, 40, 40, 40, 77, 0, 40, 77, 77, 0,
794 77, 77, 77, 77, 77, 77, 77, 77, 9, 77,
795 77, 77, 77, 77, 77, 77, 59, 59, 0, 2,
796 0, 0, 59, 2, 0, 2, 59, 2, 59, 59,
797 59, 59, 59, 59, 59, 59, 12, 59, 59, 59,
798 59, 59, 59, 59, 25, 0, 0, 0, 25, 0,
799 25, 25, 25, 25, 25, 25, 25, 25, 13, 25,
800 25, 25, 25, 25, 25, 25, 29, 0, 0, 0,
801 29, 0, 29, 29, 29, 29, 29, 29, 29, 29,
802 10, 29, 29, 29, 29, 29, 29, 29, 27, 0,
803 0, 0, 27, 0, 27, 27, 27, 27, 27, 27,
804 27, 27, 11, 27, 27, 27, 27, 27, 27, 27,
805 28, 0, 0, 0, 28, 0, 28, 28, 28, 28,
806 28, 28, 28, 28, 6, 28, 28, 28, 28, 28,
807 28, 28, 30, 0, 0, 0, 30, 0, 30, 30,
808 30, 30, 30, 30, 30, 30, 7, 30, 30, 30,
809 30, 30, 30, 30, 31, 0, 0, 0, 31, 0,
810 31, 31, 31, 31, 31, 31, 31, 31, 8, 31,
811 31, 31, 31, 31, 31, 31, 21, 0, 0, 0,
812 21, 0, 21, 21, 21, 21, 21, 21, 21, 21,
813 5, 0, 21, 21, 21, 21, 21, 21, 14, 3,
814 0, 0, 14, 0, 14, 14, 14, 1, 0, 14,
815 14, 1, 0, 1, 14, 14, 14, 14, 14, 14,
816 0, 15, 0, 0, 0, 15, 0, 15, 15, 15,
817 0, 0, 15, 15, 0, 0, 0, 15, 15, 15,
818 15, 15, 15, 16, 0, 0, 0, 16, 0, 16,
819 16, 16, 0, 0, 16, 16, 0, 0, 0, 16,
820 16, 16, 16, 16, 16, 0, 0, 0, 0, 0,
821 0, 0, 0, 9, 0, 0, 0, 9, 0, 9,
822 9, 9, 0, 0, 0, 0, 0, 0, 0, 9,
823 9, 9, 9, 9, 9, 0, 0, 0, 0, 0,
824 0, 12, 0, 0, 0, 12, 0, 12, 12, 12,
825 0, 0, 0, 0, 0, 0, 0, 12, 12, 12,
826 12, 12, 12, 13, 0, 0, 0, 13, 0, 13,
827 13, 13, 0, 0, 0, 0, 0, 0, 0, 13,
828 13, 13, 13, 13, 13, 10, 0, 0, 0, 10,
829 0, 10, 10, 10, 0, 0, 0, 0, 0, 0,
830 0, 10, 10, 10, 10, 10, 10, 11, 0, 0,
831 0, 11, 0, 11, 11, 11, 0, 0, 0, 0,
832 0, 0, 0, 11, 11, 11, 11, 11, 11, 6,
833 0, 0, 0, 6, 0, 6, 6, 6, 0, 0,
834 0, 0, 0, 0, 0, 6, 6, 0, 0, 0,
835 0, 7, 0, 0, 0, 7, 0, 7, 7, 7,
836 0, 0, 0, 0, 0, 0, 0, 7, 7, 0,
837 0, 0, 0, 8, 0, 0, 0, 8, 0, 8,
838 8, 8, 0, 0, 0, 0, 0, 0, 0, 8,
839 8, 0, 0, 0, 0, 5, 0, 0, 0, 5,
840 0, 5, 5, 5, 3, 0, 0, 0, 3, 0,
843 protected static short [] yyCheck = { 7,
844 0, 8, 74, 271, 1, 2, 259, 260, 306, 278,
845 278, 270, 274, 275, 272, 268, 278, 283, 284, 285,
846 286, 278, 0, 53, 54, 55, 56, 281, 282, 101,
847 276, 277, 300, 301, 302, 303, 44, 306, 306, 0,
848 259, 260, 114, 300, 301, 302, 303, 51, 52, 306,
849 63, 64, 59, 60, 61, 57, 58, 273, 280, 67,
850 264, 271, 263, 268, 0, 265, 269, 0, 65, 66,
851 259, 260, 261, 262, 270, 305, 271, 266, 267, 271,
852 271, 270, 49, 271, 50, 62, 38, 36, 277, 0,
853 279, 113, -1, -1, -1, 278, 104, -1, 287, 288,
854 289, 290, 291, 292, 293, 294, 295, 296, 297, 298,
855 299, 0, -1, -1, -1, 304, 305, 300, 301, 302,
856 303, -1, -1, 306, -1, -1, -1, -1, 259, 260,
857 261, 262, -1, 0, -1, 266, 267, -1, -1, 270,
858 -1, -1, -1, -1, -1, -1, -1, -1, 279, -1,
859 -1, -1, -1, -1, -1, 0, 287, 288, 289, 290,
860 291, 292, 293, 294, 295, 296, 297, 298, 299, -1,
861 -1, -1, -1, 304, 305, 261, 262, 0, -1, -1,
862 266, -1, -1, -1, -1, -1, -1, -1, -1, -1,
863 -1, -1, -1, -1, -1, -1, -1, -1, -1, 0,
864 -1, 287, 288, 289, 290, 291, 292, 293, 294, 295,
865 296, 297, 298, 299, -1, -1, -1, -1, -1, -1,
866 -1, 0, -1, -1, -1, -1, -1, -1, -1, -1,
867 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
868 -1, -1, -1, 0, -1, -1, -1, -1, -1, -1,
869 -1, -1, 0, -1, -1, -1, -1, -1, -1, -1,
870 -1, -1, -1, -1, -1, 265, 0, -1, -1, 269,
871 -1, 271, 272, 273, 274, 275, 276, 277, 278, -1,
872 280, 281, 282, 283, 284, 285, 286, 265, 0, -1,
873 -1, 269, -1, 271, 272, 273, -1, -1, 259, 260,
874 300, 301, 302, 303, 265, -1, 306, 268, 269, -1,
875 271, 272, 273, 274, 275, 276, 277, 278, 0, 280,
876 281, 282, 283, 284, 285, 286, 259, 260, -1, 265,
877 -1, -1, 265, 269, -1, 271, 269, 273, 271, 272,
878 273, 274, 275, 276, 277, 278, 0, 280, 281, 282,
879 283, 284, 285, 286, 265, -1, -1, -1, 269, -1,
880 271, 272, 273, 274, 275, 276, 277, 278, 0, 280,
881 281, 282, 283, 284, 285, 286, 265, -1, -1, -1,
882 269, -1, 271, 272, 273, 274, 275, 276, 277, 278,
883 0, 280, 281, 282, 283, 284, 285, 286, 265, -1,
884 -1, -1, 269, -1, 271, 272, 273, 274, 275, 276,
885 277, 278, 0, 280, 281, 282, 283, 284, 285, 286,
886 265, -1, -1, -1, 269, -1, 271, 272, 273, 274,
887 275, 276, 277, 278, 0, 280, 281, 282, 283, 284,
888 285, 286, 265, -1, -1, -1, 269, -1, 271, 272,
889 273, 274, 275, 276, 277, 278, 0, 280, 281, 282,
890 283, 284, 285, 286, 265, -1, -1, -1, 269, -1,
891 271, 272, 273, 274, 275, 276, 277, 278, 0, 280,
892 281, 282, 283, 284, 285, 286, 265, -1, -1, -1,
893 269, -1, 271, 272, 273, 274, 275, 276, 277, 278,
894 0, -1, 281, 282, 283, 284, 285, 286, 265, 0,
895 -1, -1, 269, -1, 271, 272, 273, 265, -1, 276,
896 277, 269, -1, 271, 281, 282, 283, 284, 285, 286,
897 -1, 265, -1, -1, -1, 269, -1, 271, 272, 273,
898 -1, -1, 276, 277, -1, -1, -1, 281, 282, 283,
899 284, 285, 286, 265, -1, -1, -1, 269, -1, 271,
900 272, 273, -1, -1, 276, 277, -1, -1, -1, 281,
901 282, 283, 284, 285, 286, -1, -1, -1, -1, -1,
902 -1, -1, -1, 265, -1, -1, -1, 269, -1, 271,
903 272, 273, -1, -1, -1, -1, -1, -1, -1, 281,
904 282, 283, 284, 285, 286, -1, -1, -1, -1, -1,
905 -1, 265, -1, -1, -1, 269, -1, 271, 272, 273,
906 -1, -1, -1, -1, -1, -1, -1, 281, 282, 283,
907 284, 285, 286, 265, -1, -1, -1, 269, -1, 271,
908 272, 273, -1, -1, -1, -1, -1, -1, -1, 281,
909 282, 283, 284, 285, 286, 265, -1, -1, -1, 269,
910 -1, 271, 272, 273, -1, -1, -1, -1, -1, -1,
911 -1, 281, 282, 283, 284, 285, 286, 265, -1, -1,
912 -1, 269, -1, 271, 272, 273, -1, -1, -1, -1,
913 -1, -1, -1, 281, 282, 283, 284, 285, 286, 265,
914 -1, -1, -1, 269, -1, 271, 272, 273, -1, -1,
915 -1, -1, -1, -1, -1, 281, 282, -1, -1, -1,
916 -1, 265, -1, -1, -1, 269, -1, 271, 272, 273,
917 -1, -1, -1, -1, -1, -1, -1, 281, 282, -1,
918 -1, -1, -1, 265, -1, -1, -1, 269, -1, 271,
919 272, 273, -1, -1, -1, -1, -1, -1, -1, 281,
920 282, -1, -1, -1, -1, 265, -1, -1, -1, 269,
921 -1, 271, 272, 273, 265, -1, -1, -1, 269, -1,
925 // line 396 "Parser.jay"
930 public interface yyDebug {
931 void push (int state, Object value);
932 void lex (int state, int token, string name, Object value);
933 void shift (int from, int to, int errorFlag);
934 void pop (int state);
935 void discard (int state, int token, string name, Object value);
936 void reduce (int from, int to, int rule, string text, int len);
937 void shift (int from, int to);
938 void accept (Object value);
939 void error (string message);
943 class yyDebugSimple : yyDebug {
944 void println (string s){
945 Console.WriteLine (s);
948 public void push (int state, Object value) {
949 println ("push\tstate "+state+"\tvalue "+value);
952 public void lex (int state, int token, string name, Object value) {
953 println("lex\tstate "+state+"\treading "+name+"\tvalue "+value);
956 public void shift (int from, int to, int errorFlag) {
959 println("shift\tfrom state "+from+" to "+to);
961 case 0: case 1: case 2: // in error recovery
962 println("shift\tfrom state "+from+" to "+to
963 +"\t"+errorFlag+" left to recover");
966 println("shift\tfrom state "+from+" to "+to+"\ton error");
971 public void pop (int state) {
972 println("pop\tstate "+state+"\ton error");
975 public void discard (int state, int token, string name, Object value) {
976 println("discard\tstate "+state+"\ttoken "+name+"\tvalue "+value);
979 public void reduce (int from, int to, int rule, string text, int len) {
980 println("reduce\tstate "+from+"\tuncover "+to
981 +"\trule ("+rule+") "+text);
984 public void shift (int from, int to) {
985 println("goto\tfrom state "+from+" to "+to);
988 public void accept (Object value) {
989 println("accept\tvalue "+value);
992 public void error (string message) {
993 println("error\t"+message);
996 public void reject () {
1004 public const int ERROR = 257;
1005 public const int EOF = 258;
1006 public const int SLASH = 259;
1007 public const int SLASH2 = 260;
1008 public const int DOT = 261;
1009 public const int DOT2 = 262;
1010 public const int COLON = 263;
1011 public const int COLON2 = 264;
1012 public const int COMMA = 265;
1013 public const int AT = 266;
1014 public const int FUNCTION_NAME = 267;
1015 public const int BRACKET_OPEN = 268;
1016 public const int BRACKET_CLOSE = 269;
1017 public const int PAREN_OPEN = 270;
1018 public const int PAREN_CLOSE = 271;
1019 public const int AND = 272;
1020 public const int OR = 273;
1021 public const int DIV = 274;
1022 public const int MOD = 275;
1023 public const int PLUS = 276;
1024 public const int MINUS = 277;
1025 public const int ASTERISK = 278;
1026 public const int DOLLAR = 279;
1027 public const int BAR = 280;
1028 public const int EQ = 281;
1029 public const int NE = 282;
1030 public const int LE = 283;
1031 public const int GE = 284;
1032 public const int LT = 285;
1033 public const int GT = 286;
1034 public const int ANCESTOR = 287;
1035 public const int ANCESTOR_OR_SELF = 288;
1036 public const int ATTRIBUTE = 289;
1037 public const int CHILD = 290;
1038 public const int DESCENDANT = 291;
1039 public const int DESCENDANT_OR_SELF = 292;
1040 public const int FOLLOWING = 293;
1041 public const int FOLLOWING_SIBLING = 294;
1042 public const int NAMESPACE = 295;
1043 public const int PARENT = 296;
1044 public const int PRECEDING = 297;
1045 public const int PRECEDING_SIBLING = 298;
1046 public const int SELF = 299;
1047 public const int COMMENT = 300;
1048 public const int TEXT = 301;
1049 public const int PROCESSING_INSTRUCTION = 302;
1050 public const int NODE = 303;
1051 public const int NUMBER = 304;
1052 public const int LITERAL = 305;
1053 public const int NCName = 306;
1054 public const int yyErrorCode = 256;
1056 namespace yyParser {
1058 /** thrown for irrecoverable syntax errors and stack overflow.
1060 public class yyException : System.Exception {
1061 public yyException (string message) : base (message) {
1065 /** must be implemented by a scanner object to supply input to the parser.
1067 public interface yyInput {
1068 /** move on to next token.
1069 @return false if positioned beyond tokens.
1070 @throws IOException on input error.
1072 bool advance (); // throws java.io.IOException;
1073 /** classifies current token.
1074 Should not be called if advance() returned false.
1075 @return current %token or single character.
1078 /** associated with current token.
1079 Should not be called if advance() returned false.
1080 @return value for token().
1085 } // close outermost namespace, that MUST HAVE BEEN opened in the prolog