Parser.cs 39 KB

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