Parser.cs 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110
  1. // created by jay 0.7 (c) 1998 [email protected]
  2. // line 2 "Parser.jay"
  3. // XPath parser
  4. //
  5. // Author - Piers Haken <[email protected]>
  6. //
  7. // TODO: FUNCTION_CALL should be a QName, not just a NCName
  8. // TODO: PROCESSING_INSTRUCTION's optional parameter
  9. // TODO: flatten argument/predicate lists in place
  10. using System;
  11. using System.Xml;
  12. using System.Xml.XPath;
  13. namespace Mono.Xml.XPath
  14. {
  15. public class XPathParser
  16. {
  17. internal object yyparseSafe (Tokenizer tok)
  18. {
  19. return yyparseSafe (tok, null);
  20. }
  21. internal object yyparseSafe (Tokenizer tok, object yyDebug)
  22. {
  23. //yyDebug = new yydebug.yyDebugSimple ();
  24. try
  25. {
  26. Expression expr = (Expression) yyparse (tok, yyDebug);
  27. //Console.WriteLine (expr.ToString ());
  28. return expr;
  29. }
  30. catch (XPathException e)
  31. {
  32. throw e;
  33. }
  34. catch (Exception e)
  35. {
  36. throw new XPathException ("Error during parse", e);
  37. }
  38. }
  39. internal object yyparseDebug (Tokenizer tok)
  40. {
  41. return yyparseSafe (tok, new yydebug.yyDebugSimple ());
  42. }
  43. // line 51
  44. /** simplified error message.
  45. @see <a href="#yyerror(java.lang.String, java.lang.String[])">yyerror</a>
  46. */
  47. public void yyerror (string message) {
  48. yyerror(message, null);
  49. }
  50. /** (syntax) error message.
  51. Can be overwritten to control message format.
  52. @param message text to be displayed.
  53. @param expected vector of acceptable tokens, if available.
  54. */
  55. public void yyerror (string message, string[] expected) {
  56. if ((expected != null) && (expected.Length > 0)) {
  57. System.Console.Write (message+", expecting");
  58. for (int n = 0; n < expected.Length; ++ n)
  59. System.Console.Write (" "+expected[n]);
  60. System.Console.WriteLine ();
  61. } else
  62. System.Console.WriteLine (message);
  63. }
  64. /** debugging support, requires the package jay.yydebug.
  65. Set to null to suppress debugging messages.
  66. */
  67. protected yydebug.yyDebug debug;
  68. protected static int yyFinal = 25;
  69. public static string [] yyRule = {
  70. "$accept : Expr",
  71. "Expr : OrExpr",
  72. "OrExpr : AndExpr",
  73. "OrExpr : OrExpr OR AndExpr",
  74. "AndExpr : EqualityExpr",
  75. "AndExpr : AndExpr AND EqualityExpr",
  76. "EqualityExpr : RelationalExpr",
  77. "EqualityExpr : EqualityExpr EQ RelationalExpr",
  78. "EqualityExpr : EqualityExpr NE RelationalExpr",
  79. "RelationalExpr : AdditiveExpr",
  80. "RelationalExpr : RelationalExpr LT AdditiveExpr",
  81. "RelationalExpr : RelationalExpr GT AdditiveExpr",
  82. "RelationalExpr : RelationalExpr LE AdditiveExpr",
  83. "RelationalExpr : RelationalExpr GE AdditiveExpr",
  84. "AdditiveExpr : MultiplicativeExpr",
  85. "AdditiveExpr : AdditiveExpr PLUS MultiplicativeExpr",
  86. "AdditiveExpr : AdditiveExpr MINUS MultiplicativeExpr",
  87. "MultiplicativeExpr : UnaryExpr",
  88. "MultiplicativeExpr : MultiplicativeExpr MULTIPLY UnaryExpr",
  89. "MultiplicativeExpr : MultiplicativeExpr DIV UnaryExpr",
  90. "MultiplicativeExpr : MultiplicativeExpr MOD UnaryExpr",
  91. "UnaryExpr : UnionExpr",
  92. "UnaryExpr : MINUS UnaryExpr",
  93. "UnionExpr : PathExpr",
  94. "UnionExpr : UnionExpr BAR PathExpr",
  95. "PathExpr : RelativeLocationPath",
  96. "PathExpr : SLASH",
  97. "PathExpr : SLASH RelativeLocationPath",
  98. "PathExpr : SLASH2 RelativeLocationPath",
  99. "PathExpr : FilterExpr",
  100. "PathExpr : FilterExpr SLASH RelativeLocationPath",
  101. "PathExpr : FilterExpr SLASH2 RelativeLocationPath",
  102. "RelativeLocationPath : Step",
  103. "RelativeLocationPath : RelativeLocationPath SLASH Step",
  104. "RelativeLocationPath : RelativeLocationPath SLASH2 Step",
  105. "Step : AxisSpecifier QName ZeroOrMorePredicates",
  106. "Step : AxisSpecifier ASTERISK ZeroOrMorePredicates",
  107. "Step : AxisSpecifier NodeType PAREN_OPEN OptionalLiteral PAREN_CLOSE ZeroOrMorePredicates",
  108. "Step : DOT",
  109. "Step : DOT2",
  110. "AxisSpecifier :",
  111. "AxisSpecifier : AT",
  112. "AxisSpecifier : AxisName COLON2",
  113. "NodeType : COMMENT",
  114. "NodeType : TEXT",
  115. "NodeType : PROCESSING_INSTRUCTION",
  116. "NodeType : NODE",
  117. "FilterExpr : PrimaryExpr",
  118. "FilterExpr : FilterExpr Predicate",
  119. "PrimaryExpr : DOLLAR QName",
  120. "PrimaryExpr : PAREN_OPEN Expr PAREN_CLOSE",
  121. "PrimaryExpr : LITERAL",
  122. "PrimaryExpr : NUMBER",
  123. "PrimaryExpr : FunctionCall",
  124. "FunctionCall : FUNCTION_NAME PAREN_OPEN OptionalArgumentList PAREN_CLOSE",
  125. "OptionalArgumentList :",
  126. "OptionalArgumentList : Expr OptionalArgumentListTail",
  127. "OptionalArgumentListTail :",
  128. "OptionalArgumentListTail : COMMA Expr OptionalArgumentListTail",
  129. "ZeroOrMorePredicates :",
  130. "ZeroOrMorePredicates : Predicate ZeroOrMorePredicates",
  131. "Predicate : BRACKET_OPEN Expr BRACKET_CLOSE",
  132. "AxisName : ANCESTOR",
  133. "AxisName : ANCESTOR_OR_SELF",
  134. "AxisName : ATTRIBUTE",
  135. "AxisName : CHILD",
  136. "AxisName : DESCENDANT",
  137. "AxisName : DESCENDANT_OR_SELF",
  138. "AxisName : FOLLOWING",
  139. "AxisName : FOLLOWING_SIBLING",
  140. "AxisName : NAMESPACE",
  141. "AxisName : PARENT",
  142. "AxisName : PRECEDING",
  143. "AxisName : PRECEDING_SIBLING",
  144. "AxisName : SELF",
  145. "OptionalLiteral :",
  146. "OptionalLiteral : LITERAL",
  147. };
  148. protected static string [] yyName = {
  149. "end-of-file",null,null,null,null,null,null,null,null,null,null,null,
  150. null,null,null,null,null,null,null,null,null,null,null,null,null,null,
  151. null,null,null,null,null,null,null,null,null,null,"'$'",null,null,
  152. null,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",null,null,null,
  153. null,null,null,null,null,null,null,null,null,"'<'","'='","'>'",null,
  154. "'@'",null,null,null,null,null,null,null,null,null,null,null,null,
  155. null,null,null,null,null,null,null,null,null,null,null,null,null,null,
  156. "'['",null,"']'",null,null,null,null,null,null,null,null,null,null,
  157. null,null,null,null,null,null,null,null,null,null,null,null,null,null,
  158. null,null,null,null,null,null,"'|'",null,null,null,null,null,null,
  159. null,null,null,null,null,null,null,null,null,null,null,null,null,null,
  160. null,null,null,null,null,null,null,null,null,null,null,null,null,null,
  161. null,null,null,null,null,null,null,null,null,null,null,null,null,null,
  162. null,null,null,null,null,null,null,null,null,null,null,null,null,null,
  163. null,null,null,null,null,null,null,null,null,null,null,null,null,null,
  164. null,null,null,null,null,null,null,null,null,null,null,null,null,null,
  165. null,null,null,null,null,null,null,null,null,null,null,null,null,null,
  166. null,null,null,null,null,null,null,null,null,null,null,null,null,null,
  167. null,null,null,null,null,null,null,null,null,null,null,null,null,null,
  168. "ERROR","EOF","SLASH","SLASH2","\"//\"","DOT","DOT2","\"..\"",
  169. "COLON2","\"::\"","COMMA","AT","FUNCTION_NAME","BRACKET_OPEN",
  170. "BRACKET_CLOSE","PAREN_OPEN","PAREN_CLOSE","AND","\"and\"","OR",
  171. "\"or\"","DIV","\"div\"","MOD","\"mod\"","PLUS","MINUS","ASTERISK",
  172. "DOLLAR","BAR","EQ","NE","\"!=\"","LE","\"<=\"","GE","\">=\"","LT",
  173. "GT","ANCESTOR","\"ancestor\"","ANCESTOR_OR_SELF",
  174. "\"ancstor-or-self\"","ATTRIBUTE","\"attribute\"","CHILD","\"child\"",
  175. "DESCENDANT","\"descendant\"","DESCENDANT_OR_SELF",
  176. "\"descendant-or-self\"","FOLLOWING","\"following\"",
  177. "FOLLOWING_SIBLING","\"sibling\"","NAMESPACE","\"NameSpace\"",
  178. "PARENT","\"parent\"","PRECEDING","\"preceding\"","PRECEDING_SIBLING",
  179. "\"preceding-sibling\"","SELF","\"self\"","COMMENT","\"comment\"",
  180. "TEXT","\"text\"","PROCESSING_INSTRUCTION",
  181. "\"processing-instruction\"","NODE","\"node\"","MULTIPLY","NUMBER",
  182. "LITERAL","QName",
  183. };
  184. /** index-checked interface to yyName[].
  185. @param token single character or %token value.
  186. @return token name or [illegal] or [unknown].
  187. */
  188. public static string yyname (int token) {
  189. if ((token < 0) || (token > yyName.Length)) return "[illegal]";
  190. string name;
  191. if ((name = yyName[token]) != null) return name;
  192. return "[unknown]";
  193. }
  194. /** computes list of expected tokens on error by tracing the tables.
  195. @param state for which to compute the list.
  196. @return list of token names.
  197. */
  198. protected string[] yyExpecting (int state) {
  199. int token, n, len = 0;
  200. bool[] ok = new bool[yyName.Length];
  201. if ((n = yySindex[state]) != 0)
  202. for (token = n < 0 ? -n : 0;
  203. (token < yyName.Length) && (n+token < yyTable.Length); ++ token)
  204. if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
  205. ++ len;
  206. ok[token] = true;
  207. }
  208. if ((n = yyRindex[state]) != 0)
  209. for (token = n < 0 ? -n : 0;
  210. (token < yyName.Length) && (n+token < yyTable.Length); ++ token)
  211. if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
  212. ++ len;
  213. ok[token] = true;
  214. }
  215. string [] result = new string[len];
  216. for (n = token = 0; n < len; ++ token)
  217. if (ok[token]) result[n++] = yyName[token];
  218. return result;
  219. }
  220. /** the generated parser, with debugging messages.
  221. Maintains a state and a value stack, currently with fixed maximum size.
  222. @param yyLex scanner.
  223. @param yydebug debug message writer implementing yyDebug, or null.
  224. @return result of the last reduction, if any.
  225. @throws yyException on irrecoverable parse error.
  226. */
  227. public Object yyparse (yyParser.yyInput yyLex, Object yyd)
  228. {
  229. this.debug = (yydebug.yyDebug)yyd;
  230. return yyparse(yyLex);
  231. }
  232. /** initial size and increment of the state/value stack [default 256].
  233. This is not final so that it can be overwritten outside of invocations
  234. of yyparse().
  235. */
  236. protected int yyMax;
  237. /** executed at the beginning of a reduce action.
  238. Used as $$ = yyDefault($1), prior to the user-specified action, if any.
  239. Can be overwritten to provide deep copy, etc.
  240. @param first value for $1, or null.
  241. @return first.
  242. */
  243. protected Object yyDefault (Object first) {
  244. return first;
  245. }
  246. /** the generated parser.
  247. Maintains a state and a value stack, currently with fixed maximum size.
  248. @param yyLex scanner.
  249. @return result of the last reduction, if any.
  250. @throws yyException on irrecoverable parse error.
  251. */
  252. public Object yyparse (yyParser.yyInput yyLex)
  253. {
  254. if (yyMax <= 0) yyMax = 256; // initial size
  255. int yyState = 0; // state stack ptr
  256. int [] yyStates = new int[yyMax]; // state stack
  257. Object yyVal = null; // value stack ptr
  258. Object [] yyVals = new Object[yyMax]; // value stack
  259. int yyToken = -1; // current input
  260. int yyErrorFlag = 0; // #tks to shift
  261. int yyTop = 0;
  262. goto skip;
  263. yyLoop:
  264. yyTop++;
  265. skip:
  266. for (;; ++ yyTop) {
  267. if (yyTop >= yyStates.Length) { // dynamically increase
  268. int[] i = new int[yyStates.Length+yyMax];
  269. yyStates.CopyTo (i, 0);
  270. yyStates = i;
  271. Object[] o = new Object[yyVals.Length+yyMax];
  272. yyVals.CopyTo (o, 0);
  273. yyVals = o;
  274. }
  275. yyStates[yyTop] = yyState;
  276. yyVals[yyTop] = yyVal;
  277. if (debug != null) debug.push(yyState, yyVal);
  278. yyDiscarded: for (;;) { // discarding a token does not change stack
  279. int yyN;
  280. if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
  281. if (yyToken < 0) {
  282. yyToken = yyLex.advance() ? yyLex.token() : 0;
  283. if (debug != null)
  284. debug.lex(yyState, yyToken, yyname(yyToken), yyLex.value());
  285. }
  286. if ((yyN = yySindex[yyState]) != 0 && ((yyN += yyToken) >= 0)
  287. && (yyN < yyTable.Length) && (yyCheck[yyN] == yyToken)) {
  288. if (debug != null)
  289. debug.shift(yyState, yyTable[yyN], yyErrorFlag-1);
  290. yyState = yyTable[yyN]; // shift to yyN
  291. yyVal = yyLex.value();
  292. yyToken = -1;
  293. if (yyErrorFlag > 0) -- yyErrorFlag;
  294. goto yyLoop;
  295. }
  296. if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0
  297. && yyN < yyTable.Length && yyCheck[yyN] == yyToken)
  298. yyN = yyTable[yyN]; // reduce (yyN)
  299. else
  300. switch (yyErrorFlag) {
  301. case 0:
  302. yyerror("syntax error", yyExpecting(yyState));
  303. if (debug != null) debug.error("syntax error");
  304. goto case 1;
  305. case 1: case 2:
  306. yyErrorFlag = 3;
  307. do {
  308. if ((yyN = yySindex[yyStates[yyTop]]) != 0
  309. && (yyN += Token.yyErrorCode) >= 0 && yyN < yyTable.Length
  310. && yyCheck[yyN] == Token.yyErrorCode) {
  311. if (debug != null)
  312. debug.shift(yyStates[yyTop], yyTable[yyN], 3);
  313. yyState = yyTable[yyN];
  314. yyVal = yyLex.value();
  315. goto yyLoop;
  316. }
  317. if (debug != null) debug.pop(yyStates[yyTop]);
  318. } while (-- yyTop >= 0);
  319. if (debug != null) debug.reject();
  320. throw new yyParser.yyException("irrecoverable syntax error");
  321. case 3:
  322. if (yyToken == 0) {
  323. if (debug != null) debug.reject();
  324. throw new yyParser.yyException("irrecoverable syntax error at end-of-file");
  325. }
  326. if (debug != null)
  327. debug.discard(yyState, yyToken, yyname(yyToken),
  328. yyLex.value());
  329. yyToken = -1;
  330. goto yyDiscarded; // leave stack alone
  331. }
  332. }
  333. int yyV = yyTop + 1-yyLen[yyN];
  334. if (debug != null)
  335. debug.reduce(yyState, yyStates[yyV-1], yyN, yyRule[yyN], yyLen[yyN]);
  336. yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
  337. switch (yyN) {
  338. case 3:
  339. // line 137 "Parser.jay"
  340. {
  341. yyVal = new ExprOR ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  342. }
  343. break;
  344. case 5:
  345. // line 145 "Parser.jay"
  346. {
  347. yyVal = new ExprAND ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  348. }
  349. break;
  350. case 7:
  351. // line 153 "Parser.jay"
  352. {
  353. yyVal = new ExprEQ ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  354. }
  355. break;
  356. case 8:
  357. // line 157 "Parser.jay"
  358. {
  359. yyVal = new ExprNE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  360. }
  361. break;
  362. case 10:
  363. // line 165 "Parser.jay"
  364. {
  365. yyVal = new ExprLT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  366. }
  367. break;
  368. case 11:
  369. // line 169 "Parser.jay"
  370. {
  371. yyVal = new ExprGT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  372. }
  373. break;
  374. case 12:
  375. // line 173 "Parser.jay"
  376. {
  377. yyVal = new ExprLE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  378. }
  379. break;
  380. case 13:
  381. // line 177 "Parser.jay"
  382. {
  383. yyVal = new ExprGE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  384. }
  385. break;
  386. case 15:
  387. // line 185 "Parser.jay"
  388. {
  389. yyVal = new ExprPLUS ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  390. }
  391. break;
  392. case 16:
  393. // line 189 "Parser.jay"
  394. {
  395. yyVal = new ExprMINUS ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  396. }
  397. break;
  398. case 18:
  399. // line 197 "Parser.jay"
  400. {
  401. yyVal = new ExprMULT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  402. }
  403. break;
  404. case 19:
  405. // line 201 "Parser.jay"
  406. {
  407. yyVal = new ExprDIV ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  408. }
  409. break;
  410. case 20:
  411. // line 205 "Parser.jay"
  412. {
  413. yyVal = new ExprMOD ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  414. }
  415. break;
  416. case 22:
  417. // line 213 "Parser.jay"
  418. {
  419. yyVal = new ExprNEG ((Expression) yyVals[0+yyTop]);
  420. }
  421. break;
  422. case 24:
  423. // line 221 "Parser.jay"
  424. {
  425. yyVal = new ExprUNION ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  426. }
  427. break;
  428. case 26:
  429. // line 229 "Parser.jay"
  430. {
  431. yyVal = new ExprRoot ();
  432. }
  433. break;
  434. case 27:
  435. // line 233 "Parser.jay"
  436. {
  437. yyVal = new ExprSLASH (new ExprRoot (), (NodeSet) yyVals[0+yyTop]);
  438. }
  439. break;
  440. case 28:
  441. // line 237 "Parser.jay"
  442. {
  443. ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
  444. yyVal = new ExprSLASH (new ExprSLASH (new ExprRoot (), exprStep), (NodeSet) yyVals[0+yyTop]);
  445. }
  446. break;
  447. case 30:
  448. // line 243 "Parser.jay"
  449. {
  450. yyVal = new ExprSLASH ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
  451. }
  452. break;
  453. case 31:
  454. // line 247 "Parser.jay"
  455. {
  456. ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
  457. yyVal = new ExprSLASH (new ExprSLASH ((Expression) yyVals[-2+yyTop], exprStep), (NodeSet) yyVals[0+yyTop]);
  458. }
  459. break;
  460. case 33:
  461. // line 256 "Parser.jay"
  462. {
  463. yyVal = new ExprSLASH ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
  464. }
  465. break;
  466. case 34:
  467. // line 260 "Parser.jay"
  468. {
  469. ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
  470. yyVal = new ExprSLASH (new ExprSLASH ((Expression) yyVals[-2+yyTop], exprStep), (NodeSet) yyVals[0+yyTop]);
  471. }
  472. break;
  473. case 35:
  474. // line 268 "Parser.jay"
  475. {
  476. yyVal = new ExprStep (new NodeNameTest ((Axes) yyVals[-2+yyTop], (XmlQualifiedName) yyVals[-1+yyTop]), (ExprPredicates) yyVals[0+yyTop]);
  477. }
  478. break;
  479. case 36:
  480. // line 272 "Parser.jay"
  481. {
  482. yyVal = new ExprStep (new NodeTypeTest ((Axes) yyVals[-2+yyTop]), (ExprPredicates) yyVals[0+yyTop]);
  483. }
  484. break;
  485. case 37:
  486. // line 276 "Parser.jay"
  487. {
  488. yyVal = new ExprStep (new NodeTypeTest ((Axes) yyVals[-5+yyTop], (XPathNodeType) yyVals[-4+yyTop], (String) yyVals[-2+yyTop]), (ExprPredicates) yyVals[0+yyTop]);
  489. }
  490. break;
  491. case 38:
  492. // line 280 "Parser.jay"
  493. {
  494. yyVal = new ExprStep (new NodeTypeTest (Axes.Self, XPathNodeType.All));
  495. }
  496. break;
  497. case 39:
  498. // line 284 "Parser.jay"
  499. {
  500. yyVal = new ExprStep (new NodeTypeTest (Axes.Parent, XPathNodeType.All));
  501. }
  502. break;
  503. case 40:
  504. // line 291 "Parser.jay"
  505. {
  506. yyVal = Axes.Child;
  507. }
  508. break;
  509. case 41:
  510. // line 295 "Parser.jay"
  511. {
  512. yyVal = Axes.Attribute;
  513. }
  514. break;
  515. case 42:
  516. // line 299 "Parser.jay"
  517. {
  518. yyVal = yyVals[-1+yyTop];
  519. }
  520. break;
  521. case 43:
  522. // line 305 "Parser.jay"
  523. { yyVal = XPathNodeType.Comment; }
  524. break;
  525. case 44:
  526. // line 306 "Parser.jay"
  527. { yyVal = XPathNodeType.Text; }
  528. break;
  529. case 45:
  530. // line 307 "Parser.jay"
  531. { yyVal = XPathNodeType.ProcessingInstruction; }
  532. break;
  533. case 46:
  534. // line 308 "Parser.jay"
  535. { yyVal = XPathNodeType.All; }
  536. break;
  537. case 48:
  538. // line 315 "Parser.jay"
  539. {
  540. yyVal = new ExprFilter ((Expression) yyVals[-1+yyTop], (Expression) yyVals[0+yyTop]);
  541. }
  542. break;
  543. case 49:
  544. // line 322 "Parser.jay"
  545. {
  546. yyVal = new ExprVariable ((XmlQualifiedName) yyVals[0+yyTop]);
  547. }
  548. break;
  549. case 50:
  550. // line 326 "Parser.jay"
  551. {
  552. yyVal = yyVals[-1+yyTop];
  553. }
  554. break;
  555. case 51:
  556. // line 330 "Parser.jay"
  557. {
  558. yyVal = new ExprLiteral ((String) yyVals[0+yyTop]);
  559. }
  560. break;
  561. case 52:
  562. // line 334 "Parser.jay"
  563. {
  564. yyVal = new ExprNumber ((double) yyVals[0+yyTop]);
  565. }
  566. break;
  567. case 54:
  568. // line 342 "Parser.jay"
  569. {
  570. yyVal = new ExprFunctionCall ((XmlQualifiedName) yyVals[-3+yyTop], (FunctionArguments) yyVals[-1+yyTop]);
  571. }
  572. break;
  573. case 56:
  574. // line 350 "Parser.jay"
  575. {
  576. yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]);
  577. }
  578. break;
  579. case 58:
  580. // line 358 "Parser.jay"
  581. {
  582. yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]);
  583. }
  584. break;
  585. case 60:
  586. // line 367 "Parser.jay"
  587. {
  588. yyVal = new ExprPredicates ((Expression) yyVals[-1+yyTop], (ExprPredicates) yyVals[0+yyTop]);
  589. }
  590. break;
  591. case 61:
  592. // line 374 "Parser.jay"
  593. {
  594. yyVal = yyVals[-1+yyTop];
  595. }
  596. break;
  597. case 62:
  598. // line 380 "Parser.jay"
  599. { yyVal = Axes.Ancestor; }
  600. break;
  601. case 63:
  602. // line 381 "Parser.jay"
  603. { yyVal = Axes.AncestorOrSelf; }
  604. break;
  605. case 64:
  606. // line 382 "Parser.jay"
  607. { yyVal = Axes.Attribute; }
  608. break;
  609. case 65:
  610. // line 383 "Parser.jay"
  611. { yyVal = Axes.Child; }
  612. break;
  613. case 66:
  614. // line 384 "Parser.jay"
  615. { yyVal = Axes.Descendant; }
  616. break;
  617. case 67:
  618. // line 385 "Parser.jay"
  619. { yyVal = Axes.DescendantOrSelf; }
  620. break;
  621. case 68:
  622. // line 386 "Parser.jay"
  623. { yyVal = Axes.Following; }
  624. break;
  625. case 69:
  626. // line 387 "Parser.jay"
  627. { yyVal = Axes.FollowingSibling; }
  628. break;
  629. case 70:
  630. // line 388 "Parser.jay"
  631. { yyVal = Axes.Namespace; }
  632. break;
  633. case 71:
  634. // line 389 "Parser.jay"
  635. { yyVal = Axes.Parent; }
  636. break;
  637. case 72:
  638. // line 390 "Parser.jay"
  639. { yyVal = Axes.Preceding; }
  640. break;
  641. case 73:
  642. // line 391 "Parser.jay"
  643. { yyVal = Axes.PrecedingSibling; }
  644. break;
  645. case 74:
  646. // line 392 "Parser.jay"
  647. { yyVal = Axes.Self; }
  648. break;
  649. // line 673
  650. }
  651. yyTop -= yyLen[yyN];
  652. yyState = yyStates[yyTop];
  653. int yyM = yyLhs[yyN];
  654. if (yyState == 0 && yyM == 0) {
  655. if (debug != null) debug.shift(0, yyFinal);
  656. yyState = yyFinal;
  657. if (yyToken < 0) {
  658. yyToken = yyLex.advance() ? yyLex.token() : 0;
  659. if (debug != null)
  660. debug.lex(yyState, yyToken,yyname(yyToken), yyLex.value());
  661. }
  662. if (yyToken == 0) {
  663. if (debug != null) debug.accept(yyVal);
  664. return yyVal;
  665. }
  666. goto yyLoop;
  667. }
  668. if (((yyN = yyGindex[yyM]) != 0) && ((yyN += yyState) >= 0)
  669. && (yyN < yyTable.Length) && (yyCheck[yyN] == yyState))
  670. yyState = yyTable[yyN];
  671. else
  672. yyState = yyDgoto[yyM];
  673. if (debug != null) debug.shift(yyStates[yyTop], yyState);
  674. goto yyLoop;
  675. }
  676. }
  677. }
  678. static short [] yyLhs = { -1,
  679. 0, 1, 1, 2, 2, 3, 3, 3, 4, 4,
  680. 4, 4, 4, 5, 5, 5, 6, 6, 6, 6,
  681. 7, 7, 8, 8, 9, 9, 9, 9, 9, 9,
  682. 9, 10, 10, 10, 12, 12, 12, 12, 12, 13,
  683. 13, 13, 15, 15, 15, 15, 11, 11, 18, 18,
  684. 18, 18, 18, 20, 21, 21, 22, 22, 14, 14,
  685. 19, 17, 17, 17, 17, 17, 17, 17, 17, 17,
  686. 17, 17, 17, 17, 16, 16,
  687. };
  688. static short [] yyLen = { 2,
  689. 1, 1, 3, 1, 3, 1, 3, 3, 1, 3,
  690. 3, 3, 3, 1, 3, 3, 1, 3, 3, 3,
  691. 1, 2, 1, 3, 1, 1, 2, 2, 1, 3,
  692. 3, 1, 3, 3, 3, 3, 6, 1, 1, 0,
  693. 1, 2, 1, 1, 1, 1, 1, 2, 2, 3,
  694. 1, 1, 1, 4, 0, 2, 0, 3, 0, 2,
  695. 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  696. 1, 1, 1, 1, 0, 1,
  697. };
  698. static short [] yyDefRed = { 0,
  699. 0, 0, 38, 39, 41, 0, 0, 0, 0, 62,
  700. 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
  701. 73, 74, 52, 51, 0, 0, 0, 0, 0, 0,
  702. 0, 17, 0, 23, 0, 0, 32, 0, 0, 47,
  703. 53, 0, 0, 0, 0, 22, 49, 0, 0, 0,
  704. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  705. 0, 0, 0, 0, 0, 0, 48, 0, 43, 44,
  706. 45, 46, 0, 0, 42, 0, 0, 50, 0, 0,
  707. 0, 0, 0, 0, 0, 0, 0, 0, 19, 20,
  708. 18, 24, 33, 34, 0, 0, 0, 36, 0, 35,
  709. 0, 0, 56, 54, 61, 60, 76, 0, 0, 0,
  710. 58, 37,
  711. };
  712. protected static short [] yyDgoto = { 25,
  713. 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
  714. 36, 37, 38, 98, 74, 108, 39, 40, 99, 41,
  715. 77, 103,
  716. };
  717. protected static short [] yySindex = { -254,
  718. -124, -124, 0, 0, 0, -272, -254, -254, -330, 0,
  719. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  720. 0, 0, 0, 0, 0, -269, -246, -255, -204, -248,
  721. -258, 0, -270, 0, -165, -249, 0, -200, -229, 0,
  722. 0, -165, -165, -254, -235, 0, 0, -254, -254, -254,
  723. -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,
  724. -189, -124, -124, -124, -124, -254, 0, -230, 0, 0,
  725. 0, 0, -230, -227, 0, -224, -226, 0, -246, -255,
  726. -204, -204, -248, -248, -248, -248, -258, -258, 0, 0,
  727. 0, 0, 0, 0, -165, -165, -222, 0, -230, 0,
  728. -281, -254, 0, 0, 0, 0, 0, -220, -224, -230,
  729. 0, 0,
  730. };
  731. protected static short [] yyRindex = { -176,
  732. 1, -176, 0, 0, 0, 0, -176, -176, 0, 0,
  733. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  734. 0, 0, 0, 0, 0, 19, 93, 37, 27, 357,
  735. 276, 0, 250, 0, 85, 114, 0, 0, 0, 0,
  736. 0, 140, 169, -192, 0, 0, 0, -176, -176, -176,
  737. -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,
  738. -176, -176, -176, -176, -176, -176, 0, 59, 0, 0,
  739. 0, 0, 59, 0, 0, -218, 0, 0, 336, 484,
  740. 458, 476, 383, 393, 419, 429, 302, 328, 0, 0,
  741. 0, 0, 0, 0, 195, 224, 0, 0, 59, 0,
  742. -216, -176, 0, 0, 0, 0, 0, 0, -218, 59,
  743. 0, 0,
  744. };
  745. protected static short [] yyGindex = { -5,
  746. 0, 15, 16, 48, -29, 44, 9, 0, 21, 11,
  747. 0, 40, 0, -69, 0, 0, 0, 0, 51, 0,
  748. 0, -20,
  749. };
  750. protected static short [] yyTable = { 44,
  751. 26, 45, 47, 100, 1, 2, 48, 3, 4, 64,
  752. 65, 42, 43, 5, 6, 61, 46, 7, 1, 58,
  753. 66, 59, 83, 84, 85, 86, 6, 49, 8, 106,
  754. 9, 50, 51, 56, 57, 75, 4, 78, 76, 66,
  755. 112, 10, 102, 11, 101, 12, 104, 13, 105, 14,
  756. 107, 15, 110, 16, 57, 17, 75, 18, 59, 19,
  757. 97, 20, 79, 21, 80, 22, 89, 90, 91, 1,
  758. 2, 60, 3, 4, 95, 96, 23, 24, 5, 6,
  759. 55, 92, 7, 68, 25, 52, 67, 53, 111, 54,
  760. 55, 40, 2, 62, 63, 9, 109, 81, 82, 87,
  761. 88, 93, 94, 0, 0, 0, 10, 40, 11, 0,
  762. 12, 0, 13, 29, 14, 0, 15, 0, 16, 0,
  763. 17, 69, 18, 70, 19, 71, 20, 72, 21, 40,
  764. 22, 40, 73, 40, 0, 40, 0, 3, 4, 27,
  765. 40, 23, 24, 5, 0, 40, 0, 40, 0, 40,
  766. 0, 40, 0, 0, 0, 0, 40, 0, 0, 0,
  767. 0, 0, 0, 0, 0, 0, 0, 0, 28, 0,
  768. 0, 10, 0, 11, 0, 12, 0, 13, 0, 14,
  769. 0, 15, 0, 16, 0, 17, 0, 18, 0, 19,
  770. 0, 20, 0, 21, 30, 22, 0, 0, 0, 0,
  771. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  772. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  773. 0, 0, 0, 31, 0, 0, 0, 0, 0, 0,
  774. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  775. 0, 0, 0, 0, 0, 0, 0, 0, 0, 21,
  776. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  777. 0, 0, 0, 0, 0, 0, 0, 26, 0, 0,
  778. 0, 26, 0, 26, 26, 14, 26, 0, 26, 0,
  779. 26, 0, 26, 26, 40, 1, 26, 26, 26, 1,
  780. 26, 1, 26, 6, 26, 26, 0, 6, 0, 6,
  781. 6, 15, 6, 4, 0, 0, 0, 4, 0, 4,
  782. 4, 0, 4, 6, 6, 0, 0, 59, 59, 0,
  783. 0, 0, 40, 0, 40, 59, 40, 16, 40, 59,
  784. 26, 59, 59, 40, 59, 3, 59, 0, 59, 0,
  785. 59, 59, 0, 0, 59, 59, 59, 0, 59, 0,
  786. 59, 25, 59, 59, 0, 25, 9, 25, 25, 2,
  787. 25, 0, 25, 2, 25, 2, 25, 25, 2, 0,
  788. 25, 25, 25, 0, 25, 0, 25, 0, 25, 25,
  789. 29, 0, 12, 0, 29, 0, 29, 29, 59, 29,
  790. 0, 29, 13, 29, 0, 29, 29, 0, 0, 29,
  791. 29, 29, 0, 29, 0, 29, 27, 29, 29, 0,
  792. 27, 0, 27, 27, 25, 27, 0, 27, 10, 27,
  793. 0, 27, 27, 0, 0, 27, 27, 27, 11, 27,
  794. 0, 27, 0, 27, 27, 28, 0, 0, 0, 28,
  795. 0, 28, 28, 29, 28, 0, 28, 0, 28, 0,
  796. 28, 28, 0, 0, 28, 28, 28, 7, 28, 0,
  797. 28, 30, 28, 28, 0, 30, 0, 30, 30, 27,
  798. 30, 0, 30, 0, 30, 8, 30, 30, 0, 0,
  799. 30, 30, 30, 5, 30, 0, 30, 0, 30, 30,
  800. 31, 0, 0, 0, 31, 0, 31, 31, 28, 31,
  801. 0, 31, 0, 31, 0, 31, 31, 0, 0, 31,
  802. 31, 31, 0, 31, 0, 31, 21, 31, 31, 0,
  803. 21, 0, 21, 21, 30, 21, 0, 21, 0, 21,
  804. 0, 21, 21, 0, 0, 0, 21, 21, 0, 21,
  805. 0, 21, 14, 21, 21, 0, 14, 0, 14, 14,
  806. 0, 14, 0, 31, 0, 0, 0, 14, 14, 0,
  807. 0, 0, 14, 14, 0, 14, 0, 14, 15, 14,
  808. 14, 0, 15, 0, 15, 15, 0, 15, 0, 21,
  809. 0, 0, 0, 15, 15, 0, 0, 0, 15, 15,
  810. 0, 15, 0, 15, 16, 15, 15, 0, 16, 0,
  811. 16, 16, 3, 16, 0, 0, 3, 0, 3, 16,
  812. 16, 3, 0, 0, 16, 16, 0, 16, 0, 16,
  813. 0, 16, 16, 9, 0, 0, 0, 9, 0, 9,
  814. 9, 0, 9, 0, 0, 0, 0, 0, 0, 0,
  815. 0, 0, 0, 9, 9, 0, 9, 0, 9, 12,
  816. 9, 9, 0, 12, 0, 12, 12, 0, 12, 13,
  817. 0, 0, 0, 13, 0, 13, 13, 0, 13, 12,
  818. 12, 0, 12, 0, 12, 0, 12, 12, 0, 13,
  819. 13, 0, 13, 0, 13, 10, 13, 13, 0, 10,
  820. 0, 10, 10, 0, 10, 11, 0, 0, 0, 11,
  821. 0, 11, 11, 0, 11, 10, 10, 0, 10, 0,
  822. 10, 0, 10, 10, 0, 11, 11, 0, 11, 0,
  823. 11, 0, 11, 11, 7, 0, 0, 0, 7, 0,
  824. 7, 7, 0, 7, 0, 0, 0, 0, 0, 0,
  825. 0, 0, 8, 0, 7, 7, 8, 0, 8, 8,
  826. 5, 8, 0, 0, 5, 0, 5, 5, 0, 5,
  827. 0, 0, 8, 8,
  828. };
  829. protected static short [] yyCheck = { 272,
  830. 0, 7, 333, 73, 259, 260, 276, 262, 263, 259,
  831. 260, 1, 2, 268, 269, 286, 8, 272, 0, 278,
  832. 270, 280, 52, 53, 54, 55, 0, 274, 283, 99,
  833. 285, 287, 288, 282, 283, 265, 0, 273, 44, 270,
  834. 110, 296, 267, 298, 272, 300, 273, 302, 271, 304,
  835. 332, 306, 273, 308, 273, 310, 273, 312, 0, 314,
  836. 66, 316, 48, 318, 49, 320, 58, 59, 60, 259,
  837. 260, 330, 262, 263, 64, 65, 331, 332, 268, 269,
  838. 273, 61, 272, 284, 0, 290, 36, 292, 109, 294,
  839. 295, 284, 0, 259, 260, 285, 102, 50, 51, 56,
  840. 57, 62, 63, -1, -1, -1, 296, 284, 298, -1,
  841. 300, -1, 302, 0, 304, -1, 306, -1, 308, -1,
  842. 310, 322, 312, 324, 314, 326, 316, 328, 318, 322,
  843. 320, 324, 333, 326, -1, 328, -1, 262, 263, 0,
  844. 333, 331, 332, 268, -1, 322, -1, 324, -1, 326,
  845. -1, 328, -1, -1, -1, -1, 333, -1, -1, -1,
  846. -1, -1, -1, -1, -1, -1, -1, -1, 0, -1,
  847. -1, 296, -1, 298, -1, 300, -1, 302, -1, 304,
  848. -1, 306, -1, 308, -1, 310, -1, 312, -1, 314,
  849. -1, 316, -1, 318, 0, 320, -1, -1, -1, -1,
  850. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  851. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  852. -1, -1, -1, 0, -1, -1, -1, -1, -1, -1,
  853. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  854. -1, -1, -1, -1, -1, -1, -1, -1, -1, 0,
  855. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  856. -1, -1, -1, -1, -1, -1, -1, 267, -1, -1,
  857. -1, 271, -1, 273, 274, 0, 276, -1, 278, -1,
  858. 280, -1, 282, 283, 284, 267, 286, 287, 288, 271,
  859. 290, 273, 292, 267, 294, 295, -1, 271, -1, 273,
  860. 274, 0, 276, 267, -1, -1, -1, 271, -1, 273,
  861. 274, -1, 276, 287, 288, -1, -1, 259, 260, -1,
  862. -1, -1, 322, -1, 324, 267, 326, 0, 328, 271,
  863. 330, 273, 274, 333, 276, 0, 278, -1, 280, -1,
  864. 282, 283, -1, -1, 286, 287, 288, -1, 290, -1,
  865. 292, 267, 294, 295, -1, 271, 0, 273, 274, 267,
  866. 276, -1, 278, 271, 280, 273, 282, 283, 276, -1,
  867. 286, 287, 288, -1, 290, -1, 292, -1, 294, 295,
  868. 267, -1, 0, -1, 271, -1, 273, 274, 330, 276,
  869. -1, 278, 0, 280, -1, 282, 283, -1, -1, 286,
  870. 287, 288, -1, 290, -1, 292, 267, 294, 295, -1,
  871. 271, -1, 273, 274, 330, 276, -1, 278, 0, 280,
  872. -1, 282, 283, -1, -1, 286, 287, 288, 0, 290,
  873. -1, 292, -1, 294, 295, 267, -1, -1, -1, 271,
  874. -1, 273, 274, 330, 276, -1, 278, -1, 280, -1,
  875. 282, 283, -1, -1, 286, 287, 288, 0, 290, -1,
  876. 292, 267, 294, 295, -1, 271, -1, 273, 274, 330,
  877. 276, -1, 278, -1, 280, 0, 282, 283, -1, -1,
  878. 286, 287, 288, 0, 290, -1, 292, -1, 294, 295,
  879. 267, -1, -1, -1, 271, -1, 273, 274, 330, 276,
  880. -1, 278, -1, 280, -1, 282, 283, -1, -1, 286,
  881. 287, 288, -1, 290, -1, 292, 267, 294, 295, -1,
  882. 271, -1, 273, 274, 330, 276, -1, 278, -1, 280,
  883. -1, 282, 283, -1, -1, -1, 287, 288, -1, 290,
  884. -1, 292, 267, 294, 295, -1, 271, -1, 273, 274,
  885. -1, 276, -1, 330, -1, -1, -1, 282, 283, -1,
  886. -1, -1, 287, 288, -1, 290, -1, 292, 267, 294,
  887. 295, -1, 271, -1, 273, 274, -1, 276, -1, 330,
  888. -1, -1, -1, 282, 283, -1, -1, -1, 287, 288,
  889. -1, 290, -1, 292, 267, 294, 295, -1, 271, -1,
  890. 273, 274, 267, 276, -1, -1, 271, -1, 273, 282,
  891. 283, 276, -1, -1, 287, 288, -1, 290, -1, 292,
  892. -1, 294, 295, 267, -1, -1, -1, 271, -1, 273,
  893. 274, -1, 276, -1, -1, -1, -1, -1, -1, -1,
  894. -1, -1, -1, 287, 288, -1, 290, -1, 292, 267,
  895. 294, 295, -1, 271, -1, 273, 274, -1, 276, 267,
  896. -1, -1, -1, 271, -1, 273, 274, -1, 276, 287,
  897. 288, -1, 290, -1, 292, -1, 294, 295, -1, 287,
  898. 288, -1, 290, -1, 292, 267, 294, 295, -1, 271,
  899. -1, 273, 274, -1, 276, 267, -1, -1, -1, 271,
  900. -1, 273, 274, -1, 276, 287, 288, -1, 290, -1,
  901. 292, -1, 294, 295, -1, 287, 288, -1, 290, -1,
  902. 292, -1, 294, 295, 267, -1, -1, -1, 271, -1,
  903. 273, 274, -1, 276, -1, -1, -1, -1, -1, -1,
  904. -1, -1, 267, -1, 287, 288, 271, -1, 273, 274,
  905. 267, 276, -1, -1, 271, -1, 273, 274, -1, 276,
  906. -1, -1, 287, 288,
  907. };
  908. // line 401 "Parser.jay"
  909. }
  910. // line 936
  911. namespace yydebug {
  912. using System;
  913. public interface yyDebug {
  914. void push (int state, Object value);
  915. void lex (int state, int token, string name, Object value);
  916. void shift (int from, int to, int errorFlag);
  917. void pop (int state);
  918. void discard (int state, int token, string name, Object value);
  919. void reduce (int from, int to, int rule, string text, int len);
  920. void shift (int from, int to);
  921. void accept (Object value);
  922. void error (string message);
  923. void reject ();
  924. }
  925. class yyDebugSimple : yyDebug {
  926. void println (string s){
  927. Console.WriteLine (s);
  928. }
  929. public void push (int state, Object value) {
  930. println ("push\tstate "+state+"\tvalue "+value);
  931. }
  932. public void lex (int state, int token, string name, Object value) {
  933. println("lex\tstate "+state+"\treading "+name+"\tvalue "+value);
  934. }
  935. public void shift (int from, int to, int errorFlag) {
  936. switch (errorFlag) {
  937. default: // normally
  938. println("shift\tfrom state "+from+" to "+to);
  939. break;
  940. case 0: case 1: case 2: // in error recovery
  941. println("shift\tfrom state "+from+" to "+to
  942. +"\t"+errorFlag+" left to recover");
  943. break;
  944. case 3: // normally
  945. println("shift\tfrom state "+from+" to "+to+"\ton error");
  946. break;
  947. }
  948. }
  949. public void pop (int state) {
  950. println("pop\tstate "+state+"\ton error");
  951. }
  952. public void discard (int state, int token, string name, Object value) {
  953. println("discard\tstate "+state+"\ttoken "+name+"\tvalue "+value);
  954. }
  955. public void reduce (int from, int to, int rule, string text, int len) {
  956. println("reduce\tstate "+from+"\tuncover "+to
  957. +"\trule ("+rule+") "+text);
  958. }
  959. public void shift (int from, int to) {
  960. println("goto\tfrom state "+from+" to "+to);
  961. }
  962. public void accept (Object value) {
  963. println("accept\tvalue "+value);
  964. }
  965. public void error (string message) {
  966. println("error\t"+message);
  967. }
  968. public void reject () {
  969. println("reject");
  970. }
  971. }
  972. }
  973. // %token constants
  974. class Token {
  975. public const int ERROR = 257;
  976. public const int EOF = 258;
  977. public const int SLASH = 259;
  978. public const int SLASH2 = 260;
  979. public const int DOT = 262;
  980. public const int DOT2 = 263;
  981. public const int COLON2 = 265;
  982. public const int COMMA = 267;
  983. public const int AT = 268;
  984. public const int FUNCTION_NAME = 269;
  985. public const int BRACKET_OPEN = 270;
  986. public const int BRACKET_CLOSE = 271;
  987. public const int PAREN_OPEN = 272;
  988. public const int PAREN_CLOSE = 273;
  989. public const int AND = 274;
  990. public const int and = 275;
  991. public const int OR = 276;
  992. public const int or = 277;
  993. public const int DIV = 278;
  994. public const int div = 279;
  995. public const int MOD = 280;
  996. public const int mod = 281;
  997. public const int PLUS = 282;
  998. public const int MINUS = 283;
  999. public const int ASTERISK = 284;
  1000. public const int DOLLAR = 285;
  1001. public const int BAR = 286;
  1002. public const int EQ = 287;
  1003. public const int NE = 288;
  1004. public const int LE = 290;
  1005. public const int GE = 292;
  1006. public const int LT = 294;
  1007. public const int GT = 295;
  1008. public const int ANCESTOR = 296;
  1009. public const int ancestor = 297;
  1010. public const int ANCESTOR_OR_SELF = 298;
  1011. public const int ATTRIBUTE = 300;
  1012. public const int attribute = 301;
  1013. public const int CHILD = 302;
  1014. public const int child = 303;
  1015. public const int DESCENDANT = 304;
  1016. public const int descendant = 305;
  1017. public const int DESCENDANT_OR_SELF = 306;
  1018. public const int FOLLOWING = 308;
  1019. public const int following = 309;
  1020. public const int FOLLOWING_SIBLING = 310;
  1021. public const int sibling = 311;
  1022. public const int NAMESPACE = 312;
  1023. public const int NameSpace = 313;
  1024. public const int PARENT = 314;
  1025. public const int parent = 315;
  1026. public const int PRECEDING = 316;
  1027. public const int preceding = 317;
  1028. public const int PRECEDING_SIBLING = 318;
  1029. public const int SELF = 320;
  1030. public const int self = 321;
  1031. public const int COMMENT = 322;
  1032. public const int comment = 323;
  1033. public const int TEXT = 324;
  1034. public const int text = 325;
  1035. public const int PROCESSING_INSTRUCTION = 326;
  1036. public const int NODE = 328;
  1037. public const int node = 329;
  1038. public const int MULTIPLY = 330;
  1039. public const int NUMBER = 331;
  1040. public const int LITERAL = 332;
  1041. public const int QName = 333;
  1042. public const int yyErrorCode = 256;
  1043. }
  1044. namespace yyParser {
  1045. using System;
  1046. /** thrown for irrecoverable syntax errors and stack overflow.
  1047. */
  1048. public class yyException : System.Exception {
  1049. public yyException (string message) : base (message) {
  1050. }
  1051. }
  1052. /** must be implemented by a scanner object to supply input to the parser.
  1053. */
  1054. public interface yyInput {
  1055. /** move on to next token.
  1056. @return false if positioned beyond tokens.
  1057. @throws IOException on input error.
  1058. */
  1059. bool advance (); // throws java.io.IOException;
  1060. /** classifies current token.
  1061. Should not be called if advance() returned false.
  1062. @return current %token or single character.
  1063. */
  1064. int token ();
  1065. /** associated with current token.
  1066. Should not be called if advance() returned false.
  1067. @return value for token().
  1068. */
  1069. Object value ();
  1070. }
  1071. }
  1072. } // close outermost namespace, that MUST HAVE BEEN opened in the prolog