Source for gnu.xml.xpath.XPathParser

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