1 // created by jay 0.8 (c) 1998 Axel.Schreiner@informatik.uni-osnabrueck.de
2 
3 					// line 2 "XPathParser.y"
4 /* XPathParser.y - An XPath 1.0 parser.
5    Copyright (C) 2004 The Free Software Foundation
6 
7 This file is part of GNU Classpath.
8 
9 GNU Classpath is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13 
14 GNU Classpath is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with GNU Classpath; see the file COPYING.  If not, write to the
21 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 02110-1301 USA.
23 
24 Linking this library statically or dynamically with other modules is
25 making a combined work based on this library.  Thus, the terms and
26 conditions of the GNU General Public License cover the whole
27 combination.
28 
29 As a special exception, the copyright holders of this library give you
30 permission to link this library with independent modules to produce an
31 executable, regardless of the license terms of these independent
32 modules, and to copy and distribute the resulting executable under
33 terms of your choice, provided that you also meet, for each linked
34 independent module, the terms and conditions of the license of that
35 module.  An independent module is a module which is not derived from
36 or based on this library.  If you modify this library, you may extend
37 this exception to your version of the library, but you are not
38 obligated to do so.  If you do not wish to do so, delete this
39 exception statement from your version. */
40 
41 
42 package gnu.xml.xpath;
43 
44 import java.util.ArrayList;
45 import java.util.Collections;
46 import java.util.List;
47 import java.util.Map;
48 import javax.xml.namespace.NamespaceContext;
49 import javax.xml.namespace.QName;
50 import javax.xml.xpath.XPathFunctionResolver;
51 import javax.xml.xpath.XPathVariableResolver;
52 import org.w3c.dom.Node;
53 
54 /**
55  * An XPath 1.0 parser.
56  *
57  * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
58  */
59 public class XPathParser
60 {
61 
62   NamespaceContext namespaceContext;
63   XPathVariableResolver variableResolver;
64   XPathFunctionResolver functionResolver;
65 
getQName(String name)66   QName getQName(String name)
67   {
68     QName qName = QName.valueOf(name);
69     if (namespaceContext != null)
70       {
71         String prefix = qName.getPrefix();
72         String uri = qName.getNamespaceURI();
73         if (prefix != null && (uri == null || uri.length() == 0))
74           {
75             uri = namespaceContext.getNamespaceURI(prefix);
76             String localName = qName.getLocalPart();
77             qName = new QName(uri, localName, prefix);
78           }
79       }
80     return qName;
81   }
82 
lookupFunction(String name, List args)83   Expr lookupFunction(String name, List args)
84   {
85     int arity = args.size();
86     if ("position".equals(name) && arity == 0)
87       {
88         return new PositionFunction();
89       }
90     else if ("last".equals(name) && arity == 0)
91       {
92         return new LastFunction();
93       }
94     else if ("string".equals(name) && (arity == 1 || arity == 0))
95       {
96         return new StringFunction(args);
97       }
98     else if ("number".equals(name) && (arity == 1 || arity == 0))
99       {
100         return new NumberFunction(args);
101       }
102     else if ("boolean".equals(name) && arity == 1)
103       {
104         return new BooleanFunction(args);
105       }
106     else if ("count".equals(name) && arity == 1)
107       {
108         return new CountFunction(args);
109       }
110     else if ("not".equals(name) && arity == 1)
111       {
112         return new NotFunction(args);
113       }
114     else if ("id".equals(name) && arity == 1)
115       {
116         return new IdFunction(args);
117       }
118     else if ("concat".equals(name) && arity > 1)
119       {
120         return new ConcatFunction(args);
121       }
122     else if ("true".equals(name) && arity == 0)
123       {
124         return new TrueFunction();
125       }
126     else if ("false".equals(name) && arity == 0)
127       {
128         return new FalseFunction();
129       }
130     else if ("name".equals(name) && (arity == 1 || arity == 0))
131       {
132         return new NameFunction(args);
133       }
134     else if ("local-name".equals(name) && (arity == 1 || arity == 0))
135       {
136         return new LocalNameFunction(args);
137       }
138     else if ("namespace-uri".equals(name) && (arity == 1 || arity == 0))
139       {
140         return new NamespaceUriFunction(args);
141       }
142     else if ("starts-with".equals(name) && arity == 2)
143       {
144         return new StartsWithFunction(args);
145       }
146     else if ("contains".equals(name) && arity == 2)
147       {
148         return new ContainsFunction(args);
149       }
150     else if ("string-length".equals(name) && (arity == 1 || arity == 0))
151       {
152         return new StringLengthFunction(args);
153       }
154     else if ("translate".equals(name) && arity == 3)
155       {
156         return new TranslateFunction(args);
157       }
158     else if ("normalize-space".equals(name) && (arity == 1 || arity == 0))
159       {
160         return new NormalizeSpaceFunction(args);
161       }
162     else if ("substring".equals(name) && (arity == 2 || arity == 3))
163       {
164         return new SubstringFunction(args);
165       }
166     else if ("substring-before".equals(name) && arity == 2)
167       {
168         return new SubstringBeforeFunction(args);
169       }
170     else if ("substring-after".equals(name) && arity == 2)
171       {
172         return new SubstringAfterFunction(args);
173       }
174     else if ("lang".equals(name) && arity == 1)
175       {
176         return new LangFunction(args);
177       }
178     else if ("sum".equals(name) && arity == 1)
179       {
180         return new SumFunction(args);
181       }
182     else if ("floor".equals(name) && arity == 1)
183       {
184         return new FloorFunction(args);
185       }
186     else if ("ceiling".equals(name) && arity == 1)
187       {
188         return new CeilingFunction(args);
189       }
190     else if ("round".equals(name) && arity == 1)
191       {
192         return new RoundFunction(args);
193       }
194     else if (functionResolver != null)
195       {
196         QName qName = QName.valueOf(name);
197         Object function = functionResolver.resolveFunction(qName, arity);
198         if (function != null &&
199             function instanceof Function &&
200             function instanceof Expr)
201           {
202             Function f = (Function) function;
203             f.setArguments(args);
204             return (Expr) function;
205           }
206       }
207     return new FunctionCall(functionResolver, name, args);
208   }
209 
210 					// line 211 "-"
211 // %token constants
212 
213   public static final int LITERAL = 257;
214   public static final int DIGITS = 258;
215   public static final int NAME = 259;
216   public static final int LP = 260;
217   public static final int RP = 261;
218   public static final int LB = 262;
219   public static final int RB = 263;
220   public static final int COMMA = 264;
221   public static final int PIPE = 265;
222   public static final int SLASH = 266;
223   public static final int DOUBLE_SLASH = 267;
224   public static final int EQ = 268;
225   public static final int NE = 269;
226   public static final int GT = 270;
227   public static final int LT = 271;
228   public static final int GTE = 272;
229   public static final int LTE = 273;
230   public static final int PLUS = 274;
231   public static final int MINUS = 275;
232   public static final int AT = 276;
233   public static final int STAR = 277;
234   public static final int DOLLAR = 278;
235   public static final int COLON = 279;
236   public static final int DOUBLE_COLON = 280;
237   public static final int DOT = 281;
238   public static final int DOUBLE_DOT = 282;
239   public static final int ANCESTOR = 283;
240   public static final int ANCESTOR_OR_SELF = 284;
241   public static final int ATTRIBUTE = 285;
242   public static final int CHILD = 286;
243   public static final int DESCENDANT = 287;
244   public static final int DESCENDANT_OR_SELF = 288;
245   public static final int FOLLOWING = 289;
246   public static final int FOLLOWING_SIBLING = 290;
247   public static final int NAMESPACE = 291;
248   public static final int PARENT = 292;
249   public static final int PRECEDING = 293;
250   public static final int PRECEDING_SIBLING = 294;
251   public static final int SELF = 295;
252   public static final int DIV = 296;
253   public static final int MOD = 297;
254   public static final int OR = 298;
255   public static final int AND = 299;
256   public static final int COMMENT = 300;
257   public static final int PROCESSING_INSTRUCTION = 301;
258   public static final int TEXT = 302;
259   public static final int NODE = 303;
260   public static final int UNARY = 304;
261   public static final int yyErrorCode = 256;
262 
263   /** thrown for irrecoverable syntax errors and stack overflow.
264     */
265   public static class yyException extends java.lang.Exception {
yyException(String message)266     public yyException (String message) {
267       super(message);
268     }
269   }
270 
271   /** must be implemented by a scanner object to supply input to the parser.
272     */
273   public interface yyInput {
274     /** move on to next token.
275         @return false if positioned beyond tokens.
276         @throws IOException on input error.
277       */
advance()278     boolean advance () throws java.io.IOException;
279     /** classifies current token.
280         Should not be called if advance() returned false.
281         @return current %token or single character.
282       */
token()283     int token ();
284     /** associated with current token.
285         Should not be called if advance() returned false.
286         @return value for token().
287       */
value()288     Object value ();
289   }
290 
291   /** simplified error message.
292       @see <a href="#yyerror(java.lang.String, java.lang.String[])">yyerror</a>
293     */
yyerror(String message)294   public void yyerror (String message) {
295     yyerror(message, null);
296   }
297 
298   /** (syntax) error message.
299       Can be overwritten to control message format.
300       @param message text to be displayed.
301       @param expected vector of acceptable tokens, if available.
302     */
yyerror(String message, String[] expected)303   public void yyerror (String message, String[] expected) {
304     if (expected != null && expected.length > 0) {
305       System.err.print(message+", expecting");
306       for (int n = 0; n < expected.length; ++ n)
307         System.err.print(" "+expected[n]);
308       System.err.println();
309     } else
310       System.err.println(message);
311   }
312 
313   /** debugging support, requires the package jay.yydebug.
314       Set to null to suppress debugging messages.
315     */
316 //t  protected jay.yydebug.yyDebug yydebug;
317 
318   protected static final int yyFinal = 30;
319 
320   /** index-checked interface to yyName[].
321       @param token single character or %token value.
322       @return token name or [illegal] or [unknown].
323     */
324 //t  public static final String yyname (int token) {
325 //t    if (token < 0 || token > YyNameClass.yyName.length) return "[illegal]";
326 //t    String name;
327 //t    if ((name = YyNameClass.yyName[token]) != null) return name;
328 //t    return "[unknown]";
329 //t  }
330 
331   /** computes list of expected tokens on error by tracing the tables.
332       @param state for which to compute the list.
333       @return list of token names.
334     */
yyExpecting(int state)335   protected String[] yyExpecting (int state) {
336     int token, n, len = 0;
337     boolean[] ok = new boolean[YyNameClass.yyName.length];
338 
339     if ((n = YySindexClass.yySindex[state]) != 0)
340       for (token = n < 0 ? -n : 0;
341            token < YyNameClass.yyName.length && n+token < YyTableClass.yyTable.length; ++ token)
342         if (YyCheckClass.yyCheck[n+token] == token && !ok[token] && YyNameClass.yyName[token] != null) {
343           ++ len;
344           ok[token] = true;
345         }
346     if ((n = YyRindexClass.yyRindex[state]) != 0)
347       for (token = n < 0 ? -n : 0;
348            token < YyNameClass.yyName.length && n+token < YyTableClass.yyTable.length; ++ token)
349         if (YyCheckClass.yyCheck[n+token] == token && !ok[token] && YyNameClass.yyName[token] != null) {
350           ++ len;
351           ok[token] = true;
352         }
353 
354     String result[] = new String[len];
355     for (n = token = 0; n < len;  ++ token)
356       if (ok[token]) result[n++] = YyNameClass.yyName[token];
357     return result;
358   }
359 
360   /** the generated parser, with debugging messages.
361       Maintains a state and a value stack, currently with fixed maximum size.
362       @param yyLex scanner.
363       @param yydebug debug message writer implementing yyDebug, or null.
364       @return result of the last reduction, if any.
365       @throws yyException on irrecoverable parse error.
366     */
yyparse(yyInput yyLex, Object yydebug)367   public Object yyparse (yyInput yyLex, Object yydebug)
368 				throws java.io.IOException, yyException {
369 //t    this.yydebug = (jay.yydebug.yyDebug)yydebug;
370     return yyparse(yyLex);
371   }
372 
373   /** initial size and increment of the state/value stack [default 256].
374       This is not final so that it can be overwritten outside of invocations
375       of yyparse().
376     */
377   protected int yyMax;
378 
379   /** executed at the beginning of a reduce action.
380       Used as $$ = yyDefault($1), prior to the user-specified action, if any.
381       Can be overwritten to provide deep copy, etc.
382       @param first value for $1, or null.
383       @return first.
384     */
yyDefault(Object first)385   protected Object yyDefault (Object first) {
386     return first;
387   }
388 
389   /** the generated parser.
390       Maintains a state and a value stack, currently with fixed maximum size.
391       @param yyLex scanner.
392       @return result of the last reduction, if any.
393       @throws yyException on irrecoverable parse error.
394     */
yyparse(yyInput yyLex)395   public Object yyparse (yyInput yyLex)
396 				throws java.io.IOException, yyException {
397     if (yyMax <= 0) yyMax = 256;			// initial size
398     int yyState = 0, yyStates[] = new int[yyMax];	// state stack
399     Object yyVal = null, yyVals[] = new Object[yyMax];	// value stack
400     int yyToken = -1;					// current input
401     int yyErrorFlag = 0;				// #tks to shift
402 
403     yyLoop: for (int yyTop = 0;; ++ yyTop) {
404       if (yyTop >= yyStates.length) {			// dynamically increase
405         int[] i = new int[yyStates.length+yyMax];
406         System.arraycopy(yyStates, 0, i, 0, yyStates.length);
407         yyStates = i;
408         Object[] o = new Object[yyVals.length+yyMax];
409         System.arraycopy(yyVals, 0, o, 0, yyVals.length);
410         yyVals = o;
411       }
412       yyStates[yyTop] = yyState;
413       yyVals[yyTop] = yyVal;
414 //t      if (yydebug != null) yydebug.push(yyState, yyVal);
415 
416       yyDiscarded: for (;;) {	// discarding a token does not change stack
417         int yyN;
418         if ((yyN = YyDefRedClass.yyDefRed[yyState]) == 0) {	// else [default] reduce (yyN)
419           if (yyToken < 0) {
420             yyToken = yyLex.advance() ? yyLex.token() : 0;
421 //t            if (yydebug != null)
422 //t              yydebug.lex(yyState, yyToken, yyname(yyToken), yyLex.value());
423           }
424           if ((yyN = YySindexClass.yySindex[yyState]) != 0 && (yyN += yyToken) >= 0
425               && yyN < YyTableClass.yyTable.length && YyCheckClass.yyCheck[yyN] == yyToken) {
426 //t            if (yydebug != null)
427 //t              yydebug.shift(yyState, YyTableClass.yyTable[yyN], yyErrorFlag-1);
428             yyState = YyTableClass.yyTable[yyN];		// shift to yyN
429             yyVal = yyLex.value();
430             yyToken = -1;
431             if (yyErrorFlag > 0) -- yyErrorFlag;
432             continue yyLoop;
433           }
434           if ((yyN = YyRindexClass.yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0
435               && yyN < YyTableClass.yyTable.length && YyCheckClass.yyCheck[yyN] == yyToken)
436             yyN = YyTableClass.yyTable[yyN];			// reduce (yyN)
437           else
438             switch (yyErrorFlag) {
439 
440             case 0:
441               yyerror("syntax error", yyExpecting(yyState));
442 //t              if (yydebug != null) yydebug.error("syntax error");
443 
444             case 1: case 2:
445               yyErrorFlag = 3;
446               do {
447                 if ((yyN = YySindexClass.yySindex[yyStates[yyTop]]) != 0
448                     && (yyN += yyErrorCode) >= 0 && yyN < YyTableClass.yyTable.length
449                     && YyCheckClass.yyCheck[yyN] == yyErrorCode) {
450 //t                  if (yydebug != null)
451 //t                    yydebug.shift(yyStates[yyTop], YyTableClass.yyTable[yyN], 3);
452                   yyState = YyTableClass.yyTable[yyN];
453                   yyVal = yyLex.value();
454                   continue yyLoop;
455                 }
456 //t                if (yydebug != null) yydebug.pop(yyStates[yyTop]);
457               } while (-- yyTop >= 0);
458 //t              if (yydebug != null) yydebug.reject();
459               throw new yyException("irrecoverable syntax error");
460 
461             case 3:
462               if (yyToken == 0) {
463 //t                if (yydebug != null) yydebug.reject();
464                 throw new yyException("irrecoverable syntax error at end-of-file");
465               }
466 //t              if (yydebug != null)
467 //t                yydebug.discard(yyState, yyToken, yyname(yyToken),
468 //t  							yyLex.value());
469               yyToken = -1;
470               continue yyDiscarded;		// leave stack alone
471             }
472         }
473         int yyV = yyTop + 1-YyLenClass.yyLen[yyN];
474 //t        if (yydebug != null)
475 //t          yydebug.reduce(yyState, yyStates[yyV-1], yyN, YyRuleClass.yyRule[yyN], YyLenClass.yyLen[yyN]);
476         yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
477         switch (yyN) {
478 case 4:
479 					// line 277 "XPathParser.y"
480   {
481       yyVal = new Root();
482     }
483   break;
484 case 5:
485 					// line 281 "XPathParser.y"
486   {
487       Steps steps;
488       if (yyVals[0+yyTop] instanceof Steps)
489         {
490           steps = (Steps) yyVals[0+yyTop];
491         }
492       else
493         {
494           steps = new Steps();
495           steps.path.addFirst(yyVals[0+yyTop]);
496         }
497       steps.path.addFirst(new Root());
498       yyVal = steps;
499       /*$$ = new Step(new Root(), (Path) $2);*/
500     }
501   break;
502 case 6:
503 					// line 297 "XPathParser.y"
504   {
505       Test nt = new NodeTypeTest((short) 0);
506       Selector s = new Selector(Selector.DESCENDANT_OR_SELF,
507                                 Collections.singletonList (nt));
508       Steps steps;
509       if (yyVals[0+yyTop] instanceof Steps)
510         {
511           steps = (Steps) yyVals[0+yyTop];
512         }
513       else
514         {
515           steps = new Steps();
516           steps.path.addFirst(yyVals[0+yyTop]);
517         }
518       steps.path.addFirst(s);
519       steps.path.addFirst(new Root());
520       yyVal = steps;
521       /*Step step = new Step(s, (Path) $2);*/
522       /*$$ = new Step(new Root(), step);*/
523     }
524   break;
525 case 8:
526 					// line 322 "XPathParser.y"
527   {
528       Steps steps;
529       if (yyVals[-2+yyTop] instanceof Steps)
530         {
531           steps = (Steps) yyVals[-2+yyTop];
532         }
533       else
534         {
535           steps = new Steps();
536           steps.path.addFirst(yyVals[-2+yyTop]);
537         }
538       steps.path.addLast(yyVals[0+yyTop]);
539       yyVal = steps;
540       /*$$ = new Step((Expr) $1, (Path) $3);*/
541     }
542   break;
543 case 9:
544 					// line 338 "XPathParser.y"
545   {
546       Test nt = new NodeTypeTest((short) 0);
547       Selector s = new Selector(Selector.DESCENDANT_OR_SELF,
548                                 Collections.singletonList (nt));
549       Steps steps;
550       if (yyVals[-2+yyTop] instanceof Steps)
551         {
552           steps = (Steps) yyVals[-2+yyTop];
553         }
554       else
555         {
556           steps = new Steps();
557           steps.path.addFirst(yyVals[-2+yyTop]);
558         }
559       steps.path.addLast(s);
560       steps.path.addLast(yyVals[0+yyTop]);
561       yyVal = steps;
562       /*Step step = new Step(s, (Path) $3);*/
563       /*$$ = new Step((Expr) $1, step);*/
564     }
565   break;
566 case 10:
567 					// line 362 "XPathParser.y"
568   {
569       yyVal = new Selector (Selector.CHILD, (List) yyVals[0+yyTop]);
570     }
571   break;
572 case 11:
573 					// line 366 "XPathParser.y"
574   {
575       yyVal = new Selector (Selector.ATTRIBUTE, (List) yyVals[0+yyTop]);
576     }
577   break;
578 case 12:
579 					// line 370 "XPathParser.y"
580   {
581       yyVal = new Selector (((Integer) yyVals[-2+yyTop]).intValue (), (List) yyVals[0+yyTop]);
582     }
583   break;
584 case 13:
585 					// line 374 "XPathParser.y"
586   {
587       yyVal = new Selector (Selector.SELF, Collections.EMPTY_LIST);
588     }
589   break;
590 case 14:
591 					// line 378 "XPathParser.y"
592   {
593       yyVal = new Selector (Selector.PARENT, Collections.EMPTY_LIST);
594     }
595   break;
596 case 15:
597 					// line 385 "XPathParser.y"
598   {
599       List list = new ArrayList();
600       list.add(yyVals[0+yyTop]);
601       yyVal = list;
602     }
603   break;
604 case 16:
605 					// line 391 "XPathParser.y"
606   {
607       List list = (List)yyVals[-1+yyTop];
608       list.add(yyVals[0+yyTop]);
609       yyVal = list;
610     }
611   break;
612 case 17:
613 					// line 415 "XPathParser.y"
614   {
615       yyVal = new Integer(Selector.ANCESTOR);
616     }
617   break;
618 case 18:
619 					// line 419 "XPathParser.y"
620   {
621       yyVal = new Integer(Selector.ANCESTOR_OR_SELF);
622     }
623   break;
624 case 19:
625 					// line 423 "XPathParser.y"
626   {
627       yyVal = new Integer(Selector.ATTRIBUTE);
628     }
629   break;
630 case 20:
631 					// line 427 "XPathParser.y"
632   {
633       yyVal = new Integer(Selector.CHILD);
634     }
635   break;
636 case 21:
637 					// line 431 "XPathParser.y"
638   {
639       yyVal = new Integer(Selector.DESCENDANT);
640     }
641   break;
642 case 22:
643 					// line 435 "XPathParser.y"
644   {
645       yyVal = new Integer(Selector.DESCENDANT_OR_SELF);
646     }
647   break;
648 case 23:
649 					// line 439 "XPathParser.y"
650   {
651       yyVal = new Integer(Selector.FOLLOWING);
652     }
653   break;
654 case 24:
655 					// line 443 "XPathParser.y"
656   {
657       yyVal = new Integer(Selector.FOLLOWING_SIBLING);
658     }
659   break;
660 case 25:
661 					// line 447 "XPathParser.y"
662   {
663       yyVal = new Integer(Selector.NAMESPACE);
664     }
665   break;
666 case 26:
667 					// line 451 "XPathParser.y"
668   {
669       yyVal = new Integer(Selector.PARENT);
670     }
671   break;
672 case 27:
673 					// line 455 "XPathParser.y"
674   {
675       yyVal = new Integer(Selector.PRECEDING);
676     }
677   break;
678 case 28:
679 					// line 459 "XPathParser.y"
680   {
681       yyVal = new Integer(Selector.PRECEDING_SIBLING);
682     }
683   break;
684 case 29:
685 					// line 463 "XPathParser.y"
686   {
687       yyVal = new Integer(Selector.SELF);
688     }
689   break;
690 case 31:
691 					// line 472 "XPathParser.y"
692   {
693       yyVal = new NodeTypeTest(Node.PROCESSING_INSTRUCTION_NODE, (String) yyVals[-1+yyTop]);
694     }
695   break;
696 case 32:
697 					// line 477 "XPathParser.y"
698   {
699       yyVal = new NodeTypeTest(((Short) yyVals[-1+yyTop]).shortValue());
700     }
701   break;
702 case 33:
703 					// line 484 "XPathParser.y"
704   {
705       yyVal = new Predicate((Expr) yyVals[-1+yyTop]);
706     }
707   break;
708 case 35:
709 					// line 492 "XPathParser.y"
710   {
711       yyVal = new ParenthesizedExpr((Expr) yyVals[-1+yyTop]);
712     }
713   break;
714 case 36:
715 					// line 496 "XPathParser.y"
716   {
717       yyVal = new Constant(yyVals[0+yyTop]);
718     }
719   break;
720 case 37:
721 					// line 500 "XPathParser.y"
722   {
723       yyVal = new Constant(yyVals[0+yyTop]);
724     }
725   break;
726 case 39:
727 					// line 508 "XPathParser.y"
728   {
729       yyVal = lookupFunction((String) yyVals[-2+yyTop], Collections.EMPTY_LIST);
730     }
731   break;
732 case 40:
733 					// line 512 "XPathParser.y"
734   {
735       yyVal = lookupFunction((String) yyVals[-3+yyTop], (List) yyVals[-1+yyTop]);
736     }
737   break;
738 case 41:
739 					// line 519 "XPathParser.y"
740   {
741       List list = new ArrayList();
742       list.add(yyVals[0+yyTop]);
743       yyVal = list;
744     }
745   break;
746 case 42:
747 					// line 525 "XPathParser.y"
748   {
749       List list = (List) yyVals[0+yyTop];
750       list.add(0, yyVals[-2+yyTop]);
751       yyVal = list;
752     }
753   break;
754 case 44:
755 					// line 535 "XPathParser.y"
756   {
757       yyVal = new UnionExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop]);
758     }
759   break;
760 case 47:
761 					// line 544 "XPathParser.y"
762   {
763       Steps steps;
764       if (yyVals[0+yyTop] instanceof Steps)
765         {
766           steps = (Steps) yyVals[0+yyTop];
767         }
768       else
769         {
770           steps = new Steps();
771           steps.path.addFirst(yyVals[0+yyTop]);
772         }
773       steps.path.addFirst(yyVals[-2+yyTop]);
774       yyVal = steps;
775       /*$$ = new Step ((Expr) $1, (Path) $3);*/
776     }
777   break;
778 case 48:
779 					// line 560 "XPathParser.y"
780   {
781       Test nt = new NodeTypeTest((short) 0);
782       Selector s = new Selector(Selector.DESCENDANT_OR_SELF,
783                                 Collections.singletonList(nt));
784       Steps steps;
785       if (yyVals[0+yyTop] instanceof Steps)
786         {
787           steps = (Steps) yyVals[0+yyTop];
788         }
789       else
790         {
791           steps = new Steps();
792           steps.path.addFirst(yyVals[0+yyTop]);
793         }
794       steps.path.addFirst(s);
795       steps.path.addFirst(yyVals[-2+yyTop]);
796       yyVal = steps;
797       /*Step step = new Step (s, (Path) $3);*/
798       /*$$ = new Step ((Expr) $1, step);*/
799     }
800   break;
801 case 50:
802 					// line 585 "XPathParser.y"
803   {
804       Predicate filter = (Predicate) yyVals[0+yyTop];
805       Selector s = new Selector(Selector.SELF,
806                                 Collections.singletonList(filter));
807       Steps steps;
808       if (yyVals[-1+yyTop] instanceof Steps)
809         {
810           steps = (Steps) yyVals[-1+yyTop];
811         }
812       else
813         {
814           steps = new Steps();
815           steps.path.addFirst(yyVals[-1+yyTop]);
816         }
817       steps.path.addLast(s);
818       yyVal = steps;
819       /*$$ = new Step ((Expr) $1, s);*/
820     }
821   break;
822 case 52:
823 					// line 608 "XPathParser.y"
824   {
825       yyVal = new OrExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop]);
826     }
827   break;
828 case 54:
829 					// line 616 "XPathParser.y"
830   {
831       yyVal = new AndExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop]);
832     }
833   break;
834 case 56:
835 					// line 624 "XPathParser.y"
836   {
837       yyVal = new EqualityExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], false);
838     }
839   break;
840 case 57:
841 					// line 628 "XPathParser.y"
842   {
843       yyVal = new EqualityExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], true);
844     }
845   break;
846 case 59:
847 					// line 636 "XPathParser.y"
848   {
849       yyVal = new RelationalExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], true, false);
850     }
851   break;
852 case 60:
853 					// line 640 "XPathParser.y"
854   {
855       yyVal = new RelationalExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], false, false);
856     }
857   break;
858 case 61:
859 					// line 644 "XPathParser.y"
860   {
861       yyVal = new RelationalExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], true, true);
862     }
863   break;
864 case 62:
865 					// line 648 "XPathParser.y"
866   {
867       yyVal = new RelationalExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], false, true);
868     }
869   break;
870 case 64:
871 					// line 656 "XPathParser.y"
872   {
873       yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.ADD);
874     }
875   break;
876 case 65:
877 					// line 660 "XPathParser.y"
878   {
879       yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.SUBTRACT);
880     }
881   break;
882 case 67:
883 					// line 668 "XPathParser.y"
884   {
885       yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.MULTIPLY);
886     }
887   break;
888 case 68:
889 					// line 672 "XPathParser.y"
890   {
891       yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.DIVIDE);
892     }
893   break;
894 case 69:
895 					// line 676 "XPathParser.y"
896   {
897       yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.MODULO);
898     }
899   break;
900 case 71:
901 					// line 684 "XPathParser.y"
902   {
903       yyVal = new NegativeExpr((Expr) yyVals[0+yyTop]);
904     }
905   break;
906 case 72:
907 					// line 691 "XPathParser.y"
908   {
909       yyVal = new Double((String) yyVals[0+yyTop] + ".0");
910     }
911   break;
912 case 73:
913 					// line 695 "XPathParser.y"
914   {
915       yyVal = new Double((String) yyVals[-1+yyTop] + ".0");
916     }
917   break;
918 case 74:
919 					// line 699 "XPathParser.y"
920   {
921       yyVal = new Double((String) yyVals[-2+yyTop] + "." + (String) yyVals[0+yyTop]);
922     }
923   break;
924 case 75:
925 					// line 703 "XPathParser.y"
926   {
927       yyVal = new Double("0." + (String) yyVals[0+yyTop]);
928     }
929   break;
930 case 77:
931 					// line 732 "XPathParser.y"
932   {
933       String name = (String) yyVals[0+yyTop];
934       yyVal = new VariableReference(variableResolver, getQName(name));
935     }
936   break;
937 case 78:
938 					// line 740 "XPathParser.y"
939   {
940       yyVal = new NameTest(null, true, true);
941     }
942   break;
943 case 79:
944 					// line 744 "XPathParser.y"
945   {
946       QName qName = getQName((String) yyVals[-2+yyTop]);
947       yyVal = new NameTest(qName, true, false);
948     }
949   break;
950 case 80:
951 					// line 749 "XPathParser.y"
952   {
953       QName qName = getQName((String) yyVals[0+yyTop]);
954       yyVal = new NameTest(qName, false, false);
955     }
956   break;
957 case 82:
958 					// line 758 "XPathParser.y"
959   {
960       yyVal = (String) yyVals[-2+yyTop] + ':' + (String) yyVals[0+yyTop];
961     }
962   break;
963 case 83:
964 					// line 765 "XPathParser.y"
965   {
966       yyVal = new Short(Node.COMMENT_NODE);
967     }
968   break;
969 case 84:
970 					// line 769 "XPathParser.y"
971   {
972       yyVal = new Short(Node.TEXT_NODE);
973     }
974   break;
975 case 85:
976 					// line 773 "XPathParser.y"
977   {
978       yyVal = new Short(Node.PROCESSING_INSTRUCTION_NODE);
979     }
980   break;
981 case 86:
982 					// line 777 "XPathParser.y"
983   {
984       yyVal = new Short((short) 0);
985     }
986   break;
987 					// line 988 "-"
988         }
989         yyTop -= YyLenClass.yyLen[yyN];
990         yyState = yyStates[yyTop];
991         int yyM = YyLhsClass.yyLhs[yyN];
992         if (yyState == 0 && yyM == 0) {
993 //t          if (yydebug != null) yydebug.shift(0, yyFinal);
994           yyState = yyFinal;
995           if (yyToken < 0) {
996             yyToken = yyLex.advance() ? yyLex.token() : 0;
997 //t            if (yydebug != null)
998 //t               yydebug.lex(yyState, yyToken,yyname(yyToken), yyLex.value());
999           }
1000           if (yyToken == 0) {
1001 //t            if (yydebug != null) yydebug.accept(yyVal);
1002             return yyVal;
1003           }
1004           continue yyLoop;
1005         }
1006         if ((yyN = YyGindexClass.yyGindex[yyM]) != 0 && (yyN += yyState) >= 0
1007             && yyN < YyTableClass.yyTable.length && YyCheckClass.yyCheck[yyN] == yyState)
1008           yyState = YyTableClass.yyTable[yyN];
1009         else
1010           yyState = YyDgotoClass.yyDgoto[yyM];
1011 //t        if (yydebug != null) yydebug.shift(yyStates[yyTop], yyState);
1012 	 continue yyLoop;
1013       }
1014     }
1015   }
1016 
1017   protected static final class YyLhsClass {
1018 
1019     public static final short yyLhs [] = {              -1,
1020           0,    2,    2,    4,    4,    4,    3,    3,    3,    5,
1021           5,    5,    5,    5,    6,    6,    7,    7,    7,    7,
1022           7,    7,    7,    7,    7,    7,    7,    7,    7,    8,
1023           8,    8,    9,   12,   12,   12,   12,   12,   15,   15,
1024          17,   17,   18,   18,   19,   19,   19,   19,   20,   20,
1025           1,    1,   21,   21,   22,   22,   22,   23,   23,   23,
1026          23,   23,   24,   24,   24,   25,   25,   25,   25,   26,
1027          26,   14,   14,   14,   14,   16,   13,   10,   10,   10,
1028          27,   27,   11,   11,   11,   11,
1029     };
1030   } /* End of class YyLhsClass */
1031 
1032   protected static final class YyLenClass {
1033 
1034     public static final short yyLen [] = {           2,
1035           1,    1,    1,    1,    2,    2,    1,    3,    3,    1,
1036           2,    3,    1,    1,    1,    2,    1,    1,    1,    1,
1037           1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
1038           3,    2,    3,    1,    3,    1,    1,    1,    3,    4,
1039           1,    3,    1,    3,    1,    1,    3,    3,    1,    2,
1040           1,    3,    1,    3,    1,    3,    3,    1,    3,    3,
1041           3,    3,    1,    3,    3,    1,    3,    3,    3,    1,
1042           2,    1,    2,    3,    2,    1,    2,    1,    3,    1,
1043           1,    3,    1,    1,    1,    1,
1044     };
1045   } /* End class YyLenClass */
1046 
1047   protected static final class YyDefRedClass {
1048 
1049     public static final short yyDefRed [] = {            0,
1050          36,    0,    0,    0,    0,    0,    0,    0,   78,    0,
1051           0,   14,   17,   18,   19,   20,   21,   22,   23,   24,
1052          25,   26,   27,   28,   29,   83,    0,   84,   86,    0,
1053           0,   45,    0,    3,    7,    0,    0,   15,   30,    0,
1054          49,   34,   37,   38,    0,    0,   43,    0,    0,    0,
1055           0,    0,    0,   66,    0,    0,    0,    0,   13,    0,
1056          80,    0,   71,    0,    0,   77,   75,    0,    0,    0,
1057           0,    0,   16,    0,   32,    0,    0,    0,    0,   50,
1058           0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
1059           0,    0,   74,   82,   79,   35,    0,   31,    0,    8,
1060           9,    0,    0,   39,    0,    0,   44,    0,    0,    0,
1061           0,    0,    0,    0,    0,    0,    0,    0,   67,   68,
1062          69,   33,    0,   40,   42,
1063     };
1064   } /* End of class YyDefRedClass */
1065 
1066   protected static final class YyDgotoClass {
1067 
1068     public static final short yyDgoto [] = {           105,
1069          31,   32,   33,   34,   35,   36,   37,   38,   73,   39,
1070          40,   41,   42,   43,   44,   45,  106,   46,   47,   48,
1071          49,   50,   51,   52,   53,   54,   55,
1072     };
1073   } /* End of class YyDgotoClass */
1074 
1075   protected static final class YySindexClass {
1076 
1077     public static final short yySindex [] = {          -97,
1078           0, -271, -267,  -97, -239, -239,  -97, -199,    0, -236,
1079        -222,    0,    0,    0,    0,    0,    0,    0,    0,    0,
1080           0,    0,    0,    0,    0,    0, -218,    0,    0,    0,
1081        -257,    0, -241,    0,    0, -205, -221,    0,    0, -194,
1082           0,    0,    0,    0, -190, -185,    0, -238, -211, -234,
1083        -255, -209, -275,    0,    0, -169, -250, -168,    0, -241,
1084           0, -241,    0, -205, -187,    0,    0, -167,  -97, -239,
1085        -239,  -97,    0, -199,    0, -151,  -43, -239, -239,    0,
1086         -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,
1087         -97,  -97,    0,    0,    0,    0, -164,    0, -211,    0,
1088           0, -166, -205,    0, -165, -163,    0, -241, -241, -234,
1089        -255, -255, -209, -209, -209, -209, -275, -275,    0,    0,
1090           0,    0,  -97,    0,    0,
1091     };
1092   } /* End of class YySindexClass */
1093 
1094   protected static final class YyRindexClass {
1095 
1096     public static final short yyRindex [] = {            0,
1097           0,   58,    1,    0,  420,    0,    0,    0,    0,    0,
1098         129,    0,    0,    0,    0,    0,    0,    0,    0,    0,
1099           0,    0,    0,    0,    0,    0, -161,    0,    0,    0,
1100          40,    0,  237,    0,    0,  168,    0,    0,    0,    0,
1101           0,    0,    0,    0,    0,  459,    0,  277,  557,  544,
1102         656,  561,  474,    0,   19,   75,    0,    0,    0,  295,
1103           0,  334,    0,  183,  114,    0,    0,    0,    0,    0,
1104           0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
1105           0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
1106           0,    0,    0,    0,    0,    0,    0,    0,  686,    0,
1107           0,    0,  222,    0, -156,    0,    0,  351,  405,  553,
1108         665,  697,  577,  600,  617,  639,  513,  528,    0,    0,
1109           0,    0,    0,    0,    0,
1110     };
1111   } /* End of class YyRindexClass */
1112 
1113   protected static final class YyGindexClass {
1114 
1115     public static final short yyGindex [] = {            7,
1116           0,    0,    8,    0,    3,   -3,    0,    0,   48,    0,
1117           0,    0,    0,    0,    0,    0,  -12,    0,   35,    0,
1118          44,   36,   -1,  -54,    2,   -7,   -2,
1119     };
1120   } /* End of class YyGindexClass */
1121 
1122   protected static final class YyTableClass {
1123 
1124     public static final short yyTable [] = {            63,
1125          81,   90,   61,   61,   64,   61,   30,   66,   94,   56,
1126          58,   57,   60,   62,   84,   85,   86,   87,   80,    3,
1127          91,   92,   65,   72,   70,   71,   95,   78,   79,  113,
1128         114,  115,  116,   82,   83,   67,    8,    9,   68,    1,
1129          69,   59,   12,   13,   14,   15,   16,   17,   18,   19,
1130          20,   21,   22,   23,   24,   25,   72,   72,   74,    3,
1131          26,   27,   28,   29,   88,   89,   75,   61,   61,   76,
1132         103,   61,  100,  101,   73,   61,   61,    9,  102,   77,
1133         111,  112,  119,  120,  121,  108,  109,   81,   93,  117,
1134         118,   97,   96,   98,   94,   80,  122,  124,  123,   85,
1135          26,   27,   28,   29,   41,    1,    2,    3,    4,  104,
1136         125,  107,   99,   81,    5,    6,  110,    0,    0,    0,
1137           0,    0,    0,    7,    8,    9,   10,    0,   13,   11,
1138          12,   13,   14,   15,   16,   17,   18,   19,   20,   21,
1139          22,   23,   24,   25,    0,    0,    0,    0,   26,   27,
1140          28,   29,    0,    0,    0,    0,    0,    0,    0,    1,
1141           2,    3,    4,    0,    0,    0,    0,   10,    5,    6,
1142           0,    0,    0,    0,    0,    0,    0,    7,    8,    9,
1143          10,    0,   11,   11,   12,   13,   14,   15,   16,   17,
1144          18,   19,   20,   21,   22,   23,   24,   25,    0,    0,
1145           0,    0,   26,   27,   28,   29,    0,    0,    0,    0,
1146           0,    0,    0,    1,    2,    3,    4,    0,    0,    0,
1147           0,   12,    5,    6,    0,    0,    0,    0,    0,    0,
1148           0,    0,    8,    9,   10,    0,    2,   11,   12,   13,
1149          14,   15,   16,   17,   18,   19,   20,   21,   22,   23,
1150          24,   25,    0,    0,    0,    0,   26,   27,   28,   29,
1151          81,   81,   81,   81,   81,   81,   81,   81,   81,   81,
1152          81,   81,   81,   81,   81,   81,   46,   81,   76,   80,
1153          80,   80,   80,   80,   80,   80,   80,   80,   80,   80,
1154          80,   80,   80,   80,    5,   80,   81,   81,   81,   81,
1155           1,    0,    1,    1,    0,    0,    0,    0,    0,    0,
1156           0,    0,    0,    0,   80,   80,   80,   80,   72,   72,
1157          72,   72,   72,   72,   72,   72,   72,   72,   72,   72,
1158          72,   72,   72,    6,   72,   73,   73,   73,   73,   73,
1159          73,   73,   73,   73,   73,   73,   73,   73,   73,   73,
1160          47,   73,    0,   72,   72,   72,   72,    0,    0,    0,
1161           0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
1162          73,   73,   73,   73,   81,   81,   81,   81,   81,   81,
1163          81,   81,   81,   81,   81,   81,   81,   81,   81,   13,
1164          81,   13,   13,   13,   13,   13,   13,   13,   13,   13,
1165          13,   13,   13,   13,   48,   13,    0,    0,    0,   81,
1166          81,   81,   81,    0,    0,    0,    0,    0,    0,    4,
1167           0,    0,    0,    0,   13,   13,   13,   13,   10,    0,
1168          10,   10,   10,   10,   10,   10,   10,   10,   10,   10,
1169          10,   10,   10,   11,   10,   11,   11,   11,   11,   11,
1170          11,   11,   11,   11,   11,   11,   11,   11,   70,   11,
1171           0,    0,    0,   10,   10,   10,   10,    0,    0,    0,
1172           0,    0,    0,   63,    0,    0,    0,    0,   11,   11,
1173          11,   11,   12,    0,   12,   12,   12,   12,   12,   12,
1174          12,   12,   12,   12,   12,   12,   12,    2,   12,    2,
1175           2,    2,    0,    0,    2,    2,    2,    2,    2,    2,
1176           2,    2,   64,    2,    0,    0,    0,   12,   12,   12,
1177          12,    0,    0,    0,    0,    0,    0,   65,    0,    0,
1178           0,    0,    2,    2,    2,    2,    0,   46,    0,   46,
1179          46,   46,    0,   53,   46,   46,   46,   46,   46,   46,
1180          46,   46,   54,   46,    0,    5,   51,    5,    5,    5,
1181          58,    0,    5,    5,    5,    5,    5,    5,    5,    5,
1182           0,    5,   46,   46,   46,   46,   60,    0,    0,    0,
1183           0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
1184           5,    5,    5,    5,    6,    0,    6,    6,    6,   59,
1185           0,    6,    6,    6,    6,    6,    6,    6,    6,    0,
1186           6,   47,    0,   47,   47,   47,   62,    0,   47,   47,
1187          47,   47,   47,   47,   47,   47,    0,   47,    0,    6,
1188           6,    6,    6,    0,    0,    0,    0,    0,   61,    0,
1189           0,    0,    0,    0,    0,    0,   47,   47,   47,   47,
1190           0,    0,    0,    0,    0,   55,    0,    0,    0,    0,
1191           0,    0,    0,    0,   56,   48,    0,   48,   48,   48,
1192           0,    0,   48,   48,   48,   48,   48,   48,   48,   48,
1193           4,   48,    4,    4,    4,   52,    0,    4,    4,    4,
1194           4,    4,    4,    4,    4,    0,   57,    0,    0,    0,
1195          48,   48,   48,   48,    0,    0,    0,    0,    0,    0,
1196           0,    0,    0,    0,    0,    4,    4,    4,    4,   70,
1197           0,   70,   70,    0,    0,    0,   70,   70,   70,   70,
1198          70,   70,   70,   70,   63,   70,   63,   63,    0,    0,
1199           0,   63,   63,   63,   63,   63,   63,   63,   63,    0,
1200           0,    0,    0,    0,   70,   70,   70,   70,    0,    0,
1201           0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
1202           0,   63,   63,   64,    0,   64,   64,    0,    0,    0,
1203          64,   64,   64,   64,   64,   64,   64,   64,   65,    0,
1204          65,   65,    0,    0,    0,   65,   65,   65,   65,   65,
1205          65,   65,   65,    0,   53,    0,   53,   53,    0,    0,
1206          64,   64,    0,   54,    0,   54,   54,   51,    0,   51,
1207          51,   58,    0,   58,   58,   65,   65,    0,   58,   58,
1208          58,   58,   58,   58,    0,    0,    0,   60,    0,   60,
1209          60,   53,   53,    0,   60,   60,   60,   60,   60,   60,
1210          54,   54,    0,    0,   51,    0,    0,    0,   58,   58,
1211          59,    0,   59,   59,    0,    0,    0,   59,   59,   59,
1212          59,   59,   59,    0,   60,   60,    0,   62,    0,   62,
1213          62,    0,    0,    0,   62,   62,   62,   62,   62,   62,
1214           0,    0,    0,    0,    0,    0,    0,   59,   59,   61,
1215           0,   61,   61,    0,    0,    0,   61,   61,   61,   61,
1216          61,   61,    0,    0,   62,   62,   55,    0,   55,   55,
1217           0,    0,    0,   55,   55,   56,    0,   56,   56,    0,
1218           0,    0,   56,   56,    0,    0,   61,   61,    0,    0,
1219           0,    0,    0,    0,    0,    0,   52,    0,   52,   52,
1220           0,    0,    0,   55,   55,    0,    0,   57,    0,   57,
1221          57,    0,   56,   56,   57,   57,    0,    0,    0,    0,
1222           0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
1223           0,    0,    0,   52,    0,    0,    0,    0,    0,    0,
1224           0,    0,    0,    0,   57,   57,
1225     };
1226   } /* End of class YyTableClass */
1227 
1228   protected static final class YyCheckClass {
1229 
1230     public static final short yyCheck [] = {             7,
1231           0,  277,    5,    6,    8,    8,    0,   10,  259,  281,
1232           4,  279,    5,    6,  270,  271,  272,  273,    0,  259,
1233         296,  297,  259,  262,  266,  267,  277,  266,  267,   84,
1234          85,   86,   87,  268,  269,  258,  276,  277,  257,    0,
1235         298,  281,  282,  283,  284,  285,  286,  287,  288,  289,
1236         290,  291,  292,  293,  294,  295,  262,    0,  280,  259,
1237         300,  301,  302,  303,  274,  275,  261,   70,   71,  260,
1238          74,   74,   70,   71,    0,   78,   79,  277,   72,  265,
1239          82,   83,   90,   91,   92,   78,   79,  299,  258,   88,
1240          89,  279,  261,  261,  259,   48,  263,  261,  264,  261,
1241         300,  301,  302,  303,  261,  257,  258,  259,  260,  261,
1242         123,   77,   69,    0,  266,  267,   81,   -1,   -1,   -1,
1243          -1,   -1,   -1,  275,  276,  277,  278,   -1,    0,  281,
1244         282,  283,  284,  285,  286,  287,  288,  289,  290,  291,
1245         292,  293,  294,  295,   -1,   -1,   -1,   -1,  300,  301,
1246         302,  303,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  257,
1247         258,  259,  260,   -1,   -1,   -1,   -1,    0,  266,  267,
1248          -1,   -1,   -1,   -1,   -1,   -1,   -1,  275,  276,  277,
1249         278,   -1,    0,  281,  282,  283,  284,  285,  286,  287,
1250         288,  289,  290,  291,  292,  293,  294,  295,   -1,   -1,
1251          -1,   -1,  300,  301,  302,  303,   -1,   -1,   -1,   -1,
1252          -1,   -1,   -1,  257,  258,  259,  260,   -1,   -1,   -1,
1253          -1,    0,  266,  267,   -1,   -1,   -1,   -1,   -1,   -1,
1254          -1,   -1,  276,  277,  278,   -1,    0,  281,  282,  283,
1255         284,  285,  286,  287,  288,  289,  290,  291,  292,  293,
1256         294,  295,   -1,   -1,   -1,   -1,  300,  301,  302,  303,
1257         260,  261,  262,  263,  264,  265,  266,  267,  268,  269,
1258         270,  271,  272,  273,  274,  275,    0,  277,  260,  261,
1259         262,  263,  264,  265,  266,  267,  268,  269,  270,  271,
1260         272,  273,  274,  275,    0,  277,  296,  297,  298,  299,
1261         261,   -1,  263,  264,   -1,   -1,   -1,   -1,   -1,   -1,
1262          -1,   -1,   -1,   -1,  296,  297,  298,  299,  261,  262,
1263         263,  264,  265,  266,  267,  268,  269,  270,  271,  272,
1264         273,  274,  275,    0,  277,  261,  262,  263,  264,  265,
1265         266,  267,  268,  269,  270,  271,  272,  273,  274,  275,
1266           0,  277,   -1,  296,  297,  298,  299,   -1,   -1,   -1,
1267          -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
1268         296,  297,  298,  299,  261,  262,  263,  264,  265,  266,
1269         267,  268,  269,  270,  271,  272,  273,  274,  275,  261,
1270         277,  263,  264,  265,  266,  267,  268,  269,  270,  271,
1271         272,  273,  274,  275,    0,  277,   -1,   -1,   -1,  296,
1272         297,  298,  299,   -1,   -1,   -1,   -1,   -1,   -1,    0,
1273          -1,   -1,   -1,   -1,  296,  297,  298,  299,  261,   -1,
1274         263,  264,  265,  266,  267,  268,  269,  270,  271,  272,
1275         273,  274,  275,  261,  277,  263,  264,  265,  266,  267,
1276         268,  269,  270,  271,  272,  273,  274,  275,    0,  277,
1277          -1,   -1,   -1,  296,  297,  298,  299,   -1,   -1,   -1,
1278          -1,   -1,   -1,    0,   -1,   -1,   -1,   -1,  296,  297,
1279         298,  299,  261,   -1,  263,  264,  265,  266,  267,  268,
1280         269,  270,  271,  272,  273,  274,  275,  261,  277,  263,
1281         264,  265,   -1,   -1,  268,  269,  270,  271,  272,  273,
1282         274,  275,    0,  277,   -1,   -1,   -1,  296,  297,  298,
1283         299,   -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,   -1,
1284          -1,   -1,  296,  297,  298,  299,   -1,  261,   -1,  263,
1285         264,  265,   -1,    0,  268,  269,  270,  271,  272,  273,
1286         274,  275,    0,  277,   -1,  261,    0,  263,  264,  265,
1287           0,   -1,  268,  269,  270,  271,  272,  273,  274,  275,
1288          -1,  277,  296,  297,  298,  299,    0,   -1,   -1,   -1,
1289          -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
1290         296,  297,  298,  299,  261,   -1,  263,  264,  265,    0,
1291          -1,  268,  269,  270,  271,  272,  273,  274,  275,   -1,
1292         277,  261,   -1,  263,  264,  265,    0,   -1,  268,  269,
1293         270,  271,  272,  273,  274,  275,   -1,  277,   -1,  296,
1294         297,  298,  299,   -1,   -1,   -1,   -1,   -1,    0,   -1,
1295          -1,   -1,   -1,   -1,   -1,   -1,  296,  297,  298,  299,
1296          -1,   -1,   -1,   -1,   -1,    0,   -1,   -1,   -1,   -1,
1297          -1,   -1,   -1,   -1,    0,  261,   -1,  263,  264,  265,
1298          -1,   -1,  268,  269,  270,  271,  272,  273,  274,  275,
1299         261,  277,  263,  264,  265,    0,   -1,  268,  269,  270,
1300         271,  272,  273,  274,  275,   -1,    0,   -1,   -1,   -1,
1301         296,  297,  298,  299,   -1,   -1,   -1,   -1,   -1,   -1,
1302          -1,   -1,   -1,   -1,   -1,  296,  297,  298,  299,  261,
1303          -1,  263,  264,   -1,   -1,   -1,  268,  269,  270,  271,
1304         272,  273,  274,  275,  261,  277,  263,  264,   -1,   -1,
1305          -1,  268,  269,  270,  271,  272,  273,  274,  275,   -1,
1306          -1,   -1,   -1,   -1,  296,  297,  298,  299,   -1,   -1,
1307          -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
1308          -1,  298,  299,  261,   -1,  263,  264,   -1,   -1,   -1,
1309         268,  269,  270,  271,  272,  273,  274,  275,  261,   -1,
1310         263,  264,   -1,   -1,   -1,  268,  269,  270,  271,  272,
1311         273,  274,  275,   -1,  261,   -1,  263,  264,   -1,   -1,
1312         298,  299,   -1,  261,   -1,  263,  264,  261,   -1,  263,
1313         264,  261,   -1,  263,  264,  298,  299,   -1,  268,  269,
1314         270,  271,  272,  273,   -1,   -1,   -1,  261,   -1,  263,
1315         264,  298,  299,   -1,  268,  269,  270,  271,  272,  273,
1316         298,  299,   -1,   -1,  298,   -1,   -1,   -1,  298,  299,
1317         261,   -1,  263,  264,   -1,   -1,   -1,  268,  269,  270,
1318         271,  272,  273,   -1,  298,  299,   -1,  261,   -1,  263,
1319         264,   -1,   -1,   -1,  268,  269,  270,  271,  272,  273,
1320          -1,   -1,   -1,   -1,   -1,   -1,   -1,  298,  299,  261,
1321          -1,  263,  264,   -1,   -1,   -1,  268,  269,  270,  271,
1322         272,  273,   -1,   -1,  298,  299,  261,   -1,  263,  264,
1323          -1,   -1,   -1,  268,  269,  261,   -1,  263,  264,   -1,
1324          -1,   -1,  268,  269,   -1,   -1,  298,  299,   -1,   -1,
1325          -1,   -1,   -1,   -1,   -1,   -1,  261,   -1,  263,  264,
1326          -1,   -1,   -1,  298,  299,   -1,   -1,  261,   -1,  263,
1327         264,   -1,  298,  299,  268,  269,   -1,   -1,   -1,   -1,
1328          -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
1329          -1,   -1,   -1,  298,   -1,   -1,   -1,   -1,   -1,   -1,
1330          -1,   -1,   -1,   -1,  298,  299,
1331     };
1332   } /* End of class YyCheckClass */
1333 
1334 
1335 //t  protected static final class YyRuleClass {
1336 
1337 //t    public static final String yyRule [] = {
1338 //t    "$accept : expr",
1339 //t    "expr : or_expr",
1340 //t    "location_path : relative_location_path",
1341 //t    "location_path : absolute_location_path",
1342 //t    "absolute_location_path : SLASH",
1343 //t    "absolute_location_path : SLASH relative_location_path",
1344 //t    "absolute_location_path : DOUBLE_SLASH relative_location_path",
1345 //t    "relative_location_path : step",
1346 //t    "relative_location_path : relative_location_path SLASH step",
1347 //t    "relative_location_path : relative_location_path DOUBLE_SLASH step",
1348 //t    "step : step_node_test",
1349 //t    "step : AT step_node_test",
1350 //t    "step : axis_name DOUBLE_COLON step_node_test",
1351 //t    "step : DOT",
1352 //t    "step : DOUBLE_DOT",
1353 //t    "step_node_test : node_test",
1354 //t    "step_node_test : step_node_test predicate",
1355 //t    "axis_name : ANCESTOR",
1356 //t    "axis_name : ANCESTOR_OR_SELF",
1357 //t    "axis_name : ATTRIBUTE",
1358 //t    "axis_name : CHILD",
1359 //t    "axis_name : DESCENDANT",
1360 //t    "axis_name : DESCENDANT_OR_SELF",
1361 //t    "axis_name : FOLLOWING",
1362 //t    "axis_name : FOLLOWING_SIBLING",
1363 //t    "axis_name : NAMESPACE",
1364 //t    "axis_name : PARENT",
1365 //t    "axis_name : PRECEDING",
1366 //t    "axis_name : PRECEDING_SIBLING",
1367 //t    "axis_name : SELF",
1368 //t    "node_test : name_test",
1369 //t    "node_test : PROCESSING_INSTRUCTION LITERAL RP",
1370 //t    "node_test : node_type RP",
1371 //t    "predicate : LB expr RB",
1372 //t    "primary_expr : variable_reference",
1373 //t    "primary_expr : LP expr RP",
1374 //t    "primary_expr : LITERAL",
1375 //t    "primary_expr : number",
1376 //t    "primary_expr : function_call",
1377 //t    "function_call : function_name LP RP",
1378 //t    "function_call : function_name LP argument_list RP",
1379 //t    "argument_list : expr",
1380 //t    "argument_list : expr COMMA argument_list",
1381 //t    "union_expr : path_expr",
1382 //t    "union_expr : union_expr PIPE path_expr",
1383 //t    "path_expr : location_path",
1384 //t    "path_expr : filter_expr",
1385 //t    "path_expr : filter_expr SLASH relative_location_path",
1386 //t    "path_expr : filter_expr DOUBLE_SLASH relative_location_path",
1387 //t    "filter_expr : primary_expr",
1388 //t    "filter_expr : filter_expr predicate",
1389 //t    "or_expr : and_expr",
1390 //t    "or_expr : or_expr OR and_expr",
1391 //t    "and_expr : equality_expr",
1392 //t    "and_expr : and_expr AND equality_expr",
1393 //t    "equality_expr : relational_expr",
1394 //t    "equality_expr : equality_expr EQ relational_expr",
1395 //t    "equality_expr : equality_expr NE relational_expr",
1396 //t    "relational_expr : additive_expr",
1397 //t    "relational_expr : relational_expr LT additive_expr",
1398 //t    "relational_expr : relational_expr GT additive_expr",
1399 //t    "relational_expr : relational_expr LTE additive_expr",
1400 //t    "relational_expr : relational_expr GTE additive_expr",
1401 //t    "additive_expr : multiplicative_expr",
1402 //t    "additive_expr : additive_expr PLUS multiplicative_expr",
1403 //t    "additive_expr : additive_expr MINUS multiplicative_expr",
1404 //t    "multiplicative_expr : unary_expr",
1405 //t    "multiplicative_expr : multiplicative_expr STAR unary_expr",
1406 //t    "multiplicative_expr : multiplicative_expr DIV unary_expr",
1407 //t    "multiplicative_expr : multiplicative_expr MOD unary_expr",
1408 //t    "unary_expr : union_expr",
1409 //t    "unary_expr : MINUS unary_expr",
1410 //t    "number : DIGITS",
1411 //t    "number : DIGITS DOT",
1412 //t    "number : DIGITS DOT DIGITS",
1413 //t    "number : DOT DIGITS",
1414 //t    "function_name : qname",
1415 //t    "variable_reference : DOLLAR qname",
1416 //t    "name_test : STAR",
1417 //t    "name_test : NAME COLON STAR",
1418 //t    "name_test : qname",
1419 //t    "qname : NAME",
1420 //t    "qname : NAME COLON NAME",
1421 //t    "node_type : COMMENT",
1422 //t    "node_type : TEXT",
1423 //t    "node_type : PROCESSING_INSTRUCTION",
1424 //t    "node_type : NODE",
1425 //t    };
1426 //t  } /* End of class YyRuleClass */
1427 
1428   protected static final class YyNameClass {
1429 
1430     public static final String yyName [] = {
1431     "end-of-file",null,null,null,null,null,null,null,null,null,null,null,
1432     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1433     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1434     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1435     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1436     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1437     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1438     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1439     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1440     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1441     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1442     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1443     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1444     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1445     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1446     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1447     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1448     null,null,null,null,null,null,null,null,null,null,null,null,null,null,
1449     null,null,null,null,null,null,null,"LITERAL","DIGITS","NAME","LP",
1450     "RP","LB","RB","COMMA","PIPE","SLASH","DOUBLE_SLASH","EQ","NE","GT",
1451     "LT","GTE","LTE","PLUS","MINUS","AT","STAR","DOLLAR","COLON",
1452     "DOUBLE_COLON","DOT","DOUBLE_DOT","ANCESTOR","ANCESTOR_OR_SELF",
1453     "ATTRIBUTE","CHILD","DESCENDANT","DESCENDANT_OR_SELF","FOLLOWING",
1454     "FOLLOWING_SIBLING","NAMESPACE","PARENT","PRECEDING",
1455     "PRECEDING_SIBLING","SELF","DIV","MOD","OR","AND","COMMENT",
1456     "PROCESSING_INSTRUCTION","TEXT","NODE","UNARY",
1457     };
1458   } /* End of class YyNameClass */
1459 
1460 
1461 					// line 783 "XPathParser.y"
1462 
1463 }
1464 					// line 1463 "-"
1465