Parser.cs 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109
  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 : LocationPath",
  93. "PathExpr : FilterExpr",
  94. "PathExpr : FilterExpr SLASH RelativeLocationPath",
  95. "PathExpr : FilterExpr SLASH2 RelativeLocationPath",
  96. "LocationPath : RelativeLocationPath",
  97. "LocationPath : AbsoluteLocationPath",
  98. "AbsoluteLocationPath : SLASH",
  99. "AbsoluteLocationPath : SLASH RelativeLocationPath",
  100. "AbsoluteLocationPath : SLASH2 RelativeLocationPath",
  101. "RelativeLocationPath : Step",
  102. "RelativeLocationPath : RelativeLocationPath SLASH Step",
  103. "RelativeLocationPath : RelativeLocationPath SLASH2 Step",
  104. "Step : PredicatedStep",
  105. "Step : DOT",
  106. "Step : DOT2",
  107. "PredicatedStep : AxisTest",
  108. "PredicatedStep : PredicatedStep Predicate",
  109. "AxisTest : AxisSpecifier QName",
  110. "AxisTest : AxisSpecifier ASTERISK",
  111. "AxisTest : AxisSpecifier NodeType PAREN_OPEN OptionalLiteral PAREN_CLOSE",
  112. "AxisSpecifier :",
  113. "AxisSpecifier : AT",
  114. "AxisSpecifier : AxisName COLON2",
  115. "NodeType : COMMENT",
  116. "NodeType : TEXT",
  117. "NodeType : PROCESSING_INSTRUCTION",
  118. "NodeType : NODE",
  119. "FilterExpr : PrimaryExpr",
  120. "FilterExpr : FilterExpr Predicate",
  121. "PrimaryExpr : DOLLAR QName",
  122. "PrimaryExpr : PAREN_OPEN Expr PAREN_CLOSE",
  123. "PrimaryExpr : LITERAL",
  124. "PrimaryExpr : NUMBER",
  125. "PrimaryExpr : FunctionCall",
  126. "FunctionCall : FUNCTION_NAME PAREN_OPEN OptionalArgumentList PAREN_CLOSE",
  127. "OptionalArgumentList :",
  128. "OptionalArgumentList : Expr OptionalArgumentListTail",
  129. "OptionalArgumentListTail :",
  130. "OptionalArgumentListTail : COMMA Expr OptionalArgumentListTail",
  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 133 "Parser.jay"
  340. {
  341. yyVal = new ExprOR ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  342. }
  343. break;
  344. case 5:
  345. // line 141 "Parser.jay"
  346. {
  347. yyVal = new ExprAND ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  348. }
  349. break;
  350. case 7:
  351. // line 149 "Parser.jay"
  352. {
  353. yyVal = new ExprEQ ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  354. }
  355. break;
  356. case 8:
  357. // line 153 "Parser.jay"
  358. {
  359. yyVal = new ExprNE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  360. }
  361. break;
  362. case 10:
  363. // line 161 "Parser.jay"
  364. {
  365. yyVal = new ExprLT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  366. }
  367. break;
  368. case 11:
  369. // line 165 "Parser.jay"
  370. {
  371. yyVal = new ExprGT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  372. }
  373. break;
  374. case 12:
  375. // line 169 "Parser.jay"
  376. {
  377. yyVal = new ExprLE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  378. }
  379. break;
  380. case 13:
  381. // line 173 "Parser.jay"
  382. {
  383. yyVal = new ExprGE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  384. }
  385. break;
  386. case 15:
  387. // line 181 "Parser.jay"
  388. {
  389. yyVal = new ExprPLUS ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  390. }
  391. break;
  392. case 16:
  393. // line 185 "Parser.jay"
  394. {
  395. yyVal = new ExprMINUS ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  396. }
  397. break;
  398. case 18:
  399. // line 193 "Parser.jay"
  400. {
  401. yyVal = new ExprMULT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  402. }
  403. break;
  404. case 19:
  405. // line 197 "Parser.jay"
  406. {
  407. yyVal = new ExprDIV ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  408. }
  409. break;
  410. case 20:
  411. // line 201 "Parser.jay"
  412. {
  413. yyVal = new ExprMOD ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  414. }
  415. break;
  416. case 22:
  417. // line 209 "Parser.jay"
  418. {
  419. yyVal = new ExprNEG ((Expression) yyVals[0+yyTop]);
  420. }
  421. break;
  422. case 24:
  423. // line 217 "Parser.jay"
  424. {
  425. yyVal = new ExprUNION ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
  426. }
  427. break;
  428. case 27:
  429. // line 226 "Parser.jay"
  430. {
  431. yyVal = new ExprSLASH ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
  432. }
  433. break;
  434. case 28:
  435. // line 230 "Parser.jay"
  436. {
  437. NodeTest test = new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All);
  438. yyVal = new ExprSLASH (new ExprSLASH ((Expression) yyVals[-2+yyTop], test), (NodeSet) yyVals[0+yyTop]);
  439. }
  440. break;
  441. case 31:
  442. // line 243 "Parser.jay"
  443. {
  444. yyVal = new ExprRoot ();
  445. }
  446. break;
  447. case 32:
  448. // line 247 "Parser.jay"
  449. {
  450. yyVal = new ExprSLASH (new ExprRoot (), (NodeSet) yyVals[0+yyTop]);
  451. }
  452. break;
  453. case 33:
  454. // line 251 "Parser.jay"
  455. {
  456. NodeTest test = new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All);
  457. yyVal = new ExprSLASH (new ExprSLASH (new ExprRoot (), test), (NodeSet) yyVals[0+yyTop]);
  458. }
  459. break;
  460. case 35:
  461. // line 260 "Parser.jay"
  462. {
  463. yyVal = new ExprSLASH ((NodeSet) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
  464. }
  465. break;
  466. case 36:
  467. // line 264 "Parser.jay"
  468. {
  469. NodeTest test = new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All);
  470. yyVal = new ExprSLASH (new ExprSLASH ((NodeSet) yyVals[-2+yyTop], test), (NodeSet) yyVals[0+yyTop]);
  471. }
  472. break;
  473. case 38:
  474. // line 273 "Parser.jay"
  475. {
  476. yyVal = new NodeTypeTest (Axes.Self, XPathNodeType.All);
  477. }
  478. break;
  479. case 39:
  480. // line 277 "Parser.jay"
  481. {
  482. yyVal = new NodeTypeTest (Axes.Parent, XPathNodeType.All);
  483. }
  484. break;
  485. case 41:
  486. // line 285 "Parser.jay"
  487. {
  488. yyVal = new ExprFilter ((NodeSet) yyVals[-1+yyTop], (Expression) yyVals[0+yyTop]);
  489. }
  490. break;
  491. case 42:
  492. // line 292 "Parser.jay"
  493. {
  494. yyVal = new NodeNameTest ((Axes) yyVals[-1+yyTop], (XmlQualifiedName) yyVals[0+yyTop]);
  495. }
  496. break;
  497. case 43:
  498. // line 296 "Parser.jay"
  499. {
  500. yyVal = new NodeTypeTest ((Axes) yyVals[-1+yyTop]);
  501. }
  502. break;
  503. case 44:
  504. // line 300 "Parser.jay"
  505. {
  506. yyVal = new NodeTypeTest ((Axes) yyVals[-4+yyTop], (XPathNodeType) yyVals[-3+yyTop], (String) yyVals[-1+yyTop]);
  507. }
  508. break;
  509. case 45:
  510. // line 307 "Parser.jay"
  511. {
  512. yyVal = Axes.Child;
  513. }
  514. break;
  515. case 46:
  516. // line 311 "Parser.jay"
  517. {
  518. yyVal = Axes.Attribute;
  519. }
  520. break;
  521. case 47:
  522. // line 315 "Parser.jay"
  523. {
  524. yyVal = yyVals[-1+yyTop];
  525. }
  526. break;
  527. case 48:
  528. // line 321 "Parser.jay"
  529. { yyVal = XPathNodeType.Comment; }
  530. break;
  531. case 49:
  532. // line 322 "Parser.jay"
  533. { yyVal = XPathNodeType.Text; }
  534. break;
  535. case 50:
  536. // line 323 "Parser.jay"
  537. { yyVal = XPathNodeType.ProcessingInstruction; }
  538. break;
  539. case 51:
  540. // line 324 "Parser.jay"
  541. { yyVal = XPathNodeType.All; }
  542. break;
  543. case 53:
  544. // line 331 "Parser.jay"
  545. {
  546. yyVal = new ExprFilter ((Expression) yyVals[-1+yyTop], (Expression) yyVals[0+yyTop]);
  547. }
  548. break;
  549. case 54:
  550. // line 338 "Parser.jay"
  551. {
  552. yyVal = new ExprVariable ((XmlQualifiedName) yyVals[0+yyTop]);
  553. }
  554. break;
  555. case 55:
  556. // line 342 "Parser.jay"
  557. {
  558. yyVal = yyVals[-1+yyTop];
  559. }
  560. break;
  561. case 56:
  562. // line 346 "Parser.jay"
  563. {
  564. yyVal = new ExprLiteral ((String) yyVals[0+yyTop]);
  565. }
  566. break;
  567. case 57:
  568. // line 350 "Parser.jay"
  569. {
  570. yyVal = new ExprNumber ((double) yyVals[0+yyTop]);
  571. }
  572. break;
  573. case 59:
  574. // line 358 "Parser.jay"
  575. {
  576. yyVal = new ExprFunctionCall ((XmlQualifiedName) yyVals[-3+yyTop], (FunctionArguments) yyVals[-1+yyTop]);
  577. }
  578. break;
  579. case 61:
  580. // line 366 "Parser.jay"
  581. {
  582. yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]);
  583. }
  584. break;
  585. case 63:
  586. // line 374 "Parser.jay"
  587. {
  588. yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]);
  589. }
  590. break;
  591. case 64:
  592. // line 381 "Parser.jay"
  593. {
  594. yyVal = yyVals[-1+yyTop];
  595. }
  596. break;
  597. case 65:
  598. // line 387 "Parser.jay"
  599. { yyVal = Axes.Ancestor; }
  600. break;
  601. case 66:
  602. // line 388 "Parser.jay"
  603. { yyVal = Axes.AncestorOrSelf; }
  604. break;
  605. case 67:
  606. // line 389 "Parser.jay"
  607. { yyVal = Axes.Attribute; }
  608. break;
  609. case 68:
  610. // line 390 "Parser.jay"
  611. { yyVal = Axes.Child; }
  612. break;
  613. case 69:
  614. // line 391 "Parser.jay"
  615. { yyVal = Axes.Descendant; }
  616. break;
  617. case 70:
  618. // line 392 "Parser.jay"
  619. { yyVal = Axes.DescendantOrSelf; }
  620. break;
  621. case 71:
  622. // line 393 "Parser.jay"
  623. { yyVal = Axes.Following; }
  624. break;
  625. case 72:
  626. // line 394 "Parser.jay"
  627. { yyVal = Axes.FollowingSibling; }
  628. break;
  629. case 73:
  630. // line 395 "Parser.jay"
  631. { yyVal = Axes.Namespace; }
  632. break;
  633. case 74:
  634. // line 396 "Parser.jay"
  635. { yyVal = Axes.Parent; }
  636. break;
  637. case 75:
  638. // line 397 "Parser.jay"
  639. { yyVal = Axes.Preceding; }
  640. break;
  641. case 76:
  642. // line 398 "Parser.jay"
  643. { yyVal = Axes.PrecedingSibling; }
  644. break;
  645. case 77:
  646. // line 399 "Parser.jay"
  647. { yyVal = Axes.Self; }
  648. break;
  649. // line 672
  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, 10, 10,
  682. 13, 13, 13, 12, 12, 12, 14, 14, 14, 15,
  683. 15, 16, 16, 16, 18, 18, 18, 19, 19, 19,
  684. 19, 11, 11, 22, 22, 22, 22, 22, 23, 24,
  685. 24, 25, 25, 17, 21, 21, 21, 21, 21, 21,
  686. 21, 21, 21, 21, 21, 21, 21, 20, 20,
  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, 3, 3, 1, 1,
  692. 1, 2, 2, 1, 3, 3, 1, 1, 1, 1,
  693. 2, 2, 2, 5, 0, 1, 2, 1, 1, 1,
  694. 1, 1, 2, 2, 3, 1, 1, 1, 4, 0,
  695. 2, 0, 3, 3, 1, 1, 1, 1, 1, 1,
  696. 1, 1, 1, 1, 1, 1, 1, 0, 1,
  697. };
  698. static short [] yyDefRed = { 0,
  699. 0, 0, 38, 39, 46, 0, 0, 0, 0, 65,
  700. 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
  701. 76, 77, 57, 56, 0, 0, 0, 0, 0, 0,
  702. 0, 17, 0, 23, 25, 0, 0, 30, 34, 0,
  703. 40, 0, 0, 52, 58, 0, 0, 0, 0, 22,
  704. 54, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  705. 0, 0, 0, 0, 0, 0, 0, 0, 53, 0,
  706. 0, 41, 43, 48, 49, 50, 51, 42, 0, 47,
  707. 0, 0, 55, 0, 0, 0, 0, 0, 0, 0,
  708. 0, 0, 0, 19, 20, 18, 24, 0, 0, 0,
  709. 35, 36, 0, 0, 61, 59, 64, 79, 0, 0,
  710. 44, 63,
  711. };
  712. protected static short [] yyDgoto = { 25,
  713. 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
  714. 36, 37, 38, 39, 40, 41, 69, 42, 79, 109,
  715. 43, 44, 45, 82, 105,
  716. };
  717. protected static short [] yySindex = { -254,
  718. -130, -130, 0, 0, 0, -270, -254, -254, -326, 0,
  719. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  720. 0, 0, 0, 0, 0, -266, -262, -271, -256, -201,
  721. -267, 0, -258, 0, 0, -238, -169, 0, 0, -250,
  722. 0, -178, -235, 0, 0, -169, -169, -254, -233, 0,
  723. 0, -254, -254, -254, -254, -254, -254, -254, -254, -254,
  724. -254, -254, -254, -254, -189, -130, -130, -254, 0, -130,
  725. -130, 0, 0, 0, 0, 0, 0, 0, -237, 0,
  726. -224, -228, 0, -262, -271, -256, -256, -201, -201, -201,
  727. -201, -267, -267, 0, 0, 0, 0, -169, -169, -222,
  728. 0, 0, -285, -254, 0, 0, 0, 0, -220, -224,
  729. 0, 0,
  730. };
  731. protected static short [] yyRindex = { -168,
  732. 1, -168, 0, 0, 0, 0, -168, -168, 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, 0, 85, 114, 0, 0, 59,
  736. 0, 0, 0, 0, 0, 140, 169, -198, 0, 0,
  737. 0, -168, -168, -168, -168, -168, -168, -168, -168, -168,
  738. -168, -168, -168, -168, -168, -168, -168, -168, 0, -168,
  739. -168, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  740. -218, 0, 0, 336, 484, 458, 476, 383, 393, 419,
  741. 429, 302, 328, 0, 0, 0, 0, 195, 224, 0,
  742. 0, 0, -216, -168, 0, 0, 0, 0, 0, -218,
  743. 0, 0,
  744. };
  745. protected static short [] yyGindex = { -7,
  746. 0, -1, 12, 40, -33, 38, 25, 0, 7, 0,
  747. 0, 2, 0, 30, 0, 0, 36, 0, 0, 0,
  748. 0, 0, 0, 0, -43,
  749. };
  750. protected static short [] yyTable = { 49,
  751. 31, 48, 46, 47, 1, 2, 51, 3, 4, 52,
  752. 62, 53, 63, 5, 6, 54, 55, 7, 1, 68,
  753. 66, 67, 88, 89, 90, 91, 6, 65, 8, 80,
  754. 9, 68, 50, 56, 103, 57, 4, 58, 59, 83,
  755. 81, 10, 104, 11, 106, 12, 108, 13, 107, 14,
  756. 84, 15, 111, 16, 62, 17, 78, 18, 37, 19,
  757. 100, 20, 64, 21, 85, 22, 112, 98, 99, 1,
  758. 2, 97, 3, 4, 60, 72, 23, 24, 5, 6,
  759. 60, 61, 7, 0, 26, 45, 94, 95, 96, 70,
  760. 71, 0, 2, 86, 87, 9, 110, 92, 93, 101,
  761. 102, 0, 0, 0, 0, 73, 10, 0, 11, 0,
  762. 12, 0, 13, 29, 14, 45, 15, 0, 16, 0,
  763. 17, 0, 18, 45, 19, 45, 20, 45, 21, 45,
  764. 22, 3, 4, 0, 45, 0, 0, 5, 0, 32,
  765. 0, 23, 24, 74, 0, 75, 0, 76, 0, 77,
  766. 0, 0, 0, 45, 78, 45, 0, 45, 0, 45,
  767. 0, 0, 0, 0, 45, 10, 0, 11, 33, 12,
  768. 0, 13, 0, 14, 0, 15, 0, 16, 0, 17,
  769. 0, 18, 0, 19, 0, 20, 0, 21, 0, 22,
  770. 0, 0, 0, 0, 27, 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, 0,
  773. 0, 0, 0, 28, 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, 31, 0, 0,
  778. 0, 31, 0, 31, 31, 14, 31, 0, 31, 0,
  779. 31, 0, 31, 31, 45, 1, 31, 31, 31, 1,
  780. 31, 1, 31, 6, 31, 31, 0, 6, 0, 6,
  781. 6, 15, 6, 4, 0, 0, 0, 4, 0, 4,
  782. 4, 0, 4, 6, 6, 0, 0, 37, 37, 0,
  783. 0, 0, 45, 0, 45, 37, 45, 16, 45, 37,
  784. 31, 37, 37, 45, 37, 3, 37, 0, 37, 0,
  785. 37, 37, 0, 0, 37, 37, 37, 0, 37, 0,
  786. 37, 26, 37, 37, 0, 26, 9, 26, 26, 2,
  787. 26, 0, 26, 2, 26, 2, 26, 26, 2, 0,
  788. 26, 26, 26, 0, 26, 0, 26, 0, 26, 26,
  789. 29, 0, 12, 0, 29, 0, 29, 29, 37, 29,
  790. 0, 29, 13, 29, 0, 29, 29, 0, 0, 29,
  791. 29, 29, 0, 29, 0, 29, 32, 29, 29, 0,
  792. 32, 0, 32, 32, 26, 32, 0, 32, 10, 32,
  793. 0, 32, 32, 0, 0, 32, 32, 32, 11, 32,
  794. 0, 32, 0, 32, 32, 33, 0, 0, 0, 33,
  795. 0, 33, 33, 29, 33, 0, 33, 0, 33, 0,
  796. 33, 33, 0, 0, 33, 33, 33, 7, 33, 0,
  797. 33, 27, 33, 33, 0, 27, 0, 27, 27, 32,
  798. 27, 0, 27, 0, 27, 8, 27, 27, 0, 0,
  799. 27, 27, 27, 5, 27, 0, 27, 0, 27, 27,
  800. 28, 0, 0, 0, 28, 0, 28, 28, 33, 28,
  801. 0, 28, 0, 28, 0, 28, 28, 0, 0, 28,
  802. 28, 28, 0, 28, 0, 28, 21, 28, 28, 0,
  803. 21, 0, 21, 21, 27, 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, 28, 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 = { 7,
  830. 0, 272, 1, 2, 259, 260, 333, 262, 263, 276,
  831. 278, 274, 280, 268, 269, 287, 288, 272, 0, 270,
  832. 259, 260, 56, 57, 58, 59, 0, 286, 283, 265,
  833. 285, 270, 8, 290, 272, 292, 0, 294, 295, 273,
  834. 48, 296, 267, 298, 273, 300, 332, 302, 271, 304,
  835. 52, 306, 273, 308, 273, 310, 273, 312, 0, 314,
  836. 68, 316, 330, 318, 53, 320, 110, 66, 67, 259,
  837. 260, 65, 262, 263, 273, 40, 331, 332, 268, 269,
  838. 282, 283, 272, -1, 0, 284, 62, 63, 64, 259,
  839. 260, -1, 0, 54, 55, 285, 104, 60, 61, 70,
  840. 71, -1, -1, -1, -1, 284, 296, -1, 298, -1,
  841. 300, -1, 302, 0, 304, 284, 306, -1, 308, -1,
  842. 310, -1, 312, 322, 314, 324, 316, 326, 318, 328,
  843. 320, 262, 263, -1, 333, -1, -1, 268, -1, 0,
  844. -1, 331, 332, 322, -1, 324, -1, 326, -1, 328,
  845. -1, -1, -1, 322, 333, 324, -1, 326, -1, 328,
  846. -1, -1, -1, -1, 333, 296, -1, 298, 0, 300,
  847. -1, 302, -1, 304, -1, 306, -1, 308, -1, 310,
  848. -1, 312, -1, 314, -1, 316, -1, 318, -1, 320,
  849. -1, -1, -1, -1, 0, -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, -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 408 "Parser.jay"
  909. }
  910. // line 935
  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