/* */ package org.jaxen.saxpath.base;
/* */
/* */ import java.util.
ArrayList;
/* */ import org.jaxen.saxpath.
Axis;
/* */ import org.jaxen.saxpath.
SAXPathException;
/* */ import org.jaxen.saxpath.
XPathHandler;
/* */ import org.jaxen.saxpath.
XPathReader;
/* */ import org.jaxen.saxpath.
XPathSyntaxException;
/* */ import org.jaxen.saxpath.helpers.
DefaultXPathHandler;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class
XPathReader
/* */ implements
XPathReader
/* */ {
/* */ private
ArrayList tokens;
/* */ private
XPathLexer lexer;
/* */ private
XPathHandler handler;
/* 73 */ private static
XPathHandler defaultHandler = (
XPathHandler)new
DefaultXPathHandler();
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public
XPathReader() {
/* 81 */
setXPathHandler(
defaultHandler);
/* */ }
/* */
/* */
/* */ public void
setXPathHandler(
XPathHandler handler) {
/* 86 */ this.
handler =
handler;
/* */ }
/* */
/* */
/* */ public
XPathHandler getXPathHandler() {
/* 91 */ return this.
handler;
/* */ }
/* */
/* */
/* */ public void
parse(
String xpath) throws
SAXPathException {
/* 96 */
setUpParse(
xpath);
/* */
/* 98 */
getXPathHandler().
startXPath();
/* */
/* 100 */
expr();
/* */
/* 102 */
getXPathHandler().
endXPath();
/* */
/* 104 */ if (
LA(1) != -1) {
/* */
/* 106 */
XPathSyntaxException ex =
createSyntaxException("Unexpected '" +
LT(1).
getTokenText() + "'");
/* 107 */ throw
ex;
/* */ }
/* */
/* 110 */ this.
lexer = null;
/* 111 */ this.
tokens = null;
/* */ }
/* */
/* */
/* */ void
setUpParse(
String xpath) {
/* 116 */ this.
tokens = new
ArrayList();
/* 117 */ this.
lexer = new
XPathLexer(
xpath);
/* */ }
/* */
/* */ private void
pathExpr() throws
SAXPathException {
/* */
XPathSyntaxException ex;
/* 122 */
getXPathHandler().
startPathExpr();
/* */
/* 124 */ switch (
LA(1)) {
/* */
/* */
/* */ case 26:
/* */ case 29:
/* 129 */
filterExpr();
/* */
/* 131 */ if (
LA(1) == 12 ||
LA(1) == 13) {
/* */
/* 133 */
XPathSyntaxException xPathSyntaxException =
createSyntaxException("Node-set expected");
/* 134 */ throw
xPathSyntaxException;
/* */ }
/* */ break;
/* */
/* */
/* */
/* */ case 23:
/* */ case 25:
/* 142 */
filterExpr();
/* */
/* 144 */ if (
LA(1) == 12 ||
LA(1) == 13)
/* */ {
/* 146 */
locationPath(false);
/* */ }
/* */ break;
/* */
/* */
/* */
/* */ case 16:
/* 153 */ if ((
LA(2) == 23 && !
isNodeTypeName(
LT(1))) || (
LA(2) == 19 &&
LA(4) == 23)) {
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 161 */
filterExpr();
/* */
/* 163 */ if (
LA(1) == 12 ||
LA(1) == 13)
/* */ {
/* 165 */
locationPath(false);
/* */ }
/* */
/* */ break;
/* */ }
/* 170 */
locationPath(false);
/* */ break;
/* */
/* */
/* */
/* */ case 9:
/* */ case 14:
/* */ case 15:
/* */ case 17:
/* 179 */
locationPath(false);
/* */ break;
/* */
/* */
/* */ case 12:
/* */ case 13:
/* 185 */
locationPath(true);
/* */ break;
/* */
/* */
/* */ default:
/* 190 */
ex =
createSyntaxException("Unexpected '" +
LT(1).
getTokenText() + "'");
/* 191 */ throw
ex;
/* */ }
/* */
/* */
/* 195 */
getXPathHandler().
endPathExpr();
/* */ }
/* */
/* */
/* */ private void
literal() throws
SAXPathException {
/* 200 */
Token token =
match(26);
/* */
/* 202 */
getXPathHandler().
literal(
token.
getTokenText());
/* */ }
/* */
/* */
/* */ private void
functionCall() throws
SAXPathException {
/* 207 */
String prefix = null;
/* 208 */
String functionName = null;
/* */
/* 210 */ if (
LA(2) == 19) {
/* */
/* 212 */
prefix =
match(16).
getTokenText();
/* 213 */
match(19);
/* */ }
/* */ else {
/* */
/* 217 */
prefix = "";
/* */ }
/* */
/* 220 */
functionName =
match(16).
getTokenText();
/* */
/* 222 */
getXPathHandler().
startFunction(
prefix,
functionName);
/* */
/* */
/* 225 */
match(23);
/* */
/* 227 */
arguments();
/* */
/* 229 */
match(24);
/* */
/* 231 */
getXPathHandler().
endFunction();
/* */ }
/* */
/* */
/* */ private void
arguments() throws
SAXPathException {
/* 236 */ while (
LA(1) != 24) {
/* */
/* 238 */
expr();
/* */
/* 240 */ if (
LA(1) == 30)
/* */ {
/* 242 */
match(30);
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private void
filterExpr() throws
SAXPathException {
/* */
Token token;
/* 254 */
getXPathHandler().
startFilterExpr();
/* */
/* 256 */ switch (
LA(1)) {
/* */
/* */
/* */ case 29:
/* 260 */
token =
match(29);
/* */
/* 262 */
getXPathHandler().
number(
Double.
parseDouble(
token.
getTokenText()));
/* */ break;
/* */
/* */
/* */ case 26:
/* 267 */
literal();
/* */ break;
/* */
/* */
/* */ case 23:
/* 272 */
match(23);
/* 273 */
expr();
/* 274 */
match(24);
/* */ break;
/* */
/* */
/* */ case 16:
/* 279 */
functionCall();
/* */ break;
/* */
/* */
/* */ case 25:
/* 284 */
variableReference();
/* */ break;
/* */ }
/* */
/* */
/* 289 */
predicates();
/* */
/* 291 */
getXPathHandler().
endFilterExpr();
/* */ }
/* */
/* */
/* */ private void
variableReference() throws
SAXPathException {
/* 296 */
match(25);
/* */
/* 298 */
String prefix = null;
/* 299 */
String variableName = null;
/* */
/* 301 */ if (
LA(2) == 19) {
/* */
/* 303 */
prefix =
match(16).
getTokenText();
/* 304 */
match(19);
/* */ }
/* */ else {
/* */
/* 308 */
prefix = "";
/* */ }
/* */
/* 311 */
variableName =
match(16).
getTokenText();
/* */
/* 313 */
getXPathHandler().
variableReference(
prefix,
variableName);
/* */ }
/* */
/* */
/* */
/* */ void
locationPath(boolean
isAbsolute) throws
SAXPathException {
/* 319 */ switch (
LA(1)) {
/* */
/* */
/* */ case 12:
/* */ case 13:
/* 324 */ if (
isAbsolute) {
/* */
/* 326 */
absoluteLocationPath();
/* */ }
/* */ else {
/* */
/* 330 */
relativeLocationPath();
/* */ }
/* */ return;
/* */
/* */
/* */ case 9:
/* */ case 14:
/* */ case 15:
/* */ case 16:
/* */ case 17:
/* 340 */
relativeLocationPath();
/* */ return;
/* */ }
/* */
/* */
/* 345 */
XPathSyntaxException ex =
createSyntaxException("Unexpected '" +
LT(1).
getTokenText() + "'");
/* 346 */ throw
ex;
/* */ }
/* */
/* */
/* */
/* */ private void
absoluteLocationPath() throws
SAXPathException {
/* */
XPathSyntaxException ex;
/* 353 */
getXPathHandler().
startAbsoluteLocationPath();
/* */
/* 355 */ switch (
LA(1)) {
/* */
/* */
/* */ case 12:
/* 359 */
match(12);
/* */
/* 361 */ switch (
LA(1)) {
/* */
/* */
/* */
/* */ case 9:
/* */ case 14:
/* */ case 15:
/* */ case 16:
/* */ case 17:
/* 370 */
steps();
/* */ break;
/* */ }
/* */
/* */
/* */ break;
/* */
/* */ case 13:
/* 378 */
getXPathHandler().
startAllNodeStep(12);
/* 379 */
getXPathHandler().
endAllNodeStep();
/* */
/* 381 */
match(13);
/* 382 */ switch (
LA(1)) {
/* */
/* */
/* */ case 9:
/* */ case 14:
/* */ case 15:
/* */ case 16:
/* */ case 17:
/* 390 */
steps();
/* */ break;
/* */ }
/* */
/* 394 */
ex =
createSyntaxException("Location path cannot end with //");
/* 395 */ throw
ex;
/* */ }
/* */
/* */
/* */
/* */
/* 401 */
getXPathHandler().
endAbsoluteLocationPath();
/* */ }
/* */
/* */
/* */ private void
relativeLocationPath() throws
SAXPathException {
/* 406 */
getXPathHandler().
startRelativeLocationPath();
/* */
/* 408 */ switch (
LA(1)) {
/* */
/* */
/* */ case 12:
/* 412 */
match(12);
/* */ break;
/* */
/* */
/* */ case 13:
/* 417 */
getXPathHandler().
startAllNodeStep(12);
/* 418 */
getXPathHandler().
endAllNodeStep();
/* */
/* 420 */
match(13);
/* */ break;
/* */ }
/* */
/* */
/* */
/* 426 */
steps();
/* */
/* 428 */
getXPathHandler().
endRelativeLocationPath();
/* */ }
/* */
/* */
/* */ private void
steps() throws
SAXPathException {
/* 433 */ switch (
LA(1)) {
/* */
/* */
/* */
/* */ case 9:
/* */ case 14:
/* */ case 15:
/* */ case 16:
/* */ case 17:
/* 442 */
step();
/* */ break;
/* */
/* */
/* */ case -1:
/* */ return;
/* */
/* */
/* */ default:
/* 451 */
ex =
createSyntaxException("Expected one of '.', '..', '@', '*', <QName>");
/* 452 */ throw
ex;
/* */ }
/* */
/* */
/* */
/* */ while (true) {
/* 458 */ if (
LA(1) == 12 ||
LA(1) == 13) {
/* */
/* */
/* */
/* 462 */ switch (
LA(1)) {
/* */
/* */
/* */ case 12:
/* 466 */
match(12);
/* */ break;
/* */
/* */
/* */ case 13:
/* 471 */
getXPathHandler().
startAllNodeStep(12);
/* 472 */
getXPathHandler().
endAllNodeStep();
/* */
/* 474 */
match(13);
/* */ break;
/* */ }
/* */
/* */
/* */
/* */
/* */ } else {
/* */ return;
/* */ }
/* 484 */ switch (
LA(1)) {
/* */
/* */
/* */ case 9:
/* */ case 14:
/* */ case 15:
/* */ case 16:
/* */ case 17:
/* 492 */
step();
/* */ continue;
/* */ }
/* */ break;
/* */ }
/* 497 */
XPathSyntaxException ex =
createSyntaxException("Expected one of '.', '..', '@', '*', <QName>");
/* 498 */ throw
ex;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ void
step() throws
SAXPathException {
/* 507 */ int
axis = 0;
/* */
/* 509 */ switch (
LA(1)) {
/* */
/* */
/* */ case 14:
/* */ case 15:
/* 514 */
abbrStep();
/* */ return;
/* */
/* */
/* */ case 17:
/* 519 */
axis =
axisSpecifier();
/* */ break;
/* */
/* */
/* */ case 16:
/* 524 */ if (
LA(2) == 20) {
/* */
/* 526 */
axis =
axisSpecifier();
/* */
/* */ break;
/* */ }
/* 530 */
axis = 1;
/* */ break;
/* */
/* */
/* */
/* */ case 9:
/* 536 */
axis = 1;
/* */ break;
/* */ }
/* */
/* */
/* 541 */
nodeTest(
axis);
/* */ }
/* */
/* */ private int
axisSpecifier() throws
SAXPathException {
/* */
Token token;
/* 546 */ int
axis = 0;
/* */
/* 548 */ switch (
LA(1)) {
/* */
/* */
/* */ case 17:
/* 552 */
match(17);
/* 553 */
axis = 9;
/* */ break;
/* */
/* */
/* */ case 16:
/* 558 */
token =
LT(1);
/* */
/* 560 */
axis =
Axis.
lookup(
token.
getTokenText());
/* */
/* 562 */ if (
axis == 0)
/* */ {
/* 564 */
throwInvalidAxis(
token.
getTokenText());
/* */ }
/* */
/* 567 */
match(16);
/* 568 */
match(20);
/* */ break;
/* */ }
/* */
/* */
/* */
/* 574 */ return
axis;
/* */ }
/* */
/* */
/* */ private void
nodeTest(int
axis) throws
SAXPathException {
/* 579 */ switch (
LA(1)) {
/* */
/* */
/* */ case 16:
/* 583 */ switch (
LA(2)) {
/* */
/* */
/* */ case 23:
/* 587 */
nodeTypeTest(
axis);
/* */ return;
/* */ }
/* */
/* */
/* 592 */
nameTest(
axis);
/* */ return;
/* */
/* */
/* */
/* */
/* */
/* */ case 9:
/* 600 */
nameTest(
axis);
/* */ return;
/* */ }
/* */
/* 604 */
XPathSyntaxException ex =
createSyntaxException("Expected <QName> or *");
/* 605 */ throw
ex;
/* */ }
/* */
/* */
/* */
/* */ private void
nodeTypeTest(int
axis) throws
SAXPathException {
/* 611 */
Token nodeTypeToken =
match(16);
/* 612 */
String nodeType =
nodeTypeToken.
getTokenText();
/* */
/* 614 */
match(23);
/* */
/* 616 */ if ("processing-instruction".
equals(
nodeType)) {
/* */
/* 618 */
String piName = "";
/* */
/* 620 */ if (
LA(1) == 26)
/* */ {
/* 622 */
piName =
match(26).
getTokenText();
/* */ }
/* */
/* 625 */
match(24);
/* */
/* 627 */
getXPathHandler().
startProcessingInstructionNodeStep(
axis,
piName);
/* */
/* */
/* 630 */
predicates();
/* */
/* 632 */
getXPathHandler().
endProcessingInstructionNodeStep();
/* */ }
/* 634 */ else if ("node".
equals(
nodeType)) {
/* */
/* 636 */
match(24);
/* */
/* 638 */
getXPathHandler().
startAllNodeStep(
axis);
/* */
/* 640 */
predicates();
/* */
/* 642 */
getXPathHandler().
endAllNodeStep();
/* */ }
/* 644 */ else if ("text".
equals(
nodeType)) {
/* */
/* 646 */
match(24);
/* */
/* 648 */
getXPathHandler().
startTextNodeStep(
axis);
/* */
/* 650 */
predicates();
/* */
/* 652 */
getXPathHandler().
endTextNodeStep();
/* */ }
/* 654 */ else if ("comment".
equals(
nodeType)) {
/* */
/* 656 */
match(24);
/* */
/* 658 */
getXPathHandler().
startCommentNodeStep(
axis);
/* */
/* 660 */
predicates();
/* */
/* 662 */
getXPathHandler().
endCommentNodeStep();
/* */ }
/* */ else {
/* */
/* 666 */
XPathSyntaxException ex =
createSyntaxException("Expected node-type");
/* 667 */ throw
ex;
/* */ }
/* */ }
/* */
/* */
/* */ private void
nameTest(int
axis) throws
SAXPathException {
/* 673 */
String prefix = null;
/* 674 */
String localName = null;
/* */
/* 676 */ switch (
LA(2)) {
/* */
/* */
/* */ case 19:
/* 680 */ switch (
LA(1)) {
/* */
/* */
/* */ case 16:
/* 684 */
prefix =
match(16).
getTokenText();
/* 685 */
match(19);
/* */ break;
/* */ }
/* */
/* */
/* */ break;
/* */ }
/* */
/* 693 */ switch (
LA(1)) {
/* */
/* */
/* */ case 16:
/* 697 */
localName =
match(16).
getTokenText();
/* */ break;
/* */
/* */
/* */ case 9:
/* 702 */
match(9);
/* 703 */
localName = "*";
/* */ break;
/* */ }
/* */
/* */
/* 708 */ if (
prefix == null)
/* */ {
/* 710 */
prefix = "";
/* */ }
/* */
/* 713 */
getXPathHandler().
startNameStep(
axis,
prefix,
localName);
/* */
/* */
/* */
/* 717 */
predicates();
/* */
/* 719 */
getXPathHandler().
endNameStep();
/* */ }
/* */
/* */
/* */ private void
abbrStep() throws
SAXPathException {
/* 724 */ switch (
LA(1)) {
/* */
/* */
/* */ case 14:
/* 728 */
match(14);
/* 729 */
getXPathHandler().
startAllNodeStep(11);
/* 730 */
predicates();
/* 731 */
getXPathHandler().
endAllNodeStep();
/* */ break;
/* */
/* */
/* */ case 15:
/* 736 */
match(15);
/* 737 */
getXPathHandler().
startAllNodeStep(3);
/* 738 */
predicates();
/* 739 */
getXPathHandler().
endAllNodeStep();
/* */ break;
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private void
predicates() throws
SAXPathException {
/* 749 */ while (
LA(1) == 21)
/* */ {
/* 751 */
predicate();
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ void
predicate() throws
SAXPathException {
/* 762 */
getXPathHandler().
startPredicate();
/* */
/* 764 */
match(21);
/* */
/* 766 */
predicateExpr();
/* */
/* 768 */
match(22);
/* */
/* 770 */
getXPathHandler().
endPredicate();
/* */ }
/* */
/* */
/* */ private void
predicateExpr() throws
SAXPathException {
/* 775 */
expr();
/* */ }
/* */
/* */
/* */ private void
expr() throws
SAXPathException {
/* 780 */
orExpr();
/* */ }
/* */
/* */
/* */ private void
orExpr() throws
SAXPathException {
/* 785 */
getXPathHandler().
startOrExpr();
/* */
/* 787 */
andExpr();
/* */
/* 789 */ boolean
create = false;
/* */
/* 791 */ switch (
LA(1)) {
/* */
/* */
/* */ case 28:
/* 795 */
create = true;
/* 796 */
match(28);
/* 797 */
orExpr();
/* */ break;
/* */ }
/* */
/* */
/* 802 */
getXPathHandler().
endOrExpr(
create);
/* */ }
/* */
/* */
/* */ private void
andExpr() throws
SAXPathException {
/* 807 */
getXPathHandler().
startAndExpr();
/* */
/* 809 */
equalityExpr();
/* */
/* 811 */ boolean
create = false;
/* */
/* 813 */ switch (
LA(1)) {
/* */
/* */
/* */ case 27:
/* 817 */
create = true;
/* 818 */
match(27);
/* 819 */
andExpr();
/* */ break;
/* */ }
/* */
/* */
/* 824 */
getXPathHandler().
endAndExpr(
create);
/* */ }
/* */
/* */
/* */ private void
equalityExpr() throws
SAXPathException {
/* 829 */
relationalExpr();
/* */
/* 831 */ int
la =
LA(1);
/* 832 */ while (
la == 1 ||
la == 2) {
/* */
/* 834 */ switch (
la) {
/* */
/* */
/* */ case 1:
/* 838 */
match(1);
/* 839 */
getXPathHandler().
startEqualityExpr();
/* 840 */
relationalExpr();
/* 841 */
getXPathHandler().
endEqualityExpr(1);
/* */ break;
/* */
/* */
/* */ case 2:
/* 846 */
match(2);
/* 847 */
getXPathHandler().
startEqualityExpr();
/* 848 */
relationalExpr();
/* 849 */
getXPathHandler().
endEqualityExpr(2);
/* */ break;
/* */ }
/* */
/* 853 */
la =
LA(1);
/* */ }
/* */ }
/* */
/* */
/* */
/* */ private void
relationalExpr() throws
SAXPathException {
/* 860 */
additiveExpr();
/* */
/* 862 */ int
la =
LA(1);
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 870 */ while (
la == 3 ||
la == 5 ||
la == 4 ||
la == 6) {
/* 871 */ switch (
la) {
/* */
/* */
/* */ case 3:
/* 875 */
match(3);
/* 876 */
getXPathHandler().
startRelationalExpr();
/* 877 */
additiveExpr();
/* 878 */
getXPathHandler().
endRelationalExpr(3);
/* */ break;
/* */
/* */
/* */ case 5:
/* 883 */
match(5);
/* 884 */
getXPathHandler().
startRelationalExpr();
/* 885 */
additiveExpr();
/* 886 */
getXPathHandler().
endRelationalExpr(5);
/* */ break;
/* */
/* */
/* */ case 6:
/* 891 */
match(6);
/* 892 */
getXPathHandler().
startRelationalExpr();
/* 893 */
additiveExpr();
/* 894 */
getXPathHandler().
endRelationalExpr(6);
/* */ break;
/* */
/* */
/* */ case 4:
/* 899 */
match(4);
/* 900 */
getXPathHandler().
startRelationalExpr();
/* 901 */
additiveExpr();
/* 902 */
getXPathHandler().
endRelationalExpr(4);
/* */ break;
/* */ }
/* */
/* 906 */
la =
LA(1);
/* */ }
/* */ }
/* */
/* */
/* */
/* */ private void
additiveExpr() throws
SAXPathException {
/* 913 */
multiplicativeExpr();
/* */
/* 915 */ int
la =
LA(1);
/* 916 */ while (
la == 7 ||
la == 8) {
/* */
/* 918 */ switch (
la) {
/* */
/* */
/* */ case 7:
/* 922 */
match(7);
/* 923 */
getXPathHandler().
startAdditiveExpr();
/* 924 */
multiplicativeExpr();
/* 925 */
getXPathHandler().
endAdditiveExpr(7);
/* */ break;
/* */
/* */
/* */ case 8:
/* 930 */
match(8);
/* 931 */
getXPathHandler().
startAdditiveExpr();
/* 932 */
multiplicativeExpr();
/* 933 */
getXPathHandler().
endAdditiveExpr(8);
/* */ break;
/* */ }
/* */
/* 937 */
la =
LA(1);
/* */ }
/* */ }
/* */
/* */
/* */ private void
multiplicativeExpr() throws
SAXPathException {
/* 943 */
unaryExpr();
/* */
/* 945 */ int
la =
LA(1);
/* 946 */ while (
la == 9 ||
la == 11 ||
la == 10) {
/* */
/* 948 */ switch (
la) {
/* */
/* */
/* */ case 9:
/* 952 */
match(9);
/* 953 */
getXPathHandler().
startMultiplicativeExpr();
/* 954 */
unaryExpr();
/* 955 */
getXPathHandler().
endMultiplicativeExpr(9);
/* */ break;
/* */
/* */
/* */ case 11:
/* 960 */
match(11);
/* 961 */
getXPathHandler().
startMultiplicativeExpr();
/* 962 */
unaryExpr();
/* 963 */
getXPathHandler().
endMultiplicativeExpr(11);
/* */ break;
/* */
/* */
/* */ case 10:
/* 968 */
match(10);
/* 969 */
getXPathHandler().
startMultiplicativeExpr();
/* 970 */
unaryExpr();
/* 971 */
getXPathHandler().
endMultiplicativeExpr(10);
/* */ break;
/* */ }
/* */
/* 975 */
la =
LA(1);
/* */ }
/* */ }
/* */
/* */
/* */
/* */ private void
unaryExpr() throws
SAXPathException {
/* 982 */ switch (
LA(1)) {
/* */
/* */
/* */ case 8:
/* 986 */
getXPathHandler().
startUnaryExpr();
/* 987 */
match(8);
/* 988 */
unaryExpr();
/* 989 */
getXPathHandler().
endUnaryExpr(12);
/* */ return;
/* */ }
/* */
/* */
/* 994 */
unionExpr();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private void
unionExpr() throws
SAXPathException {
/* 1004 */
getXPathHandler().
startUnionExpr();
/* */
/* 1006 */
pathExpr();
/* */
/* 1008 */ boolean
create = false;
/* */
/* 1010 */ switch (
LA(1)) {
/* */
/* */
/* */ case 18:
/* 1014 */
match(18);
/* 1015 */
create = true;
/* 1016 */
expr();
/* */ break;
/* */ }
/* */
/* */
/* 1021 */
getXPathHandler().
endUnionExpr(
create);
/* */ }
/* */
/* */
/* */ private
Token match(int
tokenType) throws
XPathSyntaxException {
/* 1026 */
LT(1);
/* */
/* 1028 */
Token token = this.
tokens.
get(0);
/* */
/* 1030 */ if (
token.
getTokenType() ==
tokenType) {
/* */
/* 1032 */ this.
tokens.
remove(0);
/* 1033 */ return
token;
/* */ }
/* */
/* */
/* 1037 */
XPathSyntaxException ex =
createSyntaxException("Expected: " +
TokenTypes.
getTokenText(
tokenType));
/* 1038 */ throw
ex;
/* */ }
/* */
/* */
/* */ private int
LA(int
position) {
/* 1043 */ return
LT(
position).
getTokenType();
/* */ }
/* */
/* */
/* */
/* */
/* */ private
Token LT(int
position) {
/* 1050 */ if (this.
tokens.
size() <=
position - 1)
/* */ {
/* 1052 */ for (int
i = 0;
i <
position;
i++)
/* */ {
/* 1054 */ this.
tokens.
add(this.
lexer.
nextToken());
/* */ }
/* */ }
/* */
/* 1058 */ return this.
tokens.
get(
position - 1);
/* */ }
/* */
/* */
/* */ private boolean
isNodeTypeName(
Token name) {
/* 1063 */
String text =
name.
getTokenText();
/* */
/* 1065 */ if ("node".
equals(
text) || "comment".
equals(
text) || "text".
equals(
text) || "processing-instruction".
equals(
text))
/* */ {
/* */
/* */
/* */
/* */
/* */
/* */
/* 1073 */ return true;
/* */ }
/* */
/* 1076 */ return false;
/* */ }
/* */
/* */
/* */ private
XPathSyntaxException createSyntaxException(
String message) {
/* 1081 */
String xpath = this.
lexer.
getXPath();
/* 1082 */ int
position =
LT(1).
getTokenBegin();
/* */
/* 1084 */ return new
XPathSyntaxException(
xpath,
position,
message);
/* */ }
/* */
/* */
/* */
/* */
/* */ private void
throwInvalidAxis(
String invalidAxis) throws
SAXPathException {
/* 1091 */
String xpath = this.
lexer.
getXPath();
/* 1092 */ int
position =
LT(1).
getTokenBegin();
/* */
/* 1094 */
String message = "Expected valid axis name instead of [" +
invalidAxis + "]";
/* */
/* 1096 */ throw new
XPathSyntaxException(
xpath,
position,
message);
/* */ }
/* */ }
/* Location: /Users/tommy/.m2/repository/jaxen/jaxen/1.1.1/jaxen-1.1.1.jar!/org/jaxen/saxpath/base/XPathReader.class
* Java compiler version: 2 (46.0)
* JD-Core Version: 1.1.3
*/