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;
17 namespace Mono.Xml.XPath
19 public class XPathParser
21 internal object yyparseDebug (Tokenizer tok)
23 return yyparse (tok, new yydebug.yyDebugSimple ());
28 /** simplified error message.
29 @see <a href="#yyerror(java.lang.String, java.lang.String[])">yyerror</a>
31 public void yyerror (string message) {
32 yyerror(message, null);
35 /** (syntax) error message.
36 Can be overwritten to control message format.
37 @param message text to be displayed.
38 @param expected vector of acceptable tokens, if available.
40 public void yyerror (string message, string[] expected) {
41 if ((expected != null) && (expected.Length > 0)) {
42 System.Console.Write (message+", expecting");
43 for (int n = 0; n < expected.Length; ++ n)
44 System.Console.Write (" "+expected[n]);
45 System.Console.WriteLine ();
47 System.Console.WriteLine (message);
50 /** debugging support, requires the package jay.yydebug.
51 Set to null to suppress debugging messages.
53 protected yydebug.yyDebug debug;
55 protected static int yyFinal = 25;
56 public static string [] yyRule = {
60 "OrExpr : OrExpr OR AndExpr",
61 "AndExpr : EqualityExpr",
62 "AndExpr : AndExpr AND EqualityExpr",
63 "EqualityExpr : RelationalExpr",
64 "EqualityExpr : EqualityExpr EQ RelationalExpr",
65 "EqualityExpr : EqualityExpr NE RelationalExpr",
66 "RelationalExpr : AdditiveExpr",
67 "RelationalExpr : RelationalExpr LT AdditiveExpr",
68 "RelationalExpr : RelationalExpr GT AdditiveExpr",
69 "RelationalExpr : RelationalExpr LE AdditiveExpr",
70 "RelationalExpr : RelationalExpr GE AdditiveExpr",
71 "AdditiveExpr : MultiplicativeExpr",
72 "AdditiveExpr : AdditiveExpr PLUS MultiplicativeExpr",
73 "AdditiveExpr : AdditiveExpr MINUS MultiplicativeExpr",
74 "MultiplicativeExpr : UnaryExpr",
75 "MultiplicativeExpr : MultiplicativeExpr ASTERISK UnaryExpr",
76 "MultiplicativeExpr : MultiplicativeExpr DIV UnaryExpr",
77 "MultiplicativeExpr : MultiplicativeExpr MOD UnaryExpr",
78 "UnaryExpr : UnionExpr",
79 "UnaryExpr : MINUS UnaryExpr",
80 "UnionExpr : PathExpr",
81 "UnionExpr : UnionExpr BAR PathExpr",
82 "PathExpr : RelativeLocationPath",
84 "PathExpr : SLASH RelativeLocationPath",
85 "PathExpr : SLASH2 RelativeLocationPath",
86 "PathExpr : FilterExpr",
87 "PathExpr : FilterExpr SLASH RelativeLocationPath",
88 "PathExpr : FilterExpr SLASH2 RelativeLocationPath",
89 "RelativeLocationPath : Step",
90 "RelativeLocationPath : RelativeLocationPath SLASH Step",
91 "RelativeLocationPath : RelativeLocationPath SLASH2 Step",
92 "Step : AxisSpecifier QName ZeroOrMorePredicates",
93 "Step : AxisSpecifier ASTERISK ZeroOrMorePredicates",
94 "Step : AxisSpecifier NodeType PAREN_OPEN OptionalLiteral PAREN_CLOSE ZeroOrMorePredicates",
99 "AxisSpecifier : AxisName COLON2",
100 "NodeType : COMMENT",
102 "NodeType : PROCESSING_INSTRUCTION",
104 "FilterExpr : PrimaryExpr",
105 "FilterExpr : FilterExpr Predicate",
106 "PrimaryExpr : DOLLAR QName",
107 "PrimaryExpr : PAREN_OPEN Expr PAREN_CLOSE",
108 "PrimaryExpr : LITERAL",
109 "PrimaryExpr : NUMBER",
110 "PrimaryExpr : FunctionCall",
111 "FunctionCall : FUNCTION_NAME PAREN_OPEN OptionalArgumentList PAREN_CLOSE",
112 "OptionalArgumentList :",
113 "OptionalArgumentList : Expr OptionalArgumentListTail",
114 "OptionalArgumentListTail :",
115 "OptionalArgumentListTail : COMMA Expr OptionalArgumentListTail",
116 "ZeroOrMorePredicates :",
117 "ZeroOrMorePredicates : Predicate ZeroOrMorePredicates",
118 "Predicate : BRACKET_OPEN Expr BRACKET_CLOSE",
119 "AxisName : ANCESTOR",
120 "AxisName : ANCESTOR_OR_SELF",
121 "AxisName : ATTRIBUTE",
123 "AxisName : DESCENDANT",
124 "AxisName : DESCENDANT_OR_SELF",
125 "AxisName : FOLLOWING",
126 "AxisName : FOLLOWING_SIBLING",
127 "AxisName : NAMESPACE",
129 "AxisName : PRECEDING",
130 "AxisName : PRECEDING_SIBLING",
133 "OptionalLiteral : LITERAL",
135 "QName : NCName COLON ASTERISK",
136 "QName : NCName COLON NCName",
138 protected static string [] yyName = {
139 "end-of-file",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,null,null,null,null,null,null,null,
157 null,null,null,null,null,null,null,"ERROR","EOF","SLASH","SLASH2",
158 "DOT","DOT2","COLON","COLON2","COMMA","AT","FUNCTION_NAME",
159 "BRACKET_OPEN","BRACKET_CLOSE","PAREN_OPEN","PAREN_CLOSE","AND","OR",
160 "DIV","MOD","PLUS","MINUS","ASTERISK","DOLLAR","BAR","EQ","NE","LE",
161 "GE","LT","GT","ANCESTOR","ANCESTOR_OR_SELF","ATTRIBUTE","CHILD",
162 "DESCENDANT","DESCENDANT_OR_SELF","FOLLOWING","FOLLOWING_SIBLING",
163 "NAMESPACE","PARENT","PRECEDING","PRECEDING_SIBLING","SELF","COMMENT",
164 "TEXT","PROCESSING_INSTRUCTION","NODE","NUMBER","LITERAL","NCName",
167 /** index-checked interface to yyName[].
168 @param token single character or %token value.
169 @return token name or [illegal] or [unknown].
171 public static string yyname (int token) {
172 if ((token < 0) || (token > yyName.Length)) return "[illegal]";
174 if ((name = yyName[token]) != null) return name;
178 /** computes list of expected tokens on error by tracing the tables.
179 @param state for which to compute the list.
180 @return list of token names.
182 protected string[] yyExpecting (int state) {
183 int token, n, len = 0;
184 bool[] ok = new bool[yyName.Length];
186 if ((n = yySindex[state]) != 0)
187 for (token = n < 0 ? -n : 0;
188 (token < yyName.Length) && (n+token < yyTable.Length); ++ token)
189 if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
193 if ((n = yyRindex[state]) != 0)
194 for (token = n < 0 ? -n : 0;
195 (token < yyName.Length) && (n+token < yyTable.Length); ++ token)
196 if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
201 string [] result = new string[len];
202 for (n = token = 0; n < len; ++ token)
203 if (ok[token]) result[n++] = yyName[token];
207 /** the generated parser, with debugging messages.
208 Maintains a state and a value stack, currently with fixed maximum size.
209 @param yyLex scanner.
210 @param yydebug debug message writer implementing yyDebug, or null.
211 @return result of the last reduction, if any.
212 @throws yyException on irrecoverable parse error.
214 public Object yyparse (yyParser.yyInput yyLex, Object yyd)
216 this.debug = (yydebug.yyDebug)yyd;
217 return yyparse(yyLex);
220 /** initial size and increment of the state/value stack [default 256].
221 This is not final so that it can be overwritten outside of invocations
226 /** executed at the beginning of a reduce action.
227 Used as $$ = yyDefault($1), prior to the user-specified action, if any.
228 Can be overwritten to provide deep copy, etc.
229 @param first value for $1, or null.
232 protected Object yyDefault (Object first) {
236 /** the generated parser.
237 Maintains a state and a value stack, currently with fixed maximum size.
238 @param yyLex scanner.
239 @return result of the last reduction, if any.
240 @throws yyException on irrecoverable parse error.
242 public Object yyparse (yyParser.yyInput yyLex)
244 if (yyMax <= 0) yyMax = 256; // initial size
245 int yyState = 0; // state stack ptr
246 int [] yyStates = new int[yyMax]; // state stack
247 Object yyVal = null; // value stack ptr
248 Object [] yyVals = new Object[yyMax]; // value stack
249 int yyToken = -1; // current input
250 int yyErrorFlag = 0; // #tks to shift
258 if (yyTop >= yyStates.Length) { // dynamically increase
259 int[] i = new int[yyStates.Length+yyMax];
260 yyStates.CopyTo (i, 0);
262 Object[] o = new Object[yyVals.Length+yyMax];
263 yyVals.CopyTo (o, 0);
266 yyStates[yyTop] = yyState;
267 yyVals[yyTop] = yyVal;
268 if (debug != null) debug.push(yyState, yyVal);
270 yyDiscarded: for (;;) { // discarding a token does not change stack
272 if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
274 yyToken = yyLex.advance() ? yyLex.token() : 0;
276 debug.lex(yyState, yyToken, yyname(yyToken), yyLex.value());
278 if ((yyN = yySindex[yyState]) != 0 && ((yyN += yyToken) >= 0)
279 && (yyN < yyTable.Length) && (yyCheck[yyN] == yyToken)) {
281 debug.shift(yyState, yyTable[yyN], yyErrorFlag-1);
282 yyState = yyTable[yyN]; // shift to yyN
283 yyVal = yyLex.value();
285 if (yyErrorFlag > 0) -- yyErrorFlag;
288 if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0
289 && yyN < yyTable.Length && yyCheck[yyN] == yyToken)
290 yyN = yyTable[yyN]; // reduce (yyN)
292 switch (yyErrorFlag) {
295 yyerror("syntax error", yyExpecting(yyState));
296 if (debug != null) debug.error("syntax error");
301 if ((yyN = yySindex[yyStates[yyTop]]) != 0
302 && (yyN += Token.yyErrorCode) >= 0 && yyN < yyTable.Length
303 && yyCheck[yyN] == Token.yyErrorCode) {
305 debug.shift(yyStates[yyTop], yyTable[yyN], 3);
306 yyState = yyTable[yyN];
307 yyVal = yyLex.value();
310 if (debug != null) debug.pop(yyStates[yyTop]);
311 } while (-- yyTop >= 0);
312 if (debug != null) debug.reject();
313 throw new yyParser.yyException("irrecoverable syntax error");
317 if (debug != null) debug.reject();
318 throw new yyParser.yyException("irrecoverable syntax error at end-of-file");
321 debug.discard(yyState, yyToken, yyname(yyToken),
324 goto yyDiscarded; // leave stack alone
327 int yyV = yyTop + 1-yyLen[yyN];
329 debug.reduce(yyState, yyStates[yyV-1], yyN, yyRule[yyN], yyLen[yyN]);
330 yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
333 // line 112 "Parser.jay"
335 yyVal = new ExprOR ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
339 // line 120 "Parser.jay"
341 yyVal = new ExprAND ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
345 // line 128 "Parser.jay"
347 yyVal = new ExprEQ ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
351 // line 132 "Parser.jay"
353 yyVal = new ExprNE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
357 // line 140 "Parser.jay"
359 yyVal = new ExprLT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
363 // line 144 "Parser.jay"
365 yyVal = new ExprGT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
369 // line 148 "Parser.jay"
371 yyVal = new ExprLE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
375 // line 152 "Parser.jay"
377 yyVal = new ExprGE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
381 // line 160 "Parser.jay"
383 yyVal = new ExprPLUS ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
387 // line 164 "Parser.jay"
389 yyVal = new ExprMINUS ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
393 // line 172 "Parser.jay"
395 yyVal = new ExprMULT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
399 // line 176 "Parser.jay"
401 yyVal = new ExprDIV ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
405 // line 180 "Parser.jay"
407 yyVal = new ExprMOD ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
411 // line 188 "Parser.jay"
413 yyVal = new ExprNEG ((Expression) yyVals[0+yyTop]);
417 // line 196 "Parser.jay"
419 yyVal = new ExprUNION ((NodeSet) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
423 // line 204 "Parser.jay"
425 yyVal = new ExprRoot ();
429 // line 208 "Parser.jay"
431 yyVal = new ExprSLASH (new ExprRoot (), (NodeSet) yyVals[0+yyTop]);
435 // line 212 "Parser.jay"
437 ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
438 yyVal = new ExprSLASH (new ExprSLASH (new ExprRoot (), exprStep), (NodeSet) yyVals[0+yyTop]);
442 // line 218 "Parser.jay"
444 yyVal = new ExprSLASH ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
448 // line 222 "Parser.jay"
450 ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
451 yyVal = new ExprSLASH (new ExprSLASH ((Expression) yyVals[-2+yyTop], exprStep), (NodeSet) yyVals[0+yyTop]);
455 // line 231 "Parser.jay"
457 yyVal = new ExprSLASH ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
461 // line 235 "Parser.jay"
463 ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
464 yyVal = new ExprSLASH (new ExprSLASH ((Expression) yyVals[-2+yyTop], exprStep), (NodeSet) yyVals[0+yyTop]);
468 // line 243 "Parser.jay"
470 yyVal = new ExprStep (new NodeNameTest ((Axes) yyVals[-2+yyTop], (QName) yyVals[-1+yyTop]), (ExprPredicates) yyVals[0+yyTop]);
474 // line 247 "Parser.jay"
476 yyVal = new ExprStep (new NodeTypeTest ((Axes) yyVals[-2+yyTop]), (ExprPredicates) yyVals[0+yyTop]);
480 // line 251 "Parser.jay"
482 yyVal = new ExprStep (new NodeTypeTest ((Axes) yyVals[-5+yyTop], (XPathNodeType) yyVals[-4+yyTop], (String) yyVals[-2+yyTop]), (ExprPredicates) yyVals[0+yyTop]);
486 // line 255 "Parser.jay"
488 yyVal = new ExprStep (new NodeTypeTest (Axes.Self, XPathNodeType.All));
492 // line 259 "Parser.jay"
494 yyVal = new ExprStep (new NodeTypeTest (Axes.Parent, XPathNodeType.All));
498 // line 266 "Parser.jay"
504 // line 270 "Parser.jay"
506 yyVal = Axes.Attribute;
510 // line 274 "Parser.jay"
512 yyVal = yyVals[-1+yyTop];
516 // line 280 "Parser.jay"
517 { yyVal = XPathNodeType.Comment; }
520 // line 281 "Parser.jay"
521 { yyVal = XPathNodeType.Text; }
524 // line 282 "Parser.jay"
525 { yyVal = XPathNodeType.ProcessingInstruction; }
528 // line 283 "Parser.jay"
529 { yyVal = XPathNodeType.All; }
532 // line 290 "Parser.jay"
534 yyVal = new ExprFilter ((Expression) yyVals[-1+yyTop], (Expression) yyVals[0+yyTop]);
538 // line 297 "Parser.jay"
540 yyVal = new ExprVariable ((QName) yyVals[0+yyTop]);
544 // line 301 "Parser.jay"
546 yyVal = yyVals[-1+yyTop];
550 // line 305 "Parser.jay"
552 yyVal = new ExprLiteral ((String) yyVals[0+yyTop]);
556 // line 309 "Parser.jay"
558 yyVal = new ExprNumber ((double) yyVals[0+yyTop]);
562 // line 317 "Parser.jay"
564 yyVal = new ExprFunctionCall ((String) yyVals[-3+yyTop], (FunctionArguments) yyVals[-1+yyTop]);
568 // line 325 "Parser.jay"
570 yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]);
574 // line 333 "Parser.jay"
576 yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]);
580 // line 342 "Parser.jay"
582 yyVal = new ExprPredicates ((Expression) yyVals[-1+yyTop], (ExprPredicates) yyVals[0+yyTop]);
586 // line 349 "Parser.jay"
588 yyVal = yyVals[-1+yyTop];
592 // line 355 "Parser.jay"
593 { yyVal = Axes.Ancestor; }
596 // line 356 "Parser.jay"
597 { yyVal = Axes.AncestorOrSelf; }
600 // line 357 "Parser.jay"
601 { yyVal = Axes.Attribute; }
604 // line 358 "Parser.jay"
605 { yyVal = Axes.Child; }
608 // line 359 "Parser.jay"
609 { yyVal = Axes.Descendant; }
612 // line 360 "Parser.jay"
613 { yyVal = Axes.DescendantOrSelf; }
616 // line 361 "Parser.jay"
617 { yyVal = Axes.Following; }
620 // line 362 "Parser.jay"
621 { yyVal = Axes.FollowingSibling; }
624 // line 363 "Parser.jay"
625 { yyVal = Axes.Namespace; }
628 // line 364 "Parser.jay"
629 { yyVal = Axes.Parent; }
632 // line 365 "Parser.jay"
633 { yyVal = Axes.Preceding; }
636 // line 366 "Parser.jay"
637 { yyVal = Axes.PrecedingSibling; }
640 // line 367 "Parser.jay"
641 { yyVal = Axes.Self; }
644 // line 377 "Parser.jay"
646 yyVal = new NCName ((String) yyVals[0+yyTop]);
650 // line 381 "Parser.jay"
652 yyVal = new QName ((String) yyVals[-2+yyTop], null);
656 // line 385 "Parser.jay"
658 yyVal = new QName ((String) yyVals[-2+yyTop], (String) yyVals[0+yyTop]);
664 yyState = yyStates[yyTop];
665 int yyM = yyLhs[yyN];
666 if (yyState == 0 && yyM == 0) {
667 if (debug != null) debug.shift(0, yyFinal);
670 yyToken = yyLex.advance() ? yyLex.token() : 0;
672 debug.lex(yyState, yyToken,yyname(yyToken), yyLex.value());
675 if (debug != null) debug.accept(yyVal);
680 if (((yyN = yyGindex[yyM]) != 0) && ((yyN += yyState) >= 0)
681 && (yyN < yyTable.Length) && (yyCheck[yyN] == yyState))
682 yyState = yyTable[yyN];
684 yyState = yyDgoto[yyM];
685 if (debug != null) debug.shift(yyStates[yyTop], yyState);
691 static short [] yyLhs = { -1,
692 0, 1, 1, 2, 2, 3, 3, 3, 4, 4,
693 4, 4, 4, 5, 5, 5, 6, 6, 6, 6,
694 7, 7, 8, 8, 9, 9, 9, 9, 9, 9,
695 9, 10, 10, 10, 12, 12, 12, 12, 12, 13,
696 13, 13, 16, 16, 16, 16, 11, 11, 19, 19,
697 19, 19, 19, 21, 22, 22, 23, 23, 15, 15,
698 20, 18, 18, 18, 18, 18, 18, 18, 18, 18,
699 18, 18, 18, 18, 17, 17, 14, 14, 14,
701 static short [] yyLen = { 2,
702 1, 1, 3, 1, 3, 1, 3, 3, 1, 3,
703 3, 3, 3, 1, 3, 3, 1, 3, 3, 3,
704 1, 2, 1, 3, 1, 1, 2, 2, 1, 3,
705 3, 1, 3, 3, 3, 3, 6, 1, 1, 0,
706 1, 2, 1, 1, 1, 1, 1, 2, 2, 3,
707 1, 1, 1, 4, 0, 2, 0, 3, 0, 2,
708 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
709 1, 1, 1, 1, 0, 1, 1, 3, 3,
711 static short [] yyDefRed = { 0,
712 0, 0, 38, 39, 41, 0, 0, 0, 0, 62,
713 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
714 73, 74, 52, 51, 0, 0, 0, 0, 0, 0,
715 0, 17, 0, 23, 0, 0, 32, 0, 0, 47,
716 53, 0, 0, 0, 0, 22, 0, 49, 0, 0,
717 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
718 0, 0, 0, 0, 0, 0, 0, 48, 0, 43,
719 44, 45, 46, 0, 0, 42, 0, 0, 50, 0,
720 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
721 19, 20, 18, 24, 33, 34, 0, 0, 0, 36,
722 0, 35, 0, 0, 56, 54, 78, 79, 61, 60,
725 protected static short [] yyDgoto = { 25,
726 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
727 36, 37, 38, 48, 100, 75, 112, 39, 40, 101,
730 protected static short [] yySindex = { -188,
731 -85, -85, 0, 0, 0, -258, -188, -188, -297, 0,
732 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
733 0, 0, 0, 0, 0, -215, -257, -253, -265, -245,
734 -261, 0, -221, 0, -218, -252, 0, -256, -203, 0,
735 0, -218, -218, -188, -209, 0, -200, 0, -188, -188,
736 -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,
737 -188, -130, -85, -85, -85, -85, -188, 0, -204, 0,
738 0, 0, 0, -204, -195, 0, -199, -194, 0, -268,
739 -257, -253, -265, -265, -245, -245, -245, -245, -261, -261,
740 0, 0, 0, 0, 0, 0, -218, -218, -202, 0,
741 -204, 0, -229, -188, 0, 0, 0, 0, 0, 0,
742 0, -191, -199, -204, 0, 0,
744 protected static short [] yyRindex = { -182,
745 1, -182, 0, 0, 0, 0, -182, -182, 0, 0,
746 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
747 0, 0, 0, 0, 0, 253, 65, 23, 435, 319,
748 244, 0, 222, 0, 90, 112, 0, 0, 0, 0,
749 0, 134, 156, -267, 0, 0, 40, 0, -182, -182,
750 -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,
751 -182, -182, -182, -182, -182, -182, -182, 0, 68, 0,
752 0, 0, 0, 68, 0, 0, -190, 0, 0, 0,
753 510, 501, 457, 479, 347, 369, 391, 413, 267, 289,
754 0, 0, 0, 0, 0, 0, 178, 200, 0, 0,
755 68, 0, -187, -182, 0, 0, 0, 0, 0, 0,
756 0, 0, -190, 68, 0, 0,
758 protected static short [] yyGindex = { -7,
759 0, 34, 35, -3, -29, -1, -6, 0, 24, 4,
760 0, -12, 0, 49, -71, 0, 0, 0, 0, 52,
763 protected static short [] yyTable = { 45,
764 26, 46, 102, 55, 42, 43, 65, 66, 47, 107,
765 40, 44, 59, 60, 50, 67, 61, 53, 54, 55,
766 56, 69, 4, 85, 86, 87, 88, 51, 52, 110,
767 57, 58, 40, 40, 40, 40, 77, 108, 40, 77,
768 63, 64, 116, 70, 71, 72, 73, 83, 84, 47,
769 95, 96, 91, 92, 93, 89, 90, 49, 62, 99,
770 76, 79, 80, 67, 2, 104, 109, 59, 97, 98,
771 1, 2, 3, 4, 103, 111, 106, 5, 6, 114,
772 57, 7, 81, 75, 82, 94, 74, 68, 8, 25,
773 9, 115, 0, 0, 0, 40, 113, 0, 10, 11,
774 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
775 22, 29, 0, 0, 0, 23, 24, 40, 40, 40,
776 40, 0, 0, 40, 0, 0, 0, 0, 1, 2,
777 3, 4, 0, 27, 0, 5, 6, 0, 0, 7,
778 0, 0, 0, 0, 0, 0, 0, 0, 9, 0,
779 0, 0, 0, 0, 0, 28, 10, 11, 12, 13,
780 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
781 0, 0, 0, 23, 24, 3, 4, 30, 0, 0,
782 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
783 0, 0, 0, 0, 0, 0, 0, 0, 0, 31,
784 0, 10, 11, 12, 13, 14, 15, 16, 17, 18,
785 19, 20, 21, 22, 0, 0, 0, 0, 0, 0,
786 0, 21, 0, 0, 0, 0, 0, 0, 0, 0,
787 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
788 0, 0, 0, 14, 0, 0, 0, 0, 0, 0,
789 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
790 0, 0, 0, 0, 0, 26, 15, 0, 0, 26,
791 0, 26, 26, 26, 26, 26, 26, 26, 26, 0,
792 26, 26, 26, 26, 26, 26, 26, 4, 16, 0,
793 0, 4, 0, 4, 4, 4, 0, 0, 77, 77,
794 40, 40, 40, 40, 77, 0, 40, 77, 77, 0,
795 77, 77, 77, 77, 77, 77, 77, 77, 9, 77,
796 77, 77, 77, 77, 77, 77, 59, 59, 0, 2,
797 0, 0, 59, 2, 0, 2, 59, 2, 59, 59,
798 59, 59, 59, 59, 59, 59, 12, 59, 59, 59,
799 59, 59, 59, 59, 25, 0, 0, 0, 25, 0,
800 25, 25, 25, 25, 25, 25, 25, 25, 13, 25,
801 25, 25, 25, 25, 25, 25, 29, 0, 0, 0,
802 29, 0, 29, 29, 29, 29, 29, 29, 29, 29,
803 10, 29, 29, 29, 29, 29, 29, 29, 27, 0,
804 0, 0, 27, 0, 27, 27, 27, 27, 27, 27,
805 27, 27, 11, 27, 27, 27, 27, 27, 27, 27,
806 28, 0, 0, 0, 28, 0, 28, 28, 28, 28,
807 28, 28, 28, 28, 6, 28, 28, 28, 28, 28,
808 28, 28, 30, 0, 0, 0, 30, 0, 30, 30,
809 30, 30, 30, 30, 30, 30, 7, 30, 30, 30,
810 30, 30, 30, 30, 31, 0, 0, 0, 31, 0,
811 31, 31, 31, 31, 31, 31, 31, 31, 8, 31,
812 31, 31, 31, 31, 31, 31, 21, 0, 0, 0,
813 21, 0, 21, 21, 21, 21, 21, 21, 21, 21,
814 5, 0, 21, 21, 21, 21, 21, 21, 14, 3,
815 0, 0, 14, 0, 14, 14, 14, 1, 0, 14,
816 14, 1, 0, 1, 14, 14, 14, 14, 14, 14,
817 0, 15, 0, 0, 0, 15, 0, 15, 15, 15,
818 0, 0, 15, 15, 0, 0, 0, 15, 15, 15,
819 15, 15, 15, 16, 0, 0, 0, 16, 0, 16,
820 16, 16, 0, 0, 16, 16, 0, 0, 0, 16,
821 16, 16, 16, 16, 16, 0, 0, 0, 0, 0,
822 0, 0, 0, 9, 0, 0, 0, 9, 0, 9,
823 9, 9, 0, 0, 0, 0, 0, 0, 0, 9,
824 9, 9, 9, 9, 9, 0, 0, 0, 0, 0,
825 0, 12, 0, 0, 0, 12, 0, 12, 12, 12,
826 0, 0, 0, 0, 0, 0, 0, 12, 12, 12,
827 12, 12, 12, 13, 0, 0, 0, 13, 0, 13,
828 13, 13, 0, 0, 0, 0, 0, 0, 0, 13,
829 13, 13, 13, 13, 13, 10, 0, 0, 0, 10,
830 0, 10, 10, 10, 0, 0, 0, 0, 0, 0,
831 0, 10, 10, 10, 10, 10, 10, 11, 0, 0,
832 0, 11, 0, 11, 11, 11, 0, 0, 0, 0,
833 0, 0, 0, 11, 11, 11, 11, 11, 11, 6,
834 0, 0, 0, 6, 0, 6, 6, 6, 0, 0,
835 0, 0, 0, 0, 0, 6, 6, 0, 0, 0,
836 0, 7, 0, 0, 0, 7, 0, 7, 7, 7,
837 0, 0, 0, 0, 0, 0, 0, 7, 7, 0,
838 0, 0, 0, 8, 0, 0, 0, 8, 0, 8,
839 8, 8, 0, 0, 0, 0, 0, 0, 0, 8,
840 8, 0, 0, 0, 0, 5, 0, 0, 0, 5,
841 0, 5, 5, 5, 3, 0, 0, 0, 3, 0,
844 protected static short [] yyCheck = { 7,
845 0, 8, 74, 271, 1, 2, 259, 260, 306, 278,
846 278, 270, 274, 275, 272, 268, 278, 283, 284, 285,
847 286, 278, 0, 53, 54, 55, 56, 281, 282, 101,
848 276, 277, 300, 301, 302, 303, 44, 306, 306, 0,
849 259, 260, 114, 300, 301, 302, 303, 51, 52, 306,
850 63, 64, 59, 60, 61, 57, 58, 273, 280, 67,
851 264, 271, 263, 268, 0, 265, 269, 0, 65, 66,
852 259, 260, 261, 262, 270, 305, 271, 266, 267, 271,
853 271, 270, 49, 271, 50, 62, 38, 36, 277, 0,
854 279, 113, -1, -1, -1, 278, 104, -1, 287, 288,
855 289, 290, 291, 292, 293, 294, 295, 296, 297, 298,
856 299, 0, -1, -1, -1, 304, 305, 300, 301, 302,
857 303, -1, -1, 306, -1, -1, -1, -1, 259, 260,
858 261, 262, -1, 0, -1, 266, 267, -1, -1, 270,
859 -1, -1, -1, -1, -1, -1, -1, -1, 279, -1,
860 -1, -1, -1, -1, -1, 0, 287, 288, 289, 290,
861 291, 292, 293, 294, 295, 296, 297, 298, 299, -1,
862 -1, -1, -1, 304, 305, 261, 262, 0, -1, -1,
863 266, -1, -1, -1, -1, -1, -1, -1, -1, -1,
864 -1, -1, -1, -1, -1, -1, -1, -1, -1, 0,
865 -1, 287, 288, 289, 290, 291, 292, 293, 294, 295,
866 296, 297, 298, 299, -1, -1, -1, -1, -1, -1,
867 -1, 0, -1, -1, -1, -1, -1, -1, -1, -1,
868 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
869 -1, -1, -1, 0, -1, -1, -1, -1, -1, -1,
870 -1, -1, 0, -1, -1, -1, -1, -1, -1, -1,
871 -1, -1, -1, -1, -1, 265, 0, -1, -1, 269,
872 -1, 271, 272, 273, 274, 275, 276, 277, 278, -1,
873 280, 281, 282, 283, 284, 285, 286, 265, 0, -1,
874 -1, 269, -1, 271, 272, 273, -1, -1, 259, 260,
875 300, 301, 302, 303, 265, -1, 306, 268, 269, -1,
876 271, 272, 273, 274, 275, 276, 277, 278, 0, 280,
877 281, 282, 283, 284, 285, 286, 259, 260, -1, 265,
878 -1, -1, 265, 269, -1, 271, 269, 273, 271, 272,
879 273, 274, 275, 276, 277, 278, 0, 280, 281, 282,
880 283, 284, 285, 286, 265, -1, -1, -1, 269, -1,
881 271, 272, 273, 274, 275, 276, 277, 278, 0, 280,
882 281, 282, 283, 284, 285, 286, 265, -1, -1, -1,
883 269, -1, 271, 272, 273, 274, 275, 276, 277, 278,
884 0, 280, 281, 282, 283, 284, 285, 286, 265, -1,
885 -1, -1, 269, -1, 271, 272, 273, 274, 275, 276,
886 277, 278, 0, 280, 281, 282, 283, 284, 285, 286,
887 265, -1, -1, -1, 269, -1, 271, 272, 273, 274,
888 275, 276, 277, 278, 0, 280, 281, 282, 283, 284,
889 285, 286, 265, -1, -1, -1, 269, -1, 271, 272,
890 273, 274, 275, 276, 277, 278, 0, 280, 281, 282,
891 283, 284, 285, 286, 265, -1, -1, -1, 269, -1,
892 271, 272, 273, 274, 275, 276, 277, 278, 0, 280,
893 281, 282, 283, 284, 285, 286, 265, -1, -1, -1,
894 269, -1, 271, 272, 273, 274, 275, 276, 277, 278,
895 0, -1, 281, 282, 283, 284, 285, 286, 265, 0,
896 -1, -1, 269, -1, 271, 272, 273, 265, -1, 276,
897 277, 269, -1, 271, 281, 282, 283, 284, 285, 286,
898 -1, 265, -1, -1, -1, 269, -1, 271, 272, 273,
899 -1, -1, 276, 277, -1, -1, -1, 281, 282, 283,
900 284, 285, 286, 265, -1, -1, -1, 269, -1, 271,
901 272, 273, -1, -1, 276, 277, -1, -1, -1, 281,
902 282, 283, 284, 285, 286, -1, -1, -1, -1, -1,
903 -1, -1, -1, 265, -1, -1, -1, 269, -1, 271,
904 272, 273, -1, -1, -1, -1, -1, -1, -1, 281,
905 282, 283, 284, 285, 286, -1, -1, -1, -1, -1,
906 -1, 265, -1, -1, -1, 269, -1, 271, 272, 273,
907 -1, -1, -1, -1, -1, -1, -1, 281, 282, 283,
908 284, 285, 286, 265, -1, -1, -1, 269, -1, 271,
909 272, 273, -1, -1, -1, -1, -1, -1, -1, 281,
910 282, 283, 284, 285, 286, 265, -1, -1, -1, 269,
911 -1, 271, 272, 273, -1, -1, -1, -1, -1, -1,
912 -1, 281, 282, 283, 284, 285, 286, 265, -1, -1,
913 -1, 269, -1, 271, 272, 273, -1, -1, -1, -1,
914 -1, -1, -1, 281, 282, 283, 284, 285, 286, 265,
915 -1, -1, -1, 269, -1, 271, 272, 273, -1, -1,
916 -1, -1, -1, -1, -1, 281, 282, -1, -1, -1,
917 -1, 265, -1, -1, -1, 269, -1, 271, 272, 273,
918 -1, -1, -1, -1, -1, -1, -1, 281, 282, -1,
919 -1, -1, -1, 265, -1, -1, -1, 269, -1, 271,
920 272, 273, -1, -1, -1, -1, -1, -1, -1, 281,
921 282, -1, -1, -1, -1, 265, -1, -1, -1, 269,
922 -1, 271, 272, 273, 265, -1, -1, -1, 269, -1,
926 // line 391 "Parser.jay"
931 public interface yyDebug {
932 void push (int state, Object value);
933 void lex (int state, int token, string name, Object value);
934 void shift (int from, int to, int errorFlag);
935 void pop (int state);
936 void discard (int state, int token, string name, Object value);
937 void reduce (int from, int to, int rule, string text, int len);
938 void shift (int from, int to);
939 void accept (Object value);
940 void error (string message);
944 class yyDebugSimple : yyDebug {
945 void println (string s){
946 Console.WriteLine (s);
949 public void push (int state, Object value) {
950 println ("push\tstate "+state+"\tvalue "+value);
953 public void lex (int state, int token, string name, Object value) {
954 println("lex\tstate "+state+"\treading "+name+"\tvalue "+value);
957 public void shift (int from, int to, int errorFlag) {
960 println("shift\tfrom state "+from+" to "+to);
962 case 0: case 1: case 2: // in error recovery
963 println("shift\tfrom state "+from+" to "+to
964 +"\t"+errorFlag+" left to recover");
967 println("shift\tfrom state "+from+" to "+to+"\ton error");
972 public void pop (int state) {
973 println("pop\tstate "+state+"\ton error");
976 public void discard (int state, int token, string name, Object value) {
977 println("discard\tstate "+state+"\ttoken "+name+"\tvalue "+value);
980 public void reduce (int from, int to, int rule, string text, int len) {
981 println("reduce\tstate "+from+"\tuncover "+to
982 +"\trule ("+rule+") "+text);
985 public void shift (int from, int to) {
986 println("goto\tfrom state "+from+" to "+to);
989 public void accept (Object value) {
990 println("accept\tvalue "+value);
993 public void error (string message) {
994 println("error\t"+message);
997 public void reject () {
1005 public const int ERROR = 257;
1006 public const int EOF = 258;
1007 public const int SLASH = 259;
1008 public const int SLASH2 = 260;
1009 public const int DOT = 261;
1010 public const int DOT2 = 262;
1011 public const int COLON = 263;
1012 public const int COLON2 = 264;
1013 public const int COMMA = 265;
1014 public const int AT = 266;
1015 public const int FUNCTION_NAME = 267;
1016 public const int BRACKET_OPEN = 268;
1017 public const int BRACKET_CLOSE = 269;
1018 public const int PAREN_OPEN = 270;
1019 public const int PAREN_CLOSE = 271;
1020 public const int AND = 272;
1021 public const int OR = 273;
1022 public const int DIV = 274;
1023 public const int MOD = 275;
1024 public const int PLUS = 276;
1025 public const int MINUS = 277;
1026 public const int ASTERISK = 278;
1027 public const int DOLLAR = 279;
1028 public const int BAR = 280;
1029 public const int EQ = 281;
1030 public const int NE = 282;
1031 public const int LE = 283;
1032 public const int GE = 284;
1033 public const int LT = 285;
1034 public const int GT = 286;
1035 public const int ANCESTOR = 287;
1036 public const int ANCESTOR_OR_SELF = 288;
1037 public const int ATTRIBUTE = 289;
1038 public const int CHILD = 290;
1039 public const int DESCENDANT = 291;
1040 public const int DESCENDANT_OR_SELF = 292;
1041 public const int FOLLOWING = 293;
1042 public const int FOLLOWING_SIBLING = 294;
1043 public const int NAMESPACE = 295;
1044 public const int PARENT = 296;
1045 public const int PRECEDING = 297;
1046 public const int PRECEDING_SIBLING = 298;
1047 public const int SELF = 299;
1048 public const int COMMENT = 300;
1049 public const int TEXT = 301;
1050 public const int PROCESSING_INSTRUCTION = 302;
1051 public const int NODE = 303;
1052 public const int NUMBER = 304;
1053 public const int LITERAL = 305;
1054 public const int NCName = 306;
1055 public const int yyErrorCode = 256;
1057 namespace yyParser {
1059 /** thrown for irrecoverable syntax errors and stack overflow.
1061 public class yyException : System.Exception {
1062 public yyException (string message) : base (message) {
1066 /** must be implemented by a scanner object to supply input to the parser.
1068 public interface yyInput {
1069 /** move on to next token.
1070 @return false if positioned beyond tokens.
1071 @throws IOException on input error.
1073 bool advance (); // throws java.io.IOException;
1074 /** classifies current token.
1075 Should not be called if advance() returned false.
1076 @return current %token or single character.
1079 /** associated with current token.
1080 Should not be called if advance() returned false.
1081 @return value for token().
1086 } // close outermost namespace, that MUST HAVE BEEN opened in the prolog