1 using System;
2 using System.Collections;
3 using System.Lex;
4 using System.Parsing;
5 using XPathTokens;
6
7 public static class XPathParser
8 {
9 public static UniquePtr<System.XPath.XPathExpr> Parse(XPathLexer& lexer)
10 {
11 UniquePtr<System.XPath.XPathExpr> value;
12 #if (DEBUG)
13 if (lexer.Log() != null)
14 {
15 lexer.Log()->WriteBeginRule(u"parse");
16 lexer.Log()->IncIndent();
17 }
18 #endif
19 ++lexer;
20 System.Lex.Span span = lexer.GetSpan();
21 Match match = Expr(lexer);
22 value.Reset(cast<System.XPath.XPathExpr*>(match.value));
23 #if (DEBUG)
24 if (lexer.Log() != null)
25 {
26 lexer.Log()->DecIndent();
27 lexer.Log()->WriteEndRule(u"parse");
28 }
29 #endif
30 if (match.hit)
31 {
32 if (*lexer == System.Lex.END_TOKEN)
33 {
34 return value;
35 }
36 else
37 {
38 lexer.ThrowExpectationFailure(lexer.GetSpan(), GetEndTokenInfo());
39 }
40 }
41 else
42 {
43 lexer.ThrowExpectationFailure(span, u"Expr");
44 }
45 return value;
46 }
47 public static Match Expr(XPathLexer& lexer)
48 {
49 #if (DEBUG)
50 Span debugSpan;
51 bool writeToLog = lexer.Log() != null;
52 if (writeToLog)
53 {
54 debugSpan = lexer.GetSpan();
55 System.Lex.WriteBeginRuleToLog(lexer, u"Expr");
56 }
57 #endif
58 UniquePtr<System.XPath.XPathExpr> orExpr;
59 Match match(false);
60 Match* parentMatch0 = &match;
61 {
62 long pos = lexer.GetPos();
63 Match match = XPathParser.OrExpr(lexer);
64 orExpr.Reset(cast<System.XPath.XPathExpr*>(match.value));
65 if (match.hit)
66 {
67 {
68 #if (DEBUG)
69 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Expr");
70 #endif
71 return Match(true, orExpr.Release());
72 }
73 }
74 *parentMatch0 = match;
75 }
76 #if (DEBUG)
77 if (writeToLog)
78 {
79 if (match.hit)
80 {
81 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Expr");
82 }
83 else
84 {
85 System.Lex.WriteFailureToLog(lexer, u"Expr");
86 }
87 }
88 #endif
89 if (!match.hit)
90 {
91 match.value = null;
92 }
93 return match;
94 }
95 public static Match OrExpr(XPathLexer& lexer)
96 {
97 #if (DEBUG)
98 Span debugSpan;
99 bool writeToLog = lexer.Log() != null;
100 if (writeToLog)
101 {
102 debugSpan = lexer.GetSpan();
103 System.Lex.WriteBeginRuleToLog(lexer, u"OrExpr");
104 }
105 #endif
106 UniquePtr<System.XPath.XPathExpr> expr;
107 UniquePtr<System.XPath.XPathExpr> left;
108 UniquePtr<System.XPath.XPathExpr> right;
109 Match match(false);
110 Match* parentMatch0 = &match;
111 {
112 long pos = lexer.GetPos();
113 Match match(false);
114 Match* parentMatch1 = &match;
115 {
116 Match match(false);
117 Match* parentMatch2 = &match;
118 {
119 Match match(false);
120 Match* parentMatch3 = &match;
121 {
122 long pos = lexer.GetPos();
123 Match match = XPathParser.AndExpr(lexer);
124 left.Reset(cast<System.XPath.XPathExpr*>(match.value));
125 if (match.hit)
126 {
127 expr.Reset(left.Release());
128 }
129 *parentMatch3 = match;
130 }
131 *parentMatch2 = match;
132 }
133 if (match.hit)
134 {
135 Match match(false);
136 Match* parentMatch4 = &match;
137 {
138 Match match(true);
139 Match* parentMatch5 = &match;
140 {
141 while (true)
142 {
143 long save = lexer.GetPos();
144 {
145 Match match(false);
146 Match* parentMatch6 = &match;
147 {
148 Match match(false);
149 Match* parentMatch7 = &match;
150 {
151 Match match(false);
152 Match* parentMatch8 = &match;
153 {
154 long pos = lexer.GetPos();
155 bool pass = true;
156 Match match(false);
157 if (*lexer == NAME)
158 {
159 ++lexer;
160 match.hit = true;
161 }
162 if (match.hit)
163 {
164 Token token = lexer.GetToken(pos);
165 pass = lexer.GetKeywordToken(token.match) == OR;
166 }
167 if (match.hit && !pass)
168 {
169 match = Match(false);
170 }
171 *parentMatch8 = match;
172 }
173 *parentMatch7 = match;
174 }
175 if (match.hit)
176 {
177 Match match(false);
178 Match* parentMatch9 = &match;
179 {
180 Match match(false);
181 Match* parentMatch10 = &match;
182 {
183 long pos = lexer.GetPos();
184 Match match = XPathParser.AndExpr(lexer);
185 right.Reset(cast<System.XPath.XPathExpr*>(match.value));
186 if (match.hit)
187 {
188 expr.Reset(new System.XPath.XPathOrExpr(expr.Release(), right.Release()));
189 }
190 *parentMatch10 = match;
191 }
192 *parentMatch9 = match;
193 }
194 *parentMatch7 = match;
195 }
196 *parentMatch6 = match;
197 }
198 if (match.hit)
199 {
200 *parentMatch5 = match;
201 }
202 else
203 {
204 lexer.SetPos(save);
205 break;
206 }
207 }
208 }
209 }
210 *parentMatch4 = match;
211 }
212 *parentMatch2 = match;
213 }
214 *parentMatch1 = match;
215 }
216 if (match.hit)
217 {
218 {
219 #if (DEBUG)
220 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"OrExpr");
221 #endif
222 return Match(true, expr.Release());
223 }
224 }
225 *parentMatch0 = match;
226 }
227 #if (DEBUG)
228 if (writeToLog)
229 {
230 if (match.hit)
231 {
232 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"OrExpr");
233 }
234 else
235 {
236 System.Lex.WriteFailureToLog(lexer, u"OrExpr");
237 }
238 }
239 #endif
240 if (!match.hit)
241 {
242 match.value = null;
243 }
244 return match;
245 }
246 public static Match AndExpr(XPathLexer& lexer)
247 {
248 #if (DEBUG)
249 Span debugSpan;
250 bool writeToLog = lexer.Log() != null;
251 if (writeToLog)
252 {
253 debugSpan = lexer.GetSpan();
254 System.Lex.WriteBeginRuleToLog(lexer, u"AndExpr");
255 }
256 #endif
257 UniquePtr<System.XPath.XPathExpr> expr;
258 UniquePtr<System.XPath.XPathExpr> left;
259 UniquePtr<System.XPath.XPathExpr> right;
260 Match match(false);
261 Match* parentMatch0 = &match;
262 {
263 long pos = lexer.GetPos();
264 Match match(false);
265 Match* parentMatch1 = &match;
266 {
267 Match match(false);
268 Match* parentMatch2 = &match;
269 {
270 Match match(false);
271 Match* parentMatch3 = &match;
272 {
273 long pos = lexer.GetPos();
274 Match match = XPathParser.EqualityExpr(lexer);
275 left.Reset(cast<System.XPath.XPathExpr*>(match.value));
276 if (match.hit)
277 {
278 expr.Reset(left.Release());
279 }
280 *parentMatch3 = match;
281 }
282 *parentMatch2 = match;
283 }
284 if (match.hit)
285 {
286 Match match(false);
287 Match* parentMatch4 = &match;
288 {
289 Match match(true);
290 Match* parentMatch5 = &match;
291 {
292 while (true)
293 {
294 long save = lexer.GetPos();
295 {
296 Match match(false);
297 Match* parentMatch6 = &match;
298 {
299 Match match(false);
300 Match* parentMatch7 = &match;
301 {
302 Match match(false);
303 Match* parentMatch8 = &match;
304 {
305 long pos = lexer.GetPos();
306 bool pass = true;
307 Match match(false);
308 if (*lexer == NAME)
309 {
310 ++lexer;
311 match.hit = true;
312 }
313 if (match.hit)
314 {
315 Token token = lexer.GetToken(pos);
316 pass = lexer.GetKeywordToken(token.match) == AND;
317 }
318 if (match.hit && !pass)
319 {
320 match = Match(false);
321 }
322 *parentMatch8 = match;
323 }
324 *parentMatch7 = match;
325 }
326 if (match.hit)
327 {
328 Match match(false);
329 Match* parentMatch9 = &match;
330 {
331 Match match(false);
332 Match* parentMatch10 = &match;
333 {
334 long pos = lexer.GetPos();
335 Match match = XPathParser.EqualityExpr(lexer);
336 right.Reset(cast<System.XPath.XPathExpr*>(match.value));
337 if (match.hit)
338 {
339 expr.Reset(new System.XPath.XPathAndExpr(expr.Release(), right.Release()));
340 }
341 *parentMatch10 = match;
342 }
343 *parentMatch9 = match;
344 }
345 *parentMatch7 = match;
346 }
347 *parentMatch6 = match;
348 }
349 if (match.hit)
350 {
351 *parentMatch5 = match;
352 }
353 else
354 {
355 lexer.SetPos(save);
356 break;
357 }
358 }
359 }
360 }
361 *parentMatch4 = match;
362 }
363 *parentMatch2 = match;
364 }
365 *parentMatch1 = match;
366 }
367 if (match.hit)
368 {
369 {
370 #if (DEBUG)
371 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AndExpr");
372 #endif
373 return Match(true, expr.Release());
374 }
375 }
376 *parentMatch0 = match;
377 }
378 #if (DEBUG)
379 if (writeToLog)
380 {
381 if (match.hit)
382 {
383 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AndExpr");
384 }
385 else
386 {
387 System.Lex.WriteFailureToLog(lexer, u"AndExpr");
388 }
389 }
390 #endif
391 if (!match.hit)
392 {
393 match.value = null;
394 }
395 return match;
396 }
397 public static Match EqualityExpr(XPathLexer& lexer)
398 {
399 #if (DEBUG)
400 Span debugSpan;
401 bool writeToLog = lexer.Log() != null;
402 if (writeToLog)
403 {
404 debugSpan = lexer.GetSpan();
405 System.Lex.WriteBeginRuleToLog(lexer, u"EqualityExpr");
406 }
407 #endif
408 UniquePtr<System.XPath.XPathExpr> expr;
409 System.XPath.Operator op;
410 UniquePtr<System.XPath.XPathExpr> left;
411 UniquePtr<System.XPath.XPathExpr> right;
412 Match match(false);
413 Match* parentMatch0 = &match;
414 {
415 long pos = lexer.GetPos();
416 Match match(false);
417 Match* parentMatch1 = &match;
418 {
419 Match match(false);
420 Match* parentMatch2 = &match;
421 {
422 Match match(false);
423 Match* parentMatch3 = &match;
424 {
425 long pos = lexer.GetPos();
426 Match match = XPathParser.RelationalExpr(lexer);
427 left.Reset(cast<System.XPath.XPathExpr*>(match.value));
428 if (match.hit)
429 {
430 expr.Reset(left.Release());
431 }
432 *parentMatch3 = match;
433 }
434 *parentMatch2 = match;
435 }
436 if (match.hit)
437 {
438 Match match(false);
439 Match* parentMatch4 = &match;
440 {
441 Match match(true);
442 Match* parentMatch5 = &match;
443 {
444 while (true)
445 {
446 long save = lexer.GetPos();
447 {
448 Match match(false);
449 Match* parentMatch6 = &match;
450 {
451 Match match(false);
452 Match* parentMatch7 = &match;
453 {
454 Match match(false);
455 Match* parentMatch8 = &match;
456 {
457 Match match(false);
458 Match* parentMatch9 = &match;
459 {
460 long save = lexer.GetPos();
461 Match match(false);
462 Match* parentMatch10 = &match;
463 {
464 long pos = lexer.GetPos();
465 Match match(false);
466 if (*lexer == EQ)
467 {
468 ++lexer;
469 match.hit = true;
470 }
471 if (match.hit)
472 {
473 op = System.XPath.Operator.equal;
474 }
475 *parentMatch10 = match;
476 }
477 *parentMatch9 = match;
478 if (!match.hit)
479 {
480 Match match(false);
481 Match* parentMatch11 = &match;
482 lexer.SetPos(save);
483 {
484 Match match(false);
485 Match* parentMatch12 = &match;
486 {
487 long pos = lexer.GetPos();
488 Match match(false);
489 if (*lexer == NEQ)
490 {
491 ++lexer;
492 match.hit = true;
493 }
494 if (match.hit)
495 {
496 op = System.XPath.Operator.notEqual;
497 }
498 *parentMatch12 = match;
499 }
500 *parentMatch11 = match;
501 }
502 *parentMatch9 = match;
503 }
504 }
505 *parentMatch8 = match;
506 }
507 *parentMatch7 = match;
508 }
509 if (match.hit)
510 {
511 Match match(false);
512 Match* parentMatch13 = &match;
513 {
514 Match match(false);
515 Match* parentMatch14 = &match;
516 {
517 long pos = lexer.GetPos();
518 Match match(true);
519 Match* parentMatch15 = &match;
520 {
521 System.Lex.Span span = lexer.GetSpan();
522 Match match = XPathParser.RelationalExpr(lexer);
523 right.Reset(cast<System.XPath.XPathExpr*>(match.value));
524 if (match.hit)
525 {
526 *parentMatch15 = match;
527 }
528 else
529 {
530 lexer.ThrowExpectationFailure(span, u"RelationalExpr");
531 }
532 }
533 if (match.hit)
534 {
535 switch (op)
536 {
537 case System.XPath.Operator.equal: expr.Reset(new System.XPath.XPathEqualExpr(expr.Release(), right.Release()));
538 break;
539 case System.XPath.Operator.notEqual: expr.Reset(new System.XPath.XPathNotEqualExpr(expr.Release(), right.Release()));
540 break;
541 }
542 }
543 *parentMatch14 = match;
544 }
545 *parentMatch13 = match;
546 }
547 *parentMatch7 = match;
548 }
549 *parentMatch6 = match;
550 }
551 if (match.hit)
552 {
553 *parentMatch5 = match;
554 }
555 else
556 {
557 lexer.SetPos(save);
558 break;
559 }
560 }
561 }
562 }
563 *parentMatch4 = match;
564 }
565 *parentMatch2 = match;
566 }
567 *parentMatch1 = match;
568 }
569 if (match.hit)
570 {
571 {
572 #if (DEBUG)
573 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"EqualityExpr");
574 #endif
575 return Match(true, expr.Release());
576 }
577 }
578 *parentMatch0 = match;
579 }
580 #if (DEBUG)
581 if (writeToLog)
582 {
583 if (match.hit)
584 {
585 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"EqualityExpr");
586 }
587 else
588 {
589 System.Lex.WriteFailureToLog(lexer, u"EqualityExpr");
590 }
591 }
592 #endif
593 if (!match.hit)
594 {
595 match.value = null;
596 }
597 return match;
598 }
599 public static Match RelationalExpr(XPathLexer& lexer)
600 {
601 #if (DEBUG)
602 Span debugSpan;
603 bool writeToLog = lexer.Log() != null;
604 if (writeToLog)
605 {
606 debugSpan = lexer.GetSpan();
607 System.Lex.WriteBeginRuleToLog(lexer, u"RelationalExpr");
608 }
609 #endif
610 UniquePtr<System.XPath.XPathExpr> expr;
611 System.XPath.Operator op;
612 UniquePtr<System.XPath.XPathExpr> left;
613 UniquePtr<System.XPath.XPathExpr> right;
614 Match match(false);
615 Match* parentMatch0 = &match;
616 {
617 long pos = lexer.GetPos();
618 Match match(false);
619 Match* parentMatch1 = &match;
620 {
621 Match match(false);
622 Match* parentMatch2 = &match;
623 {
624 Match match(false);
625 Match* parentMatch3 = &match;
626 {
627 long pos = lexer.GetPos();
628 Match match = XPathParser.AdditiveExpr(lexer);
629 left.Reset(cast<System.XPath.XPathExpr*>(match.value));
630 if (match.hit)
631 {
632 expr.Reset(left.Release());
633 }
634 *parentMatch3 = match;
635 }
636 *parentMatch2 = match;
637 }
638 if (match.hit)
639 {
640 Match match(false);
641 Match* parentMatch4 = &match;
642 {
643 Match match(true);
644 Match* parentMatch5 = &match;
645 {
646 while (true)
647 {
648 long save = lexer.GetPos();
649 {
650 Match match(false);
651 Match* parentMatch6 = &match;
652 {
653 Match match(false);
654 Match* parentMatch7 = &match;
655 {
656 Match match(false);
657 Match* parentMatch8 = &match;
658 {
659 Match match(false);
660 Match* parentMatch9 = &match;
661 {
662 long save = lexer.GetPos();
663 Match match(false);
664 Match* parentMatch10 = &match;
665 {
666 long save = lexer.GetPos();
667 Match match(false);
668 Match* parentMatch11 = &match;
669 {
670 long save = lexer.GetPos();
671 Match match(false);
672 Match* parentMatch12 = &match;
673 {
674 long pos = lexer.GetPos();
675 Match match(false);
676 if (*lexer == LEQ)
677 {
678 ++lexer;
679 match.hit = true;
680 }
681 if (match.hit)
682 {
683 op = System.XPath.Operator.lessOrEqual;
684 }
685 *parentMatch12 = match;
686 }
687 *parentMatch11 = match;
688 if (!match.hit)
689 {
690 Match match(false);
691 Match* parentMatch13 = &match;
692 lexer.SetPos(save);
693 {
694 Match match(false);
695 Match* parentMatch14 = &match;
696 {
697 long pos = lexer.GetPos();
698 Match match(false);
699 if (*lexer == GEQ)
700 {
701 ++lexer;
702 match.hit = true;
703 }
704 if (match.hit)
705 {
706 op = System.XPath.Operator.greaterOrEqual;
707 }
708 *parentMatch14 = match;
709 }
710 *parentMatch13 = match;
711 }
712 *parentMatch11 = match;
713 }
714 }
715 *parentMatch10 = match;
716 if (!match.hit)
717 {
718 Match match(false);
719 Match* parentMatch15 = &match;
720 lexer.SetPos(save);
721 {
722 Match match(false);
723 Match* parentMatch16 = &match;
724 {
725 long pos = lexer.GetPos();
726 Match match(false);
727 if (*lexer == LESS)
728 {
729 ++lexer;
730 match.hit = true;
731 }
732 if (match.hit)
733 {
734 op = System.XPath.Operator.less;
735 }
736 *parentMatch16 = match;
737 }
738 *parentMatch15 = match;
739 }
740 *parentMatch10 = match;
741 }
742 }
743 *parentMatch9 = match;
744 if (!match.hit)
745 {
746 Match match(false);
747 Match* parentMatch17 = &match;
748 lexer.SetPos(save);
749 {
750 Match match(false);
751 Match* parentMatch18 = &match;
752 {
753 long pos = lexer.GetPos();
754 Match match(false);
755 if (*lexer == GREATER)
756 {
757 ++lexer;
758 match.hit = true;
759 }
760 if (match.hit)
761 {
762 op = System.XPath.Operator.greater;
763 }
764 *parentMatch18 = match;
765 }
766 *parentMatch17 = match;
767 }
768 *parentMatch9 = match;
769 }
770 }
771 *parentMatch8 = match;
772 }
773 *parentMatch7 = match;
774 }
775 if (match.hit)
776 {
777 Match match(false);
778 Match* parentMatch19 = &match;
779 {
780 Match match(false);
781 Match* parentMatch20 = &match;
782 {
783 long pos = lexer.GetPos();
784 Match match(true);
785 Match* parentMatch21 = &match;
786 {
787 System.Lex.Span span = lexer.GetSpan();
788 Match match = XPathParser.AdditiveExpr(lexer);
789 right.Reset(cast<System.XPath.XPathExpr*>(match.value));
790 if (match.hit)
791 {
792 *parentMatch21 = match;
793 }
794 else
795 {
796 lexer.ThrowExpectationFailure(span, u"AdditiveExpr");
797 }
798 }
799 if (match.hit)
800 {
801 switch (op)
802 {
803 case System.XPath.Operator.lessOrEqual: expr.Reset(new System.XPath.XPathLessOrEqualExpr(expr.Release(), right.Release()));
804 break;
805 case System.XPath.Operator.greaterOrEqual: expr.Reset(new System.XPath.XPathGreaterOrEqualExpr(expr.Release(), right.Release()));
806 break;
807 case System.XPath.Operator.less: expr.Reset(new System.XPath.XPathLessExpr(expr.Release(), right.Release()));
808 break;
809 case System.XPath.Operator.greater: expr.Reset(new System.XPath.XPathGreaterExpr(expr.Release(), right.Release()));
810 break;
811 }
812 }
813 *parentMatch20 = match;
814 }
815 *parentMatch19 = match;
816 }
817 *parentMatch7 = match;
818 }
819 *parentMatch6 = match;
820 }
821 if (match.hit)
822 {
823 *parentMatch5 = match;
824 }
825 else
826 {
827 lexer.SetPos(save);
828 break;
829 }
830 }
831 }
832 }
833 *parentMatch4 = match;
834 }
835 *parentMatch2 = match;
836 }
837 *parentMatch1 = match;
838 }
839 if (match.hit)
840 {
841 {
842 #if (DEBUG)
843 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RelationalExpr");
844 #endif
845 return Match(true, expr.Release());
846 }
847 }
848 *parentMatch0 = match;
849 }
850 #if (DEBUG)
851 if (writeToLog)
852 {
853 if (match.hit)
854 {
855 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RelationalExpr");
856 }
857 else
858 {
859 System.Lex.WriteFailureToLog(lexer, u"RelationalExpr");
860 }
861 }
862 #endif
863 if (!match.hit)
864 {
865 match.value = null;
866 }
867 return match;
868 }
869 public static Match AdditiveExpr(XPathLexer& lexer)
870 {
871 #if (DEBUG)
872 Span debugSpan;
873 bool writeToLog = lexer.Log() != null;
874 if (writeToLog)
875 {
876 debugSpan = lexer.GetSpan();
877 System.Lex.WriteBeginRuleToLog(lexer, u"AdditiveExpr");
878 }
879 #endif
880 UniquePtr<System.XPath.XPathExpr> expr;
881 System.XPath.Operator op;
882 UniquePtr<System.XPath.XPathExpr> left;
883 UniquePtr<System.XPath.XPathExpr> right;
884 Match match(false);
885 Match* parentMatch0 = &match;
886 {
887 long pos = lexer.GetPos();
888 Match match(false);
889 Match* parentMatch1 = &match;
890 {
891 Match match(false);
892 Match* parentMatch2 = &match;
893 {
894 Match match(false);
895 Match* parentMatch3 = &match;
896 {
897 long pos = lexer.GetPos();
898 Match match = XPathParser.MultiplicativeExpr(lexer);
899 left.Reset(cast<System.XPath.XPathExpr*>(match.value));
900 if (match.hit)
901 {
902 expr.Reset(left.Release());
903 }
904 *parentMatch3 = match;
905 }
906 *parentMatch2 = match;
907 }
908 if (match.hit)
909 {
910 Match match(false);
911 Match* parentMatch4 = &match;
912 {
913 Match match(true);
914 Match* parentMatch5 = &match;
915 {
916 while (true)
917 {
918 long save = lexer.GetPos();
919 {
920 Match match(false);
921 Match* parentMatch6 = &match;
922 {
923 Match match(false);
924 Match* parentMatch7 = &match;
925 {
926 Match match(false);
927 Match* parentMatch8 = &match;
928 {
929 Match match(false);
930 Match* parentMatch9 = &match;
931 {
932 long save = lexer.GetPos();
933 Match match(false);
934 Match* parentMatch10 = &match;
935 {
936 long pos = lexer.GetPos();
937 Match match(false);
938 if (*lexer == PLUS)
939 {
940 ++lexer;
941 match.hit = true;
942 }
943 if (match.hit)
944 {
945 op = System.XPath.Operator.plus;
946 }
947 *parentMatch10 = match;
948 }
949 *parentMatch9 = match;
950 if (!match.hit)
951 {
952 Match match(false);
953 Match* parentMatch11 = &match;
954 lexer.SetPos(save);
955 {
956 Match match(false);
957 Match* parentMatch12 = &match;
958 {
959 long pos = lexer.GetPos();
960 Match match(false);
961 if (*lexer == MINUS)
962 {
963 ++lexer;
964 match.hit = true;
965 }
966 if (match.hit)
967 {
968 op = System.XPath.Operator.minus;
969 }
970 *parentMatch12 = match;
971 }
972 *parentMatch11 = match;
973 }
974 *parentMatch9 = match;
975 }
976 }
977 *parentMatch8 = match;
978 }
979 *parentMatch7 = match;
980 }
981 if (match.hit)
982 {
983 Match match(false);
984 Match* parentMatch13 = &match;
985 {
986 Match match(false);
987 Match* parentMatch14 = &match;
988 {
989 long pos = lexer.GetPos();
990 Match match(true);
991 Match* parentMatch15 = &match;
992 {
993 System.Lex.Span span = lexer.GetSpan();
994 Match match = XPathParser.MultiplicativeExpr(lexer);
995 right.Reset(cast<System.XPath.XPathExpr*>(match.value));
996 if (match.hit)
997 {
998 *parentMatch15 = match;
999 }
1000 else
1001 {
1002 lexer.ThrowExpectationFailure(span, u"MultiplicativeExpr");
1003 }
1004 }
1005 if (match.hit)
1006 {
1007 switch (op)
1008 {
1009 case System.XPath.Operator.plus: expr.Reset(new System.XPath.XPathAddExpr(expr.Release(), right.Release()));
1010 break;
1011 case System.XPath.Operator.minus: expr.Reset(new System.XPath.XPathSubExpr(expr.Release(), right.Release()));
1012 break;
1013 }
1014 }
1015 *parentMatch14 = match;
1016 }
1017 *parentMatch13 = match;
1018 }
1019 *parentMatch7 = match;
1020 }
1021 *parentMatch6 = match;
1022 }
1023 if (match.hit)
1024 {
1025 *parentMatch5 = match;
1026 }
1027 else
1028 {
1029 lexer.SetPos(save);
1030 break;
1031 }
1032 }
1033 }
1034 }
1035 *parentMatch4 = match;
1036 }
1037 *parentMatch2 = match;
1038 }
1039 *parentMatch1 = match;
1040 }
1041 if (match.hit)
1042 {
1043 {
1044 #if (DEBUG)
1045 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AdditiveExpr");
1046 #endif
1047 return Match(true, expr.Release());
1048 }
1049 }
1050 *parentMatch0 = match;
1051 }
1052 #if (DEBUG)
1053 if (writeToLog)
1054 {
1055 if (match.hit)
1056 {
1057 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AdditiveExpr");
1058 }
1059 else
1060 {
1061 System.Lex.WriteFailureToLog(lexer, u"AdditiveExpr");
1062 }
1063 }
1064 #endif
1065 if (!match.hit)
1066 {
1067 match.value = null;
1068 }
1069 return match;
1070 }
1071 public static Match MultiplicativeExpr(XPathLexer& lexer)
1072 {
1073 #if (DEBUG)
1074 Span debugSpan;
1075 bool writeToLog = lexer.Log() != null;
1076 if (writeToLog)
1077 {
1078 debugSpan = lexer.GetSpan();
1079 System.Lex.WriteBeginRuleToLog(lexer, u"MultiplicativeExpr");
1080 }
1081 #endif
1082 UniquePtr<System.XPath.XPathExpr> expr;
1083 System.XPath.Operator op;
1084 UniquePtr<System.XPath.XPathExpr> left;
1085 UniquePtr<System.XPath.XPathExpr> right;
1086 Match match(false);
1087 Match* parentMatch0 = &match;
1088 {
1089 long pos = lexer.GetPos();
1090 Match match(false);
1091 Match* parentMatch1 = &match;
1092 {
1093 Match match(false);
1094 Match* parentMatch2 = &match;
1095 {
1096 Match match(false);
1097 Match* parentMatch3 = &match;
1098 {
1099 long pos = lexer.GetPos();
1100 Match match = XPathParser.UnaryExpr(lexer);
1101 left.Reset(cast<System.XPath.XPathExpr*>(match.value));
1102 if (match.hit)
1103 {
1104 expr.Reset(left.Release());
1105 }
1106 *parentMatch3 = match;
1107 }
1108 *parentMatch2 = match;
1109 }
1110 if (match.hit)
1111 {
1112 Match match(false);
1113 Match* parentMatch4 = &match;
1114 {
1115 Match match(true);
1116 Match* parentMatch5 = &match;
1117 {
1118 while (true)
1119 {
1120 long save = lexer.GetPos();
1121 {
1122 Match match(false);
1123 Match* parentMatch6 = &match;
1124 {
1125 Match match(false);
1126 Match* parentMatch7 = &match;
1127 {
1128 Match match(false);
1129 Match* parentMatch8 = &match;
1130 {
1131 Match match(false);
1132 Match* parentMatch9 = &match;
1133 {
1134 long save = lexer.GetPos();
1135 Match match(false);
1136 Match* parentMatch10 = &match;
1137 {
1138 long pos = lexer.GetPos();
1139 Match match(false);
1140 if (*lexer == STAR)
1141 {
1142 ++lexer;
1143 match.hit = true;
1144 }
1145 if (match.hit)
1146 {
1147 op = System.XPath.Operator.mul;
1148 }
1149 *parentMatch10 = match;
1150 }
1151 *parentMatch9 = match;
1152 if (!match.hit)
1153 {
1154 Match match(false);
1155 Match* parentMatch11 = &match;
1156 lexer.SetPos(save);
1157 {
1158 Match match(false);
1159 Match* parentMatch12 = &match;
1160 {
1161 long pos = lexer.GetPos();
1162 bool pass = true;
1163 Match match(false);
1164 if (*lexer == NAME)
1165 {
1166 ++lexer;
1167 match.hit = true;
1168 }
1169 if (match.hit)
1170 {
1171 Token token = lexer.GetToken(pos);
1172 switch (lexer.GetKeywordToken(token.match))
1173 {
1174 case DIV: op = System.XPath.Operator.div;
1175 break;
1176 case MOD: op = System.XPath.Operator.mod;
1177 break;
1178 default: pass = false;
1179 break;
1180 }
1181 }
1182 if (match.hit && !pass)
1183 {
1184 match = Match(false);
1185 }
1186 *parentMatch12 = match;
1187 }
1188 *parentMatch11 = match;
1189 }
1190 *parentMatch9 = match;
1191 }
1192 }
1193 *parentMatch8 = match;
1194 }
1195 *parentMatch7 = match;
1196 }
1197 if (match.hit)
1198 {
1199 Match match(false);
1200 Match* parentMatch13 = &match;
1201 {
1202 Match match(false);
1203 Match* parentMatch14 = &match;
1204 {
1205 long pos = lexer.GetPos();
1206 Match match(true);
1207 Match* parentMatch15 = &match;
1208 {
1209 System.Lex.Span span = lexer.GetSpan();
1210 Match match = XPathParser.UnaryExpr(lexer);
1211 right.Reset(cast<System.XPath.XPathExpr*>(match.value));
1212 if (match.hit)
1213 {
1214 *parentMatch15 = match;
1215 }
1216 else
1217 {
1218 lexer.ThrowExpectationFailure(span, u"UnaryExpr");
1219 }
1220 }
1221 if (match.hit)
1222 {
1223 switch (op)
1224 {
1225 case System.XPath.Operator.mul: expr.Reset(new System.XPath.XPathMulExpr(expr.Release(), right.Release()));
1226 break;
1227 case System.XPath.Operator.div: expr.Reset(new System.XPath.XPathDivExpr(expr.Release(), right.Release()));
1228 break;
1229 case System.XPath.Operator.mod: expr.Reset(new System.XPath.XPathModExpr(expr.Release(), right.Release()));
1230 break;
1231 }
1232 }
1233 *parentMatch14 = match;
1234 }
1235 *parentMatch13 = match;
1236 }
1237 *parentMatch7 = match;
1238 }
1239 *parentMatch6 = match;
1240 }
1241 if (match.hit)
1242 {
1243 *parentMatch5 = match;
1244 }
1245 else
1246 {
1247 lexer.SetPos(save);
1248 break;
1249 }
1250 }
1251 }
1252 }
1253 *parentMatch4 = match;
1254 }
1255 *parentMatch2 = match;
1256 }
1257 *parentMatch1 = match;
1258 }
1259 if (match.hit)
1260 {
1261 {
1262 #if (DEBUG)
1263 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MultiplicativeExpr");
1264 #endif
1265 return Match(true, expr.Release());
1266 }
1267 }
1268 *parentMatch0 = match;
1269 }
1270 #if (DEBUG)
1271 if (writeToLog)
1272 {
1273 if (match.hit)
1274 {
1275 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MultiplicativeExpr");
1276 }
1277 else
1278 {
1279 System.Lex.WriteFailureToLog(lexer, u"MultiplicativeExpr");
1280 }
1281 }
1282 #endif
1283 if (!match.hit)
1284 {
1285 match.value = null;
1286 }
1287 return match;
1288 }
1289 public static Match UnaryExpr(XPathLexer& lexer)
1290 {
1291 #if (DEBUG)
1292 Span debugSpan;
1293 bool writeToLog = lexer.Log() != null;
1294 if (writeToLog)
1295 {
1296 debugSpan = lexer.GetSpan();
1297 System.Lex.WriteBeginRuleToLog(lexer, u"UnaryExpr");
1298 }
1299 #endif
1300 UniquePtr<System.XPath.XPathExpr> subject;
1301 UniquePtr<System.XPath.XPathExpr> unionExpr;
1302 Match match(false);
1303 Match* parentMatch0 = &match;
1304 {
1305 long save = lexer.GetPos();
1306 Match match(false);
1307 Match* parentMatch1 = &match;
1308 {
1309 Match match(false);
1310 if (*lexer == MINUS)
1311 {
1312 ++lexer;
1313 match.hit = true;
1314 }
1315 *parentMatch1 = match;
1316 }
1317 if (match.hit)
1318 {
1319 Match match(false);
1320 Match* parentMatch2 = &match;
1321 {
1322 Match match(false);
1323 Match* parentMatch3 = &match;
1324 {
1325 long pos = lexer.GetPos();
1326 Match match = XPathParser.UnaryExpr(lexer);
1327 subject.Reset(cast<System.XPath.XPathExpr*>(match.value));
1328 if (match.hit)
1329 {
1330 {
1331 #if (DEBUG)
1332 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryExpr");
1333 #endif
1334 return Match(true, new System.XPath.XPathUnaryMinusExpr(subject.Release()));
1335 }
1336 }
1337 *parentMatch3 = match;
1338 }
1339 *parentMatch2 = match;
1340 }
1341 *parentMatch1 = match;
1342 }
1343 *parentMatch0 = match;
1344 if (!match.hit)
1345 {
1346 Match match(false);
1347 Match* parentMatch4 = &match;
1348 lexer.SetPos(save);
1349 {
1350 Match match(false);
1351 Match* parentMatch5 = &match;
1352 {
1353 long pos = lexer.GetPos();
1354 Match match = XPathParser.UnionExpr(lexer);
1355 unionExpr.Reset(cast<System.XPath.XPathExpr*>(match.value));
1356 if (match.hit)
1357 {
1358 {
1359 #if (DEBUG)
1360 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryExpr");
1361 #endif
1362 return Match(true, unionExpr.Release());
1363 }
1364 }
1365 *parentMatch5 = match;
1366 }
1367 *parentMatch4 = match;
1368 }
1369 *parentMatch0 = match;
1370 }
1371 }
1372 #if (DEBUG)
1373 if (writeToLog)
1374 {
1375 if (match.hit)
1376 {
1377 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryExpr");
1378 }
1379 else
1380 {
1381 System.Lex.WriteFailureToLog(lexer, u"UnaryExpr");
1382 }
1383 }
1384 #endif
1385 if (!match.hit)
1386 {
1387 match.value = null;
1388 }
1389 return match;
1390 }
1391 public static Match UnionExpr(XPathLexer& lexer)
1392 {
1393 #if (DEBUG)
1394 Span debugSpan;
1395 bool writeToLog = lexer.Log() != null;
1396 if (writeToLog)
1397 {
1398 debugSpan = lexer.GetSpan();
1399 System.Lex.WriteBeginRuleToLog(lexer, u"UnionExpr");
1400 }
1401 #endif
1402 UniquePtr<System.XPath.XPathExpr> expr;
1403 UniquePtr<System.XPath.XPathExpr> left;
1404 UniquePtr<System.XPath.XPathExpr> right;
1405 Match match(false);
1406 Match* parentMatch0 = &match;
1407 {
1408 long pos = lexer.GetPos();
1409 Match match(false);
1410 Match* parentMatch1 = &match;
1411 {
1412 Match match(false);
1413 Match* parentMatch2 = &match;
1414 {
1415 Match match(false);
1416 Match* parentMatch3 = &match;
1417 {
1418 long pos = lexer.GetPos();
1419 Match match = XPathParser.PathExpr(lexer);
1420 left.Reset(cast<System.XPath.XPathExpr*>(match.value));
1421 if (match.hit)
1422 {
1423 expr.Reset(left.Release());
1424 }
1425 *parentMatch3 = match;
1426 }
1427 *parentMatch2 = match;
1428 }
1429 if (match.hit)
1430 {
1431 Match match(false);
1432 Match* parentMatch4 = &match;
1433 {
1434 Match match(true);
1435 Match* parentMatch5 = &match;
1436 {
1437 while (true)
1438 {
1439 long save = lexer.GetPos();
1440 {
1441 Match match(false);
1442 Match* parentMatch6 = &match;
1443 {
1444 Match match(false);
1445 Match* parentMatch7 = &match;
1446 {
1447 Match match(false);
1448 if (*lexer == UNION)
1449 {
1450 ++lexer;
1451 match.hit = true;
1452 }
1453 *parentMatch7 = match;
1454 }
1455 if (match.hit)
1456 {
1457 Match match(false);
1458 Match* parentMatch8 = &match;
1459 {
1460 Match match(false);
1461 Match* parentMatch9 = &match;
1462 {
1463 long pos = lexer.GetPos();
1464 Match match = XPathParser.PathExpr(lexer);
1465 right.Reset(cast<System.XPath.XPathExpr*>(match.value));
1466 if (match.hit)
1467 {
1468 expr.Reset(new System.XPath.XPathUnionExpr(expr.Release(), right.Release()));
1469 }
1470 *parentMatch9 = match;
1471 }
1472 *parentMatch8 = match;
1473 }
1474 *parentMatch7 = match;
1475 }
1476 *parentMatch6 = match;
1477 }
1478 if (match.hit)
1479 {
1480 *parentMatch5 = match;
1481 }
1482 else
1483 {
1484 lexer.SetPos(save);
1485 break;
1486 }
1487 }
1488 }
1489 }
1490 *parentMatch4 = match;
1491 }
1492 *parentMatch2 = match;
1493 }
1494 *parentMatch1 = match;
1495 }
1496 if (match.hit)
1497 {
1498 {
1499 #if (DEBUG)
1500 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnionExpr");
1501 #endif
1502 return Match(true, expr.Release());
1503 }
1504 }
1505 *parentMatch0 = match;
1506 }
1507 #if (DEBUG)
1508 if (writeToLog)
1509 {
1510 if (match.hit)
1511 {
1512 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnionExpr");
1513 }
1514 else
1515 {
1516 System.Lex.WriteFailureToLog(lexer, u"UnionExpr");
1517 }
1518 }
1519 #endif
1520 if (!match.hit)
1521 {
1522 match.value = null;
1523 }
1524 return match;
1525 }
1526 public static Match PathExpr(XPathLexer& lexer)
1527 {
1528 #if (DEBUG)
1529 Span debugSpan;
1530 bool writeToLog = lexer.Log() != null;
1531 if (writeToLog)
1532 {
1533 debugSpan = lexer.GetSpan();
1534 System.Lex.WriteBeginRuleToLog(lexer, u"PathExpr");
1535 }
1536 #endif
1537 UniquePtr<System.XPath.XPathExpr> expr;
1538 System.XPath.Operator op;
1539 UniquePtr<System.XPath.XPathExpr> locationPath;
1540 UniquePtr<System.XPath.XPathExpr> functionCall;
1541 UniquePtr<System.XPath.XPathExpr> filterExpr;
1542 UniquePtr<System.XPath.XPathExpr> right;
1543 Match match(false);
1544 Match* parentMatch0 = &match;
1545 {
1546 long save = lexer.GetPos();
1547 Match match(false);
1548 Match* parentMatch1 = &match;
1549 {
1550 long pos = lexer.GetPos();
1551 Match match(false);
1552 Match* parentMatch2 = &match;
1553 {
1554 Match match(false);
1555 Match* parentMatch3 = &match;
1556 long save = lexer.GetPos();
1557 {
1558 Match match = XPathParser.LocationPath(lexer);
1559 locationPath.Reset(cast<System.XPath.XPathExpr*>(match.value));
1560 *parentMatch3 = match;
1561 }
1562 if (match.hit)
1563 {
1564 Match match(false);
1565 Match* parentMatch4 = &match;
1566 {
1567 long tmp = lexer.GetPos();
1568 lexer.SetPos(save);
1569 save = tmp;
1570 Match match = XPathParser.FunctionCall(lexer);
1571 functionCall.Reset(cast<System.XPath.XPathExpr*>(match.value));
1572 *parentMatch4 = match;
1573 }
1574 if (!match.hit)
1575 {
1576 lexer.SetPos(save);
1577 }
1578 *parentMatch3 = Match(!match.hit, match.value);
1579 }
1580 *parentMatch2 = match;
1581 }
1582 if (match.hit)
1583 {
1584 {
1585 #if (DEBUG)
1586 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PathExpr");
1587 #endif
1588 return Match(true, locationPath.Release());
1589 }
1590 }
1591 *parentMatch1 = match;
1592 }
1593 *parentMatch0 = match;
1594 if (!match.hit)
1595 {
1596 Match match(false);
1597 Match* parentMatch5 = &match;
1598 lexer.SetPos(save);
1599 {
1600 Match match(false);
1601 Match* parentMatch6 = &match;
1602 {
1603 long pos = lexer.GetPos();
1604 Match match(false);
1605 Match* parentMatch7 = &match;
1606 {
1607 Match match(false);
1608 Match* parentMatch8 = &match;
1609 {
1610 Match match(false);
1611 Match* parentMatch9 = &match;
1612 {
1613 long pos = lexer.GetPos();
1614 Match match = XPathParser.FilterExpr(lexer);
1615 filterExpr.Reset(cast<System.XPath.XPathExpr*>(match.value));
1616 if (match.hit)
1617 {
1618 expr.Reset(filterExpr.Release());
1619 }
1620 *parentMatch9 = match;
1621 }
1622 *parentMatch8 = match;
1623 }
1624 if (match.hit)
1625 {
1626 Match match(false);
1627 Match* parentMatch10 = &match;
1628 {
1629 Match match(true);
1630 long save = lexer.GetPos();
1631 Match* parentMatch11 = &match;
1632 {
1633 Match match(false);
1634 Match* parentMatch12 = &match;
1635 {
1636 Match match(false);
1637 Match* parentMatch13 = &match;
1638 {
1639 Match match(false);
1640 Match* parentMatch14 = &match;
1641 {
1642 Match match(false);
1643 Match* parentMatch15 = &match;
1644 {
1645 long save = lexer.GetPos();
1646 Match match(false);
1647 Match* parentMatch16 = &match;
1648 {
1649 long pos = lexer.GetPos();
1650 Match match(false);
1651 if (*lexer == SLASHSLASH)
1652 {
1653 ++lexer;
1654 match.hit = true;
1655 }
1656 if (match.hit)
1657 {
1658 op = System.XPath.Operator.slashSlash;
1659 }
1660 *parentMatch16 = match;
1661 }
1662 *parentMatch15 = match;
1663 if (!match.hit)
1664 {
1665 Match match(false);
1666 Match* parentMatch17 = &match;
1667 lexer.SetPos(save);
1668 {
1669 Match match(false);
1670 Match* parentMatch18 = &match;
1671 {
1672 long pos = lexer.GetPos();
1673 Match match(false);
1674 if (*lexer == SLASH)
1675 {
1676 ++lexer;
1677 match.hit = true;
1678 }
1679 if (match.hit)
1680 {
1681 op = System.XPath.Operator.slash;
1682 }
1683 *parentMatch18 = match;
1684 }
1685 *parentMatch17 = match;
1686 }
1687 *parentMatch15 = match;
1688 }
1689 }
1690 *parentMatch14 = match;
1691 }
1692 *parentMatch13 = match;
1693 }
1694 if (match.hit)
1695 {
1696 Match match(false);
1697 Match* parentMatch19 = &match;
1698 {
1699 Match match(false);
1700 Match* parentMatch20 = &match;
1701 {
1702 long pos = lexer.GetPos();
1703 Match match = XPathParser.RelativeLocationPath(lexer);
1704 right.Reset(cast<System.XPath.XPathExpr*>(match.value));
1705 if (match.hit)
1706 {
1707 switch (op)
1708 {
1709 case System.XPath.Operator.slashSlash:
1710 {
1711 {
1712 #if (DEBUG)
1713 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PathExpr");
1714 #endif
1715 return Match(true, new System.XPath.XPathCombineStepExpr(expr.Release(), new System.XPath.XPathCombineStepExpr(new System.XPath.XPathLocationStepExpr(System.Dom.Axis.descendantOrSelf, new System.XPath.XPathAnyNodeTest()), right.Release())));
1716 }
1717 }
1718 case System.XPath.Operator.slash:
1719 {
1720 {
1721 #if (DEBUG)
1722 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PathExpr");
1723 #endif
1724 return Match(true, new System.XPath.XPathCombineStepExpr(expr.Release(), right.Release()));
1725 }
1726 }
1727 }
1728 }
1729 *parentMatch20 = match;
1730 }
1731 *parentMatch19 = match;
1732 }
1733 *parentMatch13 = match;
1734 }
1735 *parentMatch12 = match;
1736 }
1737 if (match.hit)
1738 {
1739 *parentMatch11 = match;
1740 }
1741 else
1742 {
1743 lexer.SetPos(save);
1744 }
1745 }
1746 *parentMatch10 = match;
1747 }
1748 *parentMatch8 = match;
1749 }
1750 *parentMatch7 = match;
1751 }
1752 if (match.hit)
1753 {
1754 {
1755 #if (DEBUG)
1756 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PathExpr");
1757 #endif
1758 return Match(true, expr.Release());
1759 }
1760 }
1761 *parentMatch6 = match;
1762 }
1763 *parentMatch5 = match;
1764 }
1765 *parentMatch0 = match;
1766 }
1767 }
1768 #if (DEBUG)
1769 if (writeToLog)
1770 {
1771 if (match.hit)
1772 {
1773 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PathExpr");
1774 }
1775 else
1776 {
1777 System.Lex.WriteFailureToLog(lexer, u"PathExpr");
1778 }
1779 }
1780 #endif
1781 if (!match.hit)
1782 {
1783 match.value = null;
1784 }
1785 return match;
1786 }
1787 public static Match FilterExpr(XPathLexer& lexer)
1788 {
1789 #if (DEBUG)
1790 Span debugSpan;
1791 bool writeToLog = lexer.Log() != null;
1792 if (writeToLog)
1793 {
1794 debugSpan = lexer.GetSpan();
1795 System.Lex.WriteBeginRuleToLog(lexer, u"FilterExpr");
1796 }
1797 #endif
1798 UniquePtr<System.XPath.XPathExpr> expr;
1799 UniquePtr<System.XPath.XPathExpr> primaryExpr;
1800 UniquePtr<System.XPath.XPathExpr> predicate;
1801 Match match(false);
1802 Match* parentMatch0 = &match;
1803 {
1804 long pos = lexer.GetPos();
1805 Match match(false);
1806 Match* parentMatch1 = &match;
1807 {
1808 Match match(false);
1809 Match* parentMatch2 = &match;
1810 {
1811 Match match(false);
1812 Match* parentMatch3 = &match;
1813 {
1814 long pos = lexer.GetPos();
1815 Match match = XPathParser.PrimaryExpr(lexer);
1816 primaryExpr.Reset(cast<System.XPath.XPathExpr*>(match.value));
1817 if (match.hit)
1818 {
1819 expr.Reset(primaryExpr.Release());
1820 }
1821 *parentMatch3 = match;
1822 }
1823 *parentMatch2 = match;
1824 }
1825 if (match.hit)
1826 {
1827 Match match(false);
1828 Match* parentMatch4 = &match;
1829 {
1830 Match match(true);
1831 Match* parentMatch5 = &match;
1832 {
1833 while (true)
1834 {
1835 long save = lexer.GetPos();
1836 {
1837 Match match(false);
1838 Match* parentMatch6 = &match;
1839 {
1840 Match match(false);
1841 Match* parentMatch7 = &match;
1842 {
1843 long pos = lexer.GetPos();
1844 Match match = XPathParser.Predicate(lexer);
1845 predicate.Reset(cast<System.XPath.XPathExpr*>(match.value));
1846 if (match.hit)
1847 {
1848 expr.Reset(new System.XPath.XPathFilterExpr(expr.Release(), predicate.Release()));
1849 }
1850 *parentMatch7 = match;
1851 }
1852 *parentMatch6 = match;
1853 }
1854 if (match.hit)
1855 {
1856 *parentMatch5 = match;
1857 }
1858 else
1859 {
1860 lexer.SetPos(save);
1861 break;
1862 }
1863 }
1864 }
1865 }
1866 *parentMatch4 = match;
1867 }
1868 *parentMatch2 = match;
1869 }
1870 *parentMatch1 = match;
1871 }
1872 if (match.hit)
1873 {
1874 {
1875 #if (DEBUG)
1876 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"FilterExpr");
1877 #endif
1878 return Match(true, expr.Release());
1879 }
1880 }
1881 *parentMatch0 = match;
1882 }
1883 #if (DEBUG)
1884 if (writeToLog)
1885 {
1886 if (match.hit)
1887 {
1888 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"FilterExpr");
1889 }
1890 else
1891 {
1892 System.Lex.WriteFailureToLog(lexer, u"FilterExpr");
1893 }
1894 }
1895 #endif
1896 if (!match.hit)
1897 {
1898 match.value = null;
1899 }
1900 return match;
1901 }
1902 public static Match LocationPath(XPathLexer& lexer)
1903 {
1904 #if (DEBUG)
1905 Span debugSpan;
1906 bool writeToLog = lexer.Log() != null;
1907 if (writeToLog)
1908 {
1909 debugSpan = lexer.GetSpan();
1910 System.Lex.WriteBeginRuleToLog(lexer, u"LocationPath");
1911 }
1912 #endif
1913 UniquePtr<System.XPath.XPathExpr> absoluteLocationPath;
1914 UniquePtr<System.XPath.XPathExpr> relativeLocationPath;
1915 Match match(false);
1916 Match* parentMatch0 = &match;
1917 {
1918 long save = lexer.GetPos();
1919 Match match(false);
1920 Match* parentMatch1 = &match;
1921 {
1922 long pos = lexer.GetPos();
1923 Match match = XPathParser.AbsoluteLocationPath(lexer);
1924 absoluteLocationPath.Reset(cast<System.XPath.XPathExpr*>(match.value));
1925 if (match.hit)
1926 {
1927 {
1928 #if (DEBUG)
1929 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LocationPath");
1930 #endif
1931 return Match(true, absoluteLocationPath.Release());
1932 }
1933 }
1934 *parentMatch1 = match;
1935 }
1936 *parentMatch0 = match;
1937 if (!match.hit)
1938 {
1939 Match match(false);
1940 Match* parentMatch2 = &match;
1941 lexer.SetPos(save);
1942 {
1943 Match match(false);
1944 Match* parentMatch3 = &match;
1945 {
1946 long pos = lexer.GetPos();
1947 Match match = XPathParser.RelativeLocationPath(lexer);
1948 relativeLocationPath.Reset(cast<System.XPath.XPathExpr*>(match.value));
1949 if (match.hit)
1950 {
1951 {
1952 #if (DEBUG)
1953 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LocationPath");
1954 #endif
1955 return Match(true, relativeLocationPath.Release());
1956 }
1957 }
1958 *parentMatch3 = match;
1959 }
1960 *parentMatch2 = match;
1961 }
1962 *parentMatch0 = match;
1963 }
1964 }
1965 #if (DEBUG)
1966 if (writeToLog)
1967 {
1968 if (match.hit)
1969 {
1970 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LocationPath");
1971 }
1972 else
1973 {
1974 System.Lex.WriteFailureToLog(lexer, u"LocationPath");
1975 }
1976 }
1977 #endif
1978 if (!match.hit)
1979 {
1980 match.value = null;
1981 }
1982 return match;
1983 }
1984 public static Match AbsoluteLocationPath(XPathLexer& lexer)
1985 {
1986 #if (DEBUG)
1987 Span debugSpan;
1988 bool writeToLog = lexer.Log() != null;
1989 if (writeToLog)
1990 {
1991 debugSpan = lexer.GetSpan();
1992 System.Lex.WriteBeginRuleToLog(lexer, u"AbsoluteLocationPath");
1993 }
1994 #endif
1995 UniquePtr<System.XPath.XPathExpr> expr;
1996 UniquePtr<System.XPath.XPathExpr> abbreviatedAbsoluteLocationPath;
1997 UniquePtr<System.XPath.XPathExpr> right;
1998 Match match(false);
1999 Match* parentMatch0 = &match;
2000 {
2001 long pos = lexer.GetPos();
2002 Match match(false);
2003 Match* parentMatch1 = &match;
2004 {
2005 Match match(false);
2006 Match* parentMatch2 = &match;
2007 {
2008 long save = lexer.GetPos();
2009 Match match(false);
2010 Match* parentMatch3 = &match;
2011 {
2012 long pos = lexer.GetPos();
2013 Match match = XPathParser.AbbreviatedAbsoluteLocationPath(lexer);
2014 abbreviatedAbsoluteLocationPath.Reset(cast<System.XPath.XPathExpr*>(match.value));
2015 if (match.hit)
2016 {
2017 expr.Reset(abbreviatedAbsoluteLocationPath.Release());
2018 }
2019 *parentMatch3 = match;
2020 }
2021 *parentMatch2 = match;
2022 if (!match.hit)
2023 {
2024 Match match(false);
2025 Match* parentMatch4 = &match;
2026 lexer.SetPos(save);
2027 {
2028 Match match(false);
2029 Match* parentMatch5 = &match;
2030 {
2031 Match match(false);
2032 Match* parentMatch6 = &match;
2033 {
2034 long pos = lexer.GetPos();
2035 Match match(false);
2036 if (*lexer == SLASH)
2037 {
2038 ++lexer;
2039 match.hit = true;
2040 }
2041 if (match.hit)
2042 {
2043 expr.Reset(new System.XPath.XPathRootNodeExpr());
2044 }
2045 *parentMatch6 = match;
2046 }
2047 *parentMatch5 = match;
2048 }
2049 if (match.hit)
2050 {
2051 Match match(false);
2052 Match* parentMatch7 = &match;
2053 {
2054 Match match(true);
2055 long save = lexer.GetPos();
2056 Match* parentMatch8 = &match;
2057 {
2058 Match match(false);
2059 Match* parentMatch9 = &match;
2060 {
2061 Match match(false);
2062 Match* parentMatch10 = &match;
2063 {
2064 long pos = lexer.GetPos();
2065 Match match = XPathParser.RelativeLocationPath(lexer);
2066 right.Reset(cast<System.XPath.XPathExpr*>(match.value));
2067 if (match.hit)
2068 {
2069 expr.Reset(new System.XPath.XPathCombineStepExpr(expr.Release(), right.Release()));
2070 }
2071 *parentMatch10 = match;
2072 }
2073 *parentMatch9 = match;
2074 }
2075 if (match.hit)
2076 {
2077 *parentMatch8 = match;
2078 }
2079 else
2080 {
2081 lexer.SetPos(save);
2082 }
2083 }
2084 *parentMatch7 = match;
2085 }
2086 *parentMatch5 = match;
2087 }
2088 *parentMatch4 = match;
2089 }
2090 *parentMatch2 = match;
2091 }
2092 }
2093 *parentMatch1 = match;
2094 }
2095 if (match.hit)
2096 {
2097 {
2098 #if (DEBUG)
2099 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AbsoluteLocationPath");
2100 #endif
2101 return Match(true, expr.Release());
2102 }
2103 }
2104 *parentMatch0 = match;
2105 }
2106 #if (DEBUG)
2107 if (writeToLog)
2108 {
2109 if (match.hit)
2110 {
2111 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AbsoluteLocationPath");
2112 }
2113 else
2114 {
2115 System.Lex.WriteFailureToLog(lexer, u"AbsoluteLocationPath");
2116 }
2117 }
2118 #endif
2119 if (!match.hit)
2120 {
2121 match.value = null;
2122 }
2123 return match;
2124 }
2125 public static Match AbbreviatedAbsoluteLocationPath(XPathLexer& lexer)
2126 {
2127 #if (DEBUG)
2128 Span debugSpan;
2129 bool writeToLog = lexer.Log() != null;
2130 if (writeToLog)
2131 {
2132 debugSpan = lexer.GetSpan();
2133 System.Lex.WriteBeginRuleToLog(lexer, u"AbbreviatedAbsoluteLocationPath");
2134 }
2135 #endif
2136 UniquePtr<System.XPath.XPathExpr> right;
2137 Match match(false);
2138 Match* parentMatch0 = &match;
2139 {
2140 Match match(false);
2141 if (*lexer == SLASHSLASH)
2142 {
2143 ++lexer;
2144 match.hit = true;
2145 }
2146 *parentMatch0 = match;
2147 }
2148 if (match.hit)
2149 {
2150 Match match(false);
2151 Match* parentMatch1 = &match;
2152 {
2153 Match match(false);
2154 Match* parentMatch2 = &match;
2155 {
2156 long pos = lexer.GetPos();
2157 Match match = XPathParser.RelativeLocationPath(lexer);
2158 right.Reset(cast<System.XPath.XPathExpr*>(match.value));
2159 if (match.hit)
2160 {
2161 {
2162 #if (DEBUG)
2163 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AbbreviatedAbsoluteLocationPath");
2164 #endif
2165 return Match(true, new System.XPath.XPathCombineStepExpr(new System.XPath.XPathRootNodeExpr(), new System.XPath.XPathCombineStepExpr(new System.XPath.XPathLocationStepExpr(System.Dom.Axis.descendantOrSelf, new System.XPath.XPathAnyNodeTest()), right.Release())));
2166 }
2167 }
2168 *parentMatch2 = match;
2169 }
2170 *parentMatch1 = match;
2171 }
2172 *parentMatch0 = match;
2173 }
2174 #if (DEBUG)
2175 if (writeToLog)
2176 {
2177 if (match.hit)
2178 {
2179 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AbbreviatedAbsoluteLocationPath");
2180 }
2181 else
2182 {
2183 System.Lex.WriteFailureToLog(lexer, u"AbbreviatedAbsoluteLocationPath");
2184 }
2185 }
2186 #endif
2187 if (!match.hit)
2188 {
2189 match.value = null;
2190 }
2191 return match;
2192 }
2193 public static Match RelativeLocationPath(XPathLexer& lexer)
2194 {
2195 #if (DEBUG)
2196 Span debugSpan;
2197 bool writeToLog = lexer.Log() != null;
2198 if (writeToLog)
2199 {
2200 debugSpan = lexer.GetSpan();
2201 System.Lex.WriteBeginRuleToLog(lexer, u"RelativeLocationPath");
2202 }
2203 #endif
2204 UniquePtr<System.XPath.XPathExpr> expr;
2205 System.XPath.Operator op;
2206 UniquePtr<System.XPath.XPathLocationStepExpr> left;
2207 UniquePtr<System.XPath.XPathLocationStepExpr> right;
2208 Match match(false);
2209 Match* parentMatch0 = &match;
2210 {
2211 long pos = lexer.GetPos();
2212 Match match(false);
2213 Match* parentMatch1 = &match;
2214 {
2215 Match match(false);
2216 Match* parentMatch2 = &match;
2217 {
2218 Match match(false);
2219 Match* parentMatch3 = &match;
2220 {
2221 long pos = lexer.GetPos();
2222 Match match = XPathParser.Step(lexer);
2223 left.Reset(cast<System.XPath.XPathLocationStepExpr*>(match.value));
2224 if (match.hit)
2225 {
2226 expr.Reset(left.Release());
2227 }
2228 *parentMatch3 = match;
2229 }
2230 *parentMatch2 = match;
2231 }
2232 if (match.hit)
2233 {
2234 Match match(false);
2235 Match* parentMatch4 = &match;
2236 {
2237 Match match(true);
2238 Match* parentMatch5 = &match;
2239 {
2240 while (true)
2241 {
2242 long save = lexer.GetPos();
2243 {
2244 Match match(false);
2245 Match* parentMatch6 = &match;
2246 {
2247 Match match(false);
2248 Match* parentMatch7 = &match;
2249 {
2250 Match match(false);
2251 Match* parentMatch8 = &match;
2252 {
2253 Match match(false);
2254 Match* parentMatch9 = &match;
2255 {
2256 long save = lexer.GetPos();
2257 Match match(false);
2258 Match* parentMatch10 = &match;
2259 {
2260 long pos = lexer.GetPos();
2261 Match match(false);
2262 if (*lexer == SLASHSLASH)
2263 {
2264 ++lexer;
2265 match.hit = true;
2266 }
2267 if (match.hit)
2268 {
2269 op = System.XPath.Operator.slashSlash;
2270 }
2271 *parentMatch10 = match;
2272 }
2273 *parentMatch9 = match;
2274 if (!match.hit)
2275 {
2276 Match match(false);
2277 Match* parentMatch11 = &match;
2278 lexer.SetPos(save);
2279 {
2280 Match match(false);
2281 Match* parentMatch12 = &match;
2282 {
2283 long pos = lexer.GetPos();
2284 Match match(false);
2285 if (*lexer == SLASH)
2286 {
2287 ++lexer;
2288 match.hit = true;
2289 }
2290 if (match.hit)
2291 {
2292 op = System.XPath.Operator.slash;
2293 }
2294 *parentMatch12 = match;
2295 }
2296 *parentMatch11 = match;
2297 }
2298 *parentMatch9 = match;
2299 }
2300 }
2301 *parentMatch8 = match;
2302 }
2303 *parentMatch7 = match;
2304 }
2305 if (match.hit)
2306 {
2307 Match match(false);
2308 Match* parentMatch13 = &match;
2309 {
2310 Match match(false);
2311 Match* parentMatch14 = &match;
2312 {
2313 long pos = lexer.GetPos();
2314 Match match = XPathParser.Step(lexer);
2315 right.Reset(cast<System.XPath.XPathLocationStepExpr*>(match.value));
2316 if (match.hit)
2317 {
2318 switch (op)
2319 {
2320 case System.XPath.Operator.slashSlash:
2321 {
2322 expr.Reset(new System.XPath.XPathCombineStepExpr(expr.Release(), new System.XPath.XPathCombineStepExpr(new System.XPath.XPathLocationStepExpr(System.Dom.Axis.descendantOrSelf, new System.XPath.XPathAnyNodeTest()), right.Release())));
2323 break;
2324 }
2325 case System.XPath.Operator.slash:
2326 {
2327 expr.Reset(new System.XPath.XPathCombineStepExpr(expr.Release(), right.Release()));
2328 break;
2329 }
2330 }
2331 }
2332 *parentMatch14 = match;
2333 }
2334 *parentMatch13 = match;
2335 }
2336 *parentMatch7 = match;
2337 }
2338 *parentMatch6 = match;
2339 }
2340 if (match.hit)
2341 {
2342 *parentMatch5 = match;
2343 }
2344 else
2345 {
2346 lexer.SetPos(save);
2347 break;
2348 }
2349 }
2350 }
2351 }
2352 *parentMatch4 = match;
2353 }
2354 *parentMatch2 = match;
2355 }
2356 *parentMatch1 = match;
2357 }
2358 if (match.hit)
2359 {
2360 {
2361 #if (DEBUG)
2362 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RelativeLocationPath");
2363 #endif
2364 return Match(true, expr.Release());
2365 }
2366 }
2367 *parentMatch0 = match;
2368 }
2369 #if (DEBUG)
2370 if (writeToLog)
2371 {
2372 if (match.hit)
2373 {
2374 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RelativeLocationPath");
2375 }
2376 else
2377 {
2378 System.Lex.WriteFailureToLog(lexer, u"RelativeLocationPath");
2379 }
2380 }
2381 #endif
2382 if (!match.hit)
2383 {
2384 match.value = null;
2385 }
2386 return match;
2387 }
2388 public static Match Step(XPathLexer& lexer)
2389 {
2390 #if (DEBUG)
2391 Span debugSpan;
2392 bool writeToLog = lexer.Log() != null;
2393 if (writeToLog)
2394 {
2395 debugSpan = lexer.GetSpan();
2396 System.Lex.WriteBeginRuleToLog(lexer, u"Step");
2397 }
2398 #endif
2399 UniquePtr<System.XPath.XPathLocationStepExpr> expr;
2400 UniquePtr<Value<System.Dom.Axis>> axis;
2401 UniquePtr<System.XPath.XPathNodeTestExpr> nodeTest;
2402 UniquePtr<System.XPath.XPathExpr> predicate;
2403 UniquePtr<System.XPath.XPathLocationStepExpr> abbreviatedStep;
2404 Match match(false);
2405 Match* parentMatch0 = &match;
2406 {
2407 long pos = lexer.GetPos();
2408 Match match(false);
2409 Match* parentMatch1 = &match;
2410 {
2411 Match match(false);
2412 Match* parentMatch2 = &match;
2413 {
2414 long save = lexer.GetPos();
2415 Match match(false);
2416 Match* parentMatch3 = &match;
2417 {
2418 Match match(false);
2419 Match* parentMatch4 = &match;
2420 {
2421 Match match = XPathParser.AxisSpecifier(lexer);
2422 axis.Reset(cast<Value<System.Dom.Axis>*>(match.value));
2423 *parentMatch4 = match;
2424 }
2425 if (match.hit)
2426 {
2427 Match match(false);
2428 Match* parentMatch5 = &match;
2429 {
2430 Match match(false);
2431 Match* parentMatch6 = &match;
2432 {
2433 long pos = lexer.GetPos();
2434 Match match = XPathParser.NodeTest(lexer);
2435 nodeTest.Reset(cast<System.XPath.XPathNodeTestExpr*>(match.value));
2436 if (match.hit)
2437 {
2438 expr.Reset(new System.XPath.XPathLocationStepExpr(axis->value, nodeTest.Release()));
2439 }
2440 *parentMatch6 = match;
2441 }
2442 *parentMatch5 = match;
2443 }
2444 *parentMatch4 = match;
2445 }
2446 *parentMatch3 = match;
2447 }
2448 if (match.hit)
2449 {
2450 Match match(false);
2451 Match* parentMatch7 = &match;
2452 {
2453 Match match(true);
2454 Match* parentMatch8 = &match;
2455 {
2456 while (true)
2457 {
2458 long save = lexer.GetPos();
2459 {
2460 Match match(false);
2461 Match* parentMatch9 = &match;
2462 {
2463 Match match(false);
2464 Match* parentMatch10 = &match;
2465 {
2466 long pos = lexer.GetPos();
2467 Match match = XPathParser.Predicate(lexer);
2468 predicate.Reset(cast<System.XPath.XPathExpr*>(match.value));
2469 if (match.hit)
2470 {
2471 expr->AddPredicate(predicate.Release());
2472 }
2473 *parentMatch10 = match;
2474 }
2475 *parentMatch9 = match;
2476 }
2477 if (match.hit)
2478 {
2479 *parentMatch8 = match;
2480 }
2481 else
2482 {
2483 lexer.SetPos(save);
2484 break;
2485 }
2486 }
2487 }
2488 }
2489 *parentMatch7 = match;
2490 }
2491 *parentMatch3 = match;
2492 }
2493 *parentMatch2 = match;
2494 if (!match.hit)
2495 {
2496 Match match(false);
2497 Match* parentMatch11 = &match;
2498 lexer.SetPos(save);
2499 {
2500 Match match(false);
2501 Match* parentMatch12 = &match;
2502 {
2503 long pos = lexer.GetPos();
2504 Match match = XPathParser.AbbreviatedStep(lexer);
2505 abbreviatedStep.Reset(cast<System.XPath.XPathLocationStepExpr*>(match.value));
2506 if (match.hit)
2507 {
2508 expr.Reset(abbreviatedStep.Release());
2509 }
2510 *parentMatch12 = match;
2511 }
2512 *parentMatch11 = match;
2513 }
2514 *parentMatch2 = match;
2515 }
2516 }
2517 *parentMatch1 = match;
2518 }
2519 if (match.hit)
2520 {
2521 {
2522 #if (DEBUG)
2523 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Step");
2524 #endif
2525 return Match(true, expr.Release());
2526 }
2527 }
2528 *parentMatch0 = match;
2529 }
2530 #if (DEBUG)
2531 if (writeToLog)
2532 {
2533 if (match.hit)
2534 {
2535 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Step");
2536 }
2537 else
2538 {
2539 System.Lex.WriteFailureToLog(lexer, u"Step");
2540 }
2541 }
2542 #endif
2543 if (!match.hit)
2544 {
2545 match.value = null;
2546 }
2547 return match;
2548 }
2549 public static Match AxisSpecifier(XPathLexer& lexer)
2550 {
2551 #if (DEBUG)
2552 Span debugSpan;
2553 bool writeToLog = lexer.Log() != null;
2554 if (writeToLog)
2555 {
2556 debugSpan = lexer.GetSpan();
2557 System.Lex.WriteBeginRuleToLog(lexer, u"AxisSpecifier");
2558 }
2559 #endif
2560 UniquePtr<Value<System.Dom.Axis>> axis;
2561 UniquePtr<Value<System.Dom.Axis>> abbreviatedAxisSpecifier;
2562 Match match(false);
2563 Match* parentMatch0 = &match;
2564 {
2565 long save = lexer.GetPos();
2566 Match match(false);
2567 Match* parentMatch1 = &match;
2568 {
2569 Match match = XPathParser.AxisName(lexer);
2570 axis.Reset(cast<Value<System.Dom.Axis>*>(match.value));
2571 *parentMatch1 = match;
2572 }
2573 if (match.hit)
2574 {
2575 Match match(false);
2576 Match* parentMatch2 = &match;
2577 {
2578 Match match(false);
2579 Match* parentMatch3 = &match;
2580 {
2581 long pos = lexer.GetPos();
2582 Match match(false);
2583 if (*lexer == COLONCOLON)
2584 {
2585 ++lexer;
2586 match.hit = true;
2587 }
2588 if (match.hit)
2589 {
2590 {
2591 #if (DEBUG)
2592 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisSpecifier");
2593 #endif
2594 return Match(true, new Value<System.Dom.Axis>(axis->value));
2595 }
2596 }
2597 *parentMatch3 = match;
2598 }
2599 *parentMatch2 = match;
2600 }
2601 *parentMatch1 = match;
2602 }
2603 *parentMatch0 = match;
2604 if (!match.hit)
2605 {
2606 Match match(false);
2607 Match* parentMatch4 = &match;
2608 lexer.SetPos(save);
2609 {
2610 Match match(false);
2611 Match* parentMatch5 = &match;
2612 {
2613 long pos = lexer.GetPos();
2614 Match match = XPathParser.AbbreviatedAxisSpecifier(lexer);
2615 abbreviatedAxisSpecifier.Reset(cast<Value<System.Dom.Axis>*>(match.value));
2616 if (match.hit)
2617 {
2618 {
2619 #if (DEBUG)
2620 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisSpecifier");
2621 #endif
2622 return Match(true, new Value<System.Dom.Axis>(abbreviatedAxisSpecifier->value));
2623 }
2624 }
2625 *parentMatch5 = match;
2626 }
2627 *parentMatch4 = match;
2628 }
2629 *parentMatch0 = match;
2630 }
2631 }
2632 #if (DEBUG)
2633 if (writeToLog)
2634 {
2635 if (match.hit)
2636 {
2637 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisSpecifier");
2638 }
2639 else
2640 {
2641 System.Lex.WriteFailureToLog(lexer, u"AxisSpecifier");
2642 }
2643 }
2644 #endif
2645 if (!match.hit)
2646 {
2647 match.value = null;
2648 }
2649 return match;
2650 }
2651 public static Match AxisName(XPathLexer& lexer)
2652 {
2653 #if (DEBUG)
2654 Span debugSpan;
2655 bool writeToLog = lexer.Log() != null;
2656 if (writeToLog)
2657 {
2658 debugSpan = lexer.GetSpan();
2659 System.Lex.WriteBeginRuleToLog(lexer, u"AxisName");
2660 }
2661 #endif
2662 Match match(false);
2663 Match* parentMatch0 = &match;
2664 {
2665 long pos = lexer.GetPos();
2666 bool pass = true;
2667 Match match(false);
2668 if (*lexer == NAME)
2669 {
2670 ++lexer;
2671 match.hit = true;
2672 }
2673 if (match.hit)
2674 {
2675 Token token = lexer.GetToken(pos);
2676 switch (lexer.GetKeywordToken(token.match))
2677 {
2678 case ANCESTOR:
2679 {
2680 {
2681 #if (DEBUG)
2682 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisName");
2683 #endif
2684 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.ancestor));
2685 }
2686 }
2687 case ANCESTOR_OR_SELF:
2688 {
2689 {
2690 #if (DEBUG)
2691 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisName");
2692 #endif
2693 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.ancestorOrSelf));
2694 }
2695 }
2696 case ATTRIBUTE:
2697 {
2698 {
2699 #if (DEBUG)
2700 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisName");
2701 #endif
2702 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.attribute));
2703 }
2704 }
2705 case CHILD:
2706 {
2707 {
2708 #if (DEBUG)
2709 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisName");
2710 #endif
2711 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.child));
2712 }
2713 }
2714 case DESCENDANT:
2715 {
2716 {
2717 #if (DEBUG)
2718 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisName");
2719 #endif
2720 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.descendant));
2721 }
2722 }
2723 case DESCENDANT_OR_SELF:
2724 {
2725 {
2726 #if (DEBUG)
2727 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisName");
2728 #endif
2729 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.descendantOrSelf));
2730 }
2731 }
2732 case FOLLOWING:
2733 {
2734 {
2735 #if (DEBUG)
2736 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisName");
2737 #endif
2738 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.following));
2739 }
2740 }
2741 case FOLLOWING_SIBLING:
2742 {
2743 {
2744 #if (DEBUG)
2745 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisName");
2746 #endif
2747 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.followingSibling));
2748 }
2749 }
2750 case NAMESPACE:
2751 {
2752 {
2753 #if (DEBUG)
2754 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisName");
2755 #endif
2756 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.ns));
2757 }
2758 }
2759 case PARENT:
2760 {
2761 {
2762 #if (DEBUG)
2763 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisName");
2764 #endif
2765 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.parent));
2766 }
2767 }
2768 case PRECEDING:
2769 {
2770 {
2771 #if (DEBUG)
2772 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisName");
2773 #endif
2774 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.preceding));
2775 }
2776 }
2777 case PRECEDING_SIBLING:
2778 {
2779 {
2780 #if (DEBUG)
2781 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisName");
2782 #endif
2783 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.precedingSibling));
2784 }
2785 }
2786 case SELF:
2787 {
2788 {
2789 #if (DEBUG)
2790 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisName");
2791 #endif
2792 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.self));
2793 }
2794 }
2795 default:
2796 {
2797 pass = false;
2798 break;
2799 }
2800 }
2801 }
2802 if (match.hit && !pass)
2803 {
2804 match = Match(false);
2805 }
2806 *parentMatch0 = match;
2807 }
2808 #if (DEBUG)
2809 if (writeToLog)
2810 {
2811 if (match.hit)
2812 {
2813 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AxisName");
2814 }
2815 else
2816 {
2817 System.Lex.WriteFailureToLog(lexer, u"AxisName");
2818 }
2819 }
2820 #endif
2821 if (!match.hit)
2822 {
2823 match.value = null;
2824 }
2825 return match;
2826 }
2827 public static Match AbbreviatedAxisSpecifier(XPathLexer& lexer)
2828 {
2829 #if (DEBUG)
2830 Span debugSpan;
2831 bool writeToLog = lexer.Log() != null;
2832 if (writeToLog)
2833 {
2834 debugSpan = lexer.GetSpan();
2835 System.Lex.WriteBeginRuleToLog(lexer, u"AbbreviatedAxisSpecifier");
2836 }
2837 #endif
2838 Match match(false);
2839 Match* parentMatch0 = &match;
2840 {
2841 long save = lexer.GetPos();
2842 Match match(false);
2843 Match* parentMatch1 = &match;
2844 {
2845 long pos = lexer.GetPos();
2846 Match match(false);
2847 if (*lexer == AT)
2848 {
2849 ++lexer;
2850 match.hit = true;
2851 }
2852 if (match.hit)
2853 {
2854 {
2855 #if (DEBUG)
2856 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AbbreviatedAxisSpecifier");
2857 #endif
2858 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.attribute));
2859 }
2860 }
2861 *parentMatch1 = match;
2862 }
2863 *parentMatch0 = match;
2864 if (!match.hit)
2865 {
2866 Match match(false);
2867 Match* parentMatch2 = &match;
2868 lexer.SetPos(save);
2869 {
2870 Match match(false);
2871 Match* parentMatch3 = &match;
2872 {
2873 long pos = lexer.GetPos();
2874 Match match(true);
2875 if (match.hit)
2876 {
2877 {
2878 #if (DEBUG)
2879 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AbbreviatedAxisSpecifier");
2880 #endif
2881 return Match(true, new Value<System.Dom.Axis>(System.Dom.Axis.child));
2882 }
2883 }
2884 *parentMatch3 = match;
2885 }
2886 *parentMatch2 = match;
2887 }
2888 *parentMatch0 = match;
2889 }
2890 }
2891 #if (DEBUG)
2892 if (writeToLog)
2893 {
2894 if (match.hit)
2895 {
2896 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AbbreviatedAxisSpecifier");
2897 }
2898 else
2899 {
2900 System.Lex.WriteFailureToLog(lexer, u"AbbreviatedAxisSpecifier");
2901 }
2902 }
2903 #endif
2904 if (!match.hit)
2905 {
2906 match.value = null;
2907 }
2908 return match;
2909 }
2910 public static Match NodeTest(XPathLexer& lexer)
2911 {
2912 #if (DEBUG)
2913 Span debugSpan;
2914 bool writeToLog = lexer.Log() != null;
2915 if (writeToLog)
2916 {
2917 debugSpan = lexer.GetSpan();
2918 System.Lex.WriteBeginRuleToLog(lexer, u"NodeTest");
2919 }
2920 #endif
2921 UniquePtr<System.XPath.XPathExpr> pi;
2922 UniquePtr<System.XPath.XPathNodeTestExpr> nodeType;
2923 UniquePtr<System.XPath.XPathNodeTestExpr> nameTest;
2924 Match match(false);
2925 Match* parentMatch0 = &match;
2926 {
2927 long save = lexer.GetPos();
2928 Match match(false);
2929 Match* parentMatch1 = &match;
2930 {
2931 long save = lexer.GetPos();
2932 Match match(false);
2933 Match* parentMatch2 = &match;
2934 {
2935 Match match(false);
2936 Match* parentMatch3 = &match;
2937 {
2938 Match match(false);
2939 Match* parentMatch4 = &match;
2940 {
2941 Match match(false);
2942 Match* parentMatch5 = &match;
2943 {
2944 long pos = lexer.GetPos();
2945 bool pass = true;
2946 Match match(false);
2947 if (*lexer == NAME)
2948 {
2949 ++lexer;
2950 match.hit = true;
2951 }
2952 if (match.hit)
2953 {
2954 Token token = lexer.GetToken(pos);
2955 pass = lexer.GetKeywordToken(token.match) == PROCESSING_INSTRUCTION;
2956 }
2957 if (match.hit && !pass)
2958 {
2959 match = Match(false);
2960 }
2961 *parentMatch5 = match;
2962 }
2963 *parentMatch4 = match;
2964 }
2965 if (match.hit)
2966 {
2967 Match match(false);
2968 Match* parentMatch6 = &match;
2969 {
2970 Match match(false);
2971 if (*lexer == LPAREN)
2972 {
2973 ++lexer;
2974 match.hit = true;
2975 }
2976 *parentMatch6 = match;
2977 }
2978 *parentMatch4 = match;
2979 }
2980 *parentMatch3 = match;
2981 }
2982 if (match.hit)
2983 {
2984 Match match(false);
2985 Match* parentMatch7 = &match;
2986 {
2987 Match match = XPathParser.Literal(lexer);
2988 pi.Reset(cast<System.XPath.XPathExpr*>(match.value));
2989 *parentMatch7 = match;
2990 }
2991 *parentMatch3 = match;
2992 }
2993 *parentMatch2 = match;
2994 }
2995 if (match.hit)
2996 {
2997 Match match(false);
2998 Match* parentMatch8 = &match;
2999 {
3000 Match match(false);
3001 Match* parentMatch9 = &match;
3002 {
3003 long pos = lexer.GetPos();
3004 Match match(false);
3005 if (*lexer == RPAREN)
3006 {
3007 ++lexer;
3008 match.hit = true;
3009 }
3010 if (match.hit)
3011 {
3012 {
3013 #if (DEBUG)
3014 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NodeTest");
3015 #endif
3016 return Match(true, new System.XPath.XPathPILiteralTest(pi.Release()));
3017 }
3018 }
3019 *parentMatch9 = match;
3020 }
3021 *parentMatch8 = match;
3022 }
3023 *parentMatch2 = match;
3024 }
3025 *parentMatch1 = match;
3026 if (!match.hit)
3027 {
3028 Match match(false);
3029 Match* parentMatch10 = &match;
3030 lexer.SetPos(save);
3031 {
3032 Match match(false);
3033 Match* parentMatch11 = &match;
3034 {
3035 Match match(false);
3036 Match* parentMatch12 = &match;
3037 {
3038 Match match = XPathParser.NodeType(lexer);
3039 nodeType.Reset(cast<System.XPath.XPathNodeTestExpr*>(match.value));
3040 *parentMatch12 = match;
3041 }
3042 if (match.hit)
3043 {
3044 Match match(false);
3045 Match* parentMatch13 = &match;
3046 {
3047 Match match(false);
3048 if (*lexer == LPAREN)
3049 {
3050 ++lexer;
3051 match.hit = true;
3052 }
3053 *parentMatch13 = match;
3054 }
3055 *parentMatch12 = match;
3056 }
3057 *parentMatch11 = match;
3058 }
3059 if (match.hit)
3060 {
3061 Match match(false);
3062 Match* parentMatch14 = &match;
3063 {
3064 Match match(false);
3065 Match* parentMatch15 = &match;
3066 {
3067 long pos = lexer.GetPos();
3068 Match match(false);
3069 if (*lexer == RPAREN)
3070 {
3071 ++lexer;
3072 match.hit = true;
3073 }
3074 if (match.hit)
3075 {
3076 {
3077 #if (DEBUG)
3078 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NodeTest");
3079 #endif
3080 return Match(true, nodeType.Release());
3081 }
3082 }
3083 *parentMatch15 = match;
3084 }
3085 *parentMatch14 = match;
3086 }
3087 *parentMatch11 = match;
3088 }
3089 *parentMatch10 = match;
3090 }
3091 *parentMatch1 = match;
3092 }
3093 }
3094 *parentMatch0 = match;
3095 if (!match.hit)
3096 {
3097 Match match(false);
3098 Match* parentMatch16 = &match;
3099 lexer.SetPos(save);
3100 {
3101 Match match(false);
3102 Match* parentMatch17 = &match;
3103 {
3104 long pos = lexer.GetPos();
3105 Match match = XPathParser.NameTest(lexer);
3106 nameTest.Reset(cast<System.XPath.XPathNodeTestExpr*>(match.value));
3107 if (match.hit)
3108 {
3109 {
3110 #if (DEBUG)
3111 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NodeTest");
3112 #endif
3113 return Match(true, nameTest.Release());
3114 }
3115 }
3116 *parentMatch17 = match;
3117 }
3118 *parentMatch16 = match;
3119 }
3120 *parentMatch0 = match;
3121 }
3122 }
3123 #if (DEBUG)
3124 if (writeToLog)
3125 {
3126 if (match.hit)
3127 {
3128 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NodeTest");
3129 }
3130 else
3131 {
3132 System.Lex.WriteFailureToLog(lexer, u"NodeTest");
3133 }
3134 }
3135 #endif
3136 if (!match.hit)
3137 {
3138 match.value = null;
3139 }
3140 return match;
3141 }
3142 public static Match NodeType(XPathLexer& lexer)
3143 {
3144 #if (DEBUG)
3145 Span debugSpan;
3146 bool writeToLog = lexer.Log() != null;
3147 if (writeToLog)
3148 {
3149 debugSpan = lexer.GetSpan();
3150 System.Lex.WriteBeginRuleToLog(lexer, u"NodeType");
3151 }
3152 #endif
3153 Match match(false);
3154 Match* parentMatch0 = &match;
3155 {
3156 long pos = lexer.GetPos();
3157 bool pass = true;
3158 Match match(false);
3159 if (*lexer == NAME)
3160 {
3161 ++lexer;
3162 match.hit = true;
3163 }
3164 if (match.hit)
3165 {
3166 Token token = lexer.GetToken(pos);
3167 switch (lexer.GetKeywordToken(token.match))
3168 {
3169 case COMMENT:
3170 {
3171 #if (DEBUG)
3172 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NodeType");
3173 #endif
3174 return Match(true, new System.XPath.XPathCommentNodeTest());
3175 }
3176 case TEXT:
3177 {
3178 #if (DEBUG)
3179 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NodeType");
3180 #endif
3181 return Match(true, new System.XPath.XPathTextNodeTest());
3182 }
3183 case PROCESSING_INSTRUCTION:
3184 {
3185 #if (DEBUG)
3186 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NodeType");
3187 #endif
3188 return Match(true, new System.XPath.XPathPINodeTest());
3189 }
3190 case NODE:
3191 {
3192 #if (DEBUG)
3193 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NodeType");
3194 #endif
3195 return Match(true, new System.XPath.XPathAnyNodeTest());
3196 }
3197 default:
3198 {
3199 pass = false;
3200 break;
3201 }
3202 }
3203 }
3204 if (match.hit && !pass)
3205 {
3206 match = Match(false);
3207 }
3208 *parentMatch0 = match;
3209 }
3210 #if (DEBUG)
3211 if (writeToLog)
3212 {
3213 if (match.hit)
3214 {
3215 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NodeType");
3216 }
3217 else
3218 {
3219 System.Lex.WriteFailureToLog(lexer, u"NodeType");
3220 }
3221 }
3222 #endif
3223 if (!match.hit)
3224 {
3225 match.value = null;
3226 }
3227 return match;
3228 }
3229 public static Match NameTest(XPathLexer& lexer)
3230 {
3231 #if (DEBUG)
3232 Span debugSpan;
3233 bool writeToLog = lexer.Log() != null;
3234 if (writeToLog)
3235 {
3236 debugSpan = lexer.GetSpan();
3237 System.Lex.WriteBeginRuleToLog(lexer, u"NameTest");
3238 }
3239 #endif
3240 UniquePtr<Value<ustring>> ncname;
3241 UniquePtr<Value<ustring>> qname;
3242 Match match(false);
3243 Match* parentMatch0 = &match;
3244 {
3245 long save = lexer.GetPos();
3246 Match match(false);
3247 Match* parentMatch1 = &match;
3248 {
3249 long save = lexer.GetPos();
3250 Match match(false);
3251 Match* parentMatch2 = &match;
3252 {
3253 long pos = lexer.GetPos();
3254 Match match(false);
3255 if (*lexer == STAR)
3256 {
3257 ++lexer;
3258 match.hit = true;
3259 }
3260 if (match.hit)
3261 {
3262 {
3263 #if (DEBUG)
3264 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NameTest");
3265 #endif
3266 return Match(true, new System.XPath.XPathPrincipalNodeTest());
3267 }
3268 }
3269 *parentMatch2 = match;
3270 }
3271 *parentMatch1 = match;
3272 if (!match.hit)
3273 {
3274 Match match(false);
3275 Match* parentMatch3 = &match;
3276 lexer.SetPos(save);
3277 {
3278 Match match(false);
3279 Match* parentMatch4 = &match;
3280 {
3281 Match match(false);
3282 Match* parentMatch5 = &match;
3283 {
3284 Match match = XPathParser.NCName(lexer);
3285 ncname.Reset(cast<Value<ustring>*>(match.value));
3286 *parentMatch5 = match;
3287 }
3288 if (match.hit)
3289 {
3290 Match match(false);
3291 Match* parentMatch6 = &match;
3292 {
3293 Match match(false);
3294 if (*lexer == COLON)
3295 {
3296 ++lexer;
3297 match.hit = true;
3298 }
3299 *parentMatch6 = match;
3300 }
3301 *parentMatch5 = match;
3302 }
3303 *parentMatch4 = match;
3304 }
3305 if (match.hit)
3306 {
3307 Match match(false);
3308 Match* parentMatch7 = &match;
3309 {
3310 Match match(false);
3311 Match* parentMatch8 = &match;
3312 {
3313 long pos = lexer.GetPos();
3314 Match match(false);
3315 if (*lexer == STAR)
3316 {
3317 ++lexer;
3318 match.hit = true;
3319 }
3320 if (match.hit)
3321 {
3322 {
3323 #if (DEBUG)
3324 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NameTest");
3325 #endif
3326 return Match(true, new System.XPath.XPathPrefixTest(ncname->value));
3327 }
3328 }
3329 *parentMatch8 = match;
3330 }
3331 *parentMatch7 = match;
3332 }
3333 *parentMatch4 = match;
3334 }
3335 *parentMatch3 = match;
3336 }
3337 *parentMatch1 = match;
3338 }
3339 }
3340 *parentMatch0 = match;
3341 if (!match.hit)
3342 {
3343 Match match(false);
3344 Match* parentMatch9 = &match;
3345 lexer.SetPos(save);
3346 {
3347 Match match(false);
3348 Match* parentMatch10 = &match;
3349 {
3350 long pos = lexer.GetPos();
3351 Match match = XPathParser.QName(lexer);
3352 qname.Reset(cast<Value<ustring>*>(match.value));
3353 if (match.hit)
3354 {
3355 {
3356 #if (DEBUG)
3357 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NameTest");
3358 #endif
3359 return Match(true, new System.XPath.XPathNameTest(qname->value));
3360 }
3361 }
3362 *parentMatch10 = match;
3363 }
3364 *parentMatch9 = match;
3365 }
3366 *parentMatch0 = match;
3367 }
3368 }
3369 #if (DEBUG)
3370 if (writeToLog)
3371 {
3372 if (match.hit)
3373 {
3374 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NameTest");
3375 }
3376 else
3377 {
3378 System.Lex.WriteFailureToLog(lexer, u"NameTest");
3379 }
3380 }
3381 #endif
3382 if (!match.hit)
3383 {
3384 match.value = null;
3385 }
3386 return match;
3387 }
3388 public static Match AbbreviatedStep(XPathLexer& lexer)
3389 {
3390 #if (DEBUG)
3391 Span debugSpan;
3392 bool writeToLog = lexer.Log() != null;
3393 if (writeToLog)
3394 {
3395 debugSpan = lexer.GetSpan();
3396 System.Lex.WriteBeginRuleToLog(lexer, u"AbbreviatedStep");
3397 }
3398 #endif
3399 Match match(false);
3400 long pos = lexer.GetPos();
3401 Span span = lexer.GetSpan();
3402 switch (*lexer)
3403 {
3404 case DOTDOT:
3405 {
3406 ++lexer;
3407 {
3408 #if (DEBUG)
3409 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AbbreviatedStep");
3410 #endif
3411 return Match(true, new System.XPath.XPathLocationStepExpr(System.Dom.Axis.parent, new System.XPath.XPathAnyNodeTest()));
3412 }
3413 break;
3414 }
3415 case DOT:
3416 {
3417 ++lexer;
3418 {
3419 #if (DEBUG)
3420 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AbbreviatedStep");
3421 #endif
3422 return Match(true, new System.XPath.XPathLocationStepExpr(System.Dom.Axis.self, new System.XPath.XPathAnyNodeTest()));
3423 }
3424 break;
3425 }
3426 }
3427 #if (DEBUG)
3428 if (writeToLog)
3429 {
3430 if (match.hit)
3431 {
3432 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"AbbreviatedStep");
3433 }
3434 else
3435 {
3436 System.Lex.WriteFailureToLog(lexer, u"AbbreviatedStep");
3437 }
3438 }
3439 #endif
3440 if (!match.hit)
3441 {
3442 match.value = null;
3443 }
3444 return match;
3445 }
3446 public static Match Literal(XPathLexer& lexer)
3447 {
3448 #if (DEBUG)
3449 Span debugSpan;
3450 bool writeToLog = lexer.Log() != null;
3451 if (writeToLog)
3452 {
3453 debugSpan = lexer.GetSpan();
3454 System.Lex.WriteBeginRuleToLog(lexer, u"Literal");
3455 }
3456 #endif
3457 Match match(false);
3458 long pos = lexer.GetPos();
3459 Span span = lexer.GetSpan();
3460 switch (*lexer)
3461 {
3462 case DQSTRING:
3463 {
3464 ++lexer;
3465 Token token = lexer.GetToken(pos);
3466 ustring str = System.XPath.ParseDQString(lexer.FileName(), token);
3467 {
3468 #if (DEBUG)
3469 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Literal");
3470 #endif
3471 return Match(true, new System.XPath.XPathLiteral(str));
3472 }
3473 break;
3474 }
3475 case SQSTRING:
3476 {
3477 ++lexer;
3478 Token token = lexer.GetToken(pos);
3479 ustring str = System.XPath.ParseSQString(lexer.FileName(), token);
3480 {
3481 #if (DEBUG)
3482 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Literal");
3483 #endif
3484 return Match(true, new System.XPath.XPathLiteral(str));
3485 }
3486 break;
3487 }
3488 }
3489 #if (DEBUG)
3490 if (writeToLog)
3491 {
3492 if (match.hit)
3493 {
3494 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Literal");
3495 }
3496 else
3497 {
3498 System.Lex.WriteFailureToLog(lexer, u"Literal");
3499 }
3500 }
3501 #endif
3502 if (!match.hit)
3503 {
3504 match.value = null;
3505 }
3506 return match;
3507 }
3508 public static Match Number(XPathLexer& lexer)
3509 {
3510 #if (DEBUG)
3511 Span debugSpan;
3512 bool writeToLog = lexer.Log() != null;
3513 if (writeToLog)
3514 {
3515 debugSpan = lexer.GetSpan();
3516 System.Lex.WriteBeginRuleToLog(lexer, u"Number");
3517 }
3518 #endif
3519 Match match(false);
3520 Match* parentMatch0 = &match;
3521 {
3522 long pos = lexer.GetPos();
3523 Match match(false);
3524 if (*lexer == NUMBER)
3525 {
3526 ++lexer;
3527 match.hit = true;
3528 }
3529 if (match.hit)
3530 {
3531 Token token = lexer.GetToken(pos);
3532 ustring str = token.match.ToString();
3533 {
3534 #if (DEBUG)
3535 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Number");
3536 #endif
3537 return Match(true, new System.XPath.XPathNumberExpr(str));
3538 }
3539 }
3540 *parentMatch0 = match;
3541 }
3542 #if (DEBUG)
3543 if (writeToLog)
3544 {
3545 if (match.hit)
3546 {
3547 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Number");
3548 }
3549 else
3550 {
3551 System.Lex.WriteFailureToLog(lexer, u"Number");
3552 }
3553 }
3554 #endif
3555 if (!match.hit)
3556 {
3557 match.value = null;
3558 }
3559 return match;
3560 }
3561 public static Match Predicate(XPathLexer& lexer)
3562 {
3563 #if (DEBUG)
3564 Span debugSpan;
3565 bool writeToLog = lexer.Log() != null;
3566 if (writeToLog)
3567 {
3568 debugSpan = lexer.GetSpan();
3569 System.Lex.WriteBeginRuleToLog(lexer, u"Predicate");
3570 }
3571 #endif
3572 UniquePtr<System.XPath.XPathExpr> expr;
3573 Match match(false);
3574 Match* parentMatch0 = &match;
3575 {
3576 long pos = lexer.GetPos();
3577 Match match(false);
3578 Match* parentMatch1 = &match;
3579 {
3580 Match match(false);
3581 Match* parentMatch2 = &match;
3582 {
3583 Match match(false);
3584 Match* parentMatch3 = &match;
3585 {
3586 Match match(false);
3587 if (*lexer == LBRACKET)
3588 {
3589 ++lexer;
3590 match.hit = true;
3591 }
3592 *parentMatch3 = match;
3593 }
3594 if (match.hit)
3595 {
3596 Match match(false);
3597 Match* parentMatch4 = &match;
3598 {
3599 Match match = XPathParser.PredicateExpr(lexer);
3600 expr.Reset(cast<System.XPath.XPathExpr*>(match.value));
3601 *parentMatch4 = match;
3602 }
3603 *parentMatch3 = match;
3604 }
3605 *parentMatch2 = match;
3606 }
3607 if (match.hit)
3608 {
3609 Match match(false);
3610 Match* parentMatch5 = &match;
3611 {
3612 Match match(false);
3613 if (*lexer == RBRACKET)
3614 {
3615 ++lexer;
3616 match.hit = true;
3617 }
3618 *parentMatch5 = match;
3619 }
3620 *parentMatch2 = match;
3621 }
3622 *parentMatch1 = match;
3623 }
3624 if (match.hit)
3625 {
3626 {
3627 #if (DEBUG)
3628 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Predicate");
3629 #endif
3630 return Match(true, expr.Release());
3631 }
3632 }
3633 *parentMatch0 = match;
3634 }
3635 #if (DEBUG)
3636 if (writeToLog)
3637 {
3638 if (match.hit)
3639 {
3640 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Predicate");
3641 }
3642 else
3643 {
3644 System.Lex.WriteFailureToLog(lexer, u"Predicate");
3645 }
3646 }
3647 #endif
3648 if (!match.hit)
3649 {
3650 match.value = null;
3651 }
3652 return match;
3653 }
3654 public static Match PredicateExpr(XPathLexer& lexer)
3655 {
3656 #if (DEBUG)
3657 Span debugSpan;
3658 bool writeToLog = lexer.Log() != null;
3659 if (writeToLog)
3660 {
3661 debugSpan = lexer.GetSpan();
3662 System.Lex.WriteBeginRuleToLog(lexer, u"PredicateExpr");
3663 }
3664 #endif
3665 UniquePtr<System.XPath.XPathExpr> expr;
3666 Match match(false);
3667 Match* parentMatch0 = &match;
3668 {
3669 long pos = lexer.GetPos();
3670 Match match = XPathParser.Expr(lexer);
3671 expr.Reset(cast<System.XPath.XPathExpr*>(match.value));
3672 if (match.hit)
3673 {
3674 {
3675 #if (DEBUG)
3676 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PredicateExpr");
3677 #endif
3678 return Match(true, expr.Release());
3679 }
3680 }
3681 *parentMatch0 = match;
3682 }
3683 #if (DEBUG)
3684 if (writeToLog)
3685 {
3686 if (match.hit)
3687 {
3688 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PredicateExpr");
3689 }
3690 else
3691 {
3692 System.Lex.WriteFailureToLog(lexer, u"PredicateExpr");
3693 }
3694 }
3695 #endif
3696 if (!match.hit)
3697 {
3698 match.value = null;
3699 }
3700 return match;
3701 }
3702 public static Match PrimaryExpr(XPathLexer& lexer)
3703 {
3704 #if (DEBUG)
3705 Span debugSpan;
3706 bool writeToLog = lexer.Log() != null;
3707 if (writeToLog)
3708 {
3709 debugSpan = lexer.GetSpan();
3710 System.Lex.WriteBeginRuleToLog(lexer, u"PrimaryExpr");
3711 }
3712 #endif
3713 UniquePtr<System.XPath.XPathExpr> functionCall;
3714 UniquePtr<System.XPath.XPathExpr> variableReference;
3715 UniquePtr<System.XPath.XPathExpr> expr;
3716 UniquePtr<System.XPath.XPathExpr> literal;
3717 UniquePtr<System.XPath.XPathExpr> number;
3718 Match match(false);
3719 Match* parentMatch0 = &match;
3720 {
3721 long save = lexer.GetPos();
3722 Match match(false);
3723 Match* parentMatch1 = &match;
3724 {
3725 long save = lexer.GetPos();
3726 Match match(false);
3727 Match* parentMatch2 = &match;
3728 {
3729 long save = lexer.GetPos();
3730 Match match(false);
3731 Match* parentMatch3 = &match;
3732 {
3733 long save = lexer.GetPos();
3734 Match match(false);
3735 Match* parentMatch4 = &match;
3736 {
3737 long pos = lexer.GetPos();
3738 Match match = XPathParser.FunctionCall(lexer);
3739 functionCall.Reset(cast<System.XPath.XPathExpr*>(match.value));
3740 if (match.hit)
3741 {
3742 {
3743 #if (DEBUG)
3744 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimaryExpr");
3745 #endif
3746 return Match(true, functionCall.Release());
3747 }
3748 }
3749 *parentMatch4 = match;
3750 }
3751 *parentMatch3 = match;
3752 if (!match.hit)
3753 {
3754 Match match(false);
3755 Match* parentMatch5 = &match;
3756 lexer.SetPos(save);
3757 {
3758 Match match(false);
3759 Match* parentMatch6 = &match;
3760 {
3761 long pos = lexer.GetPos();
3762 Match match = XPathParser.VariableReference(lexer);
3763 variableReference.Reset(cast<System.XPath.XPathExpr*>(match.value));
3764 if (match.hit)
3765 {
3766 {
3767 #if (DEBUG)
3768 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimaryExpr");
3769 #endif
3770 return Match(true, variableReference.Release());
3771 }
3772 }
3773 *parentMatch6 = match;
3774 }
3775 *parentMatch5 = match;
3776 }
3777 *parentMatch3 = match;
3778 }
3779 }
3780 *parentMatch2 = match;
3781 if (!match.hit)
3782 {
3783 Match match(false);
3784 Match* parentMatch7 = &match;
3785 lexer.SetPos(save);
3786 {
3787 Match match(false);
3788 Match* parentMatch8 = &match;
3789 {
3790 long pos = lexer.GetPos();
3791 Match match(false);
3792 Match* parentMatch9 = &match;
3793 {
3794 Match match(false);
3795 Match* parentMatch10 = &match;
3796 {
3797 Match match(false);
3798 Match* parentMatch11 = &match;
3799 {
3800 Match match(false);
3801 if (*lexer == LPAREN)
3802 {
3803 ++lexer;
3804 match.hit = true;
3805 }
3806 *parentMatch11 = match;
3807 }
3808 if (match.hit)
3809 {
3810 Match match(false);
3811 Match* parentMatch12 = &match;
3812 {
3813 Match match = XPathParser.Expr(lexer);
3814 expr.Reset(cast<System.XPath.XPathExpr*>(match.value));
3815 *parentMatch12 = match;
3816 }
3817 *parentMatch11 = match;
3818 }
3819 *parentMatch10 = match;
3820 }
3821 if (match.hit)
3822 {
3823 Match match(false);
3824 Match* parentMatch13 = &match;
3825 {
3826 Match match(false);
3827 if (*lexer == RPAREN)
3828 {
3829 ++lexer;
3830 match.hit = true;
3831 }
3832 *parentMatch13 = match;
3833 }
3834 *parentMatch10 = match;
3835 }
3836 *parentMatch9 = match;
3837 }
3838 if (match.hit)
3839 {
3840 {
3841 #if (DEBUG)
3842 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimaryExpr");
3843 #endif
3844 return Match(true, expr.Release());
3845 }
3846 }
3847 *parentMatch8 = match;
3848 }
3849 *parentMatch7 = match;
3850 }
3851 *parentMatch2 = match;
3852 }
3853 }
3854 *parentMatch1 = match;
3855 if (!match.hit)
3856 {
3857 Match match(false);
3858 Match* parentMatch14 = &match;
3859 lexer.SetPos(save);
3860 {
3861 Match match(false);
3862 Match* parentMatch15 = &match;
3863 {
3864 long pos = lexer.GetPos();
3865 Match match = XPathParser.Literal(lexer);
3866 literal.Reset(cast<System.XPath.XPathExpr*>(match.value));
3867 if (match.hit)
3868 {
3869 {
3870 #if (DEBUG)
3871 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimaryExpr");
3872 #endif
3873 return Match(true, literal.Release());
3874 }
3875 }
3876 *parentMatch15 = match;
3877 }
3878 *parentMatch14 = match;
3879 }
3880 *parentMatch1 = match;
3881 }
3882 }
3883 *parentMatch0 = match;
3884 if (!match.hit)
3885 {
3886 Match match(false);
3887 Match* parentMatch16 = &match;
3888 lexer.SetPos(save);
3889 {
3890 Match match(false);
3891 Match* parentMatch17 = &match;
3892 {
3893 long pos = lexer.GetPos();
3894 Match match = XPathParser.Number(lexer);
3895 number.Reset(cast<System.XPath.XPathExpr*>(match.value));
3896 if (match.hit)
3897 {
3898 {
3899 #if (DEBUG)
3900 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimaryExpr");
3901 #endif
3902 return Match(true, number.Release());
3903 }
3904 }
3905 *parentMatch17 = match;
3906 }
3907 *parentMatch16 = match;
3908 }
3909 *parentMatch0 = match;
3910 }
3911 }
3912 #if (DEBUG)
3913 if (writeToLog)
3914 {
3915 if (match.hit)
3916 {
3917 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimaryExpr");
3918 }
3919 else
3920 {
3921 System.Lex.WriteFailureToLog(lexer, u"PrimaryExpr");
3922 }
3923 }
3924 #endif
3925 if (!match.hit)
3926 {
3927 match.value = null;
3928 }
3929 return match;
3930 }
3931 public static Match VariableReference(XPathLexer& lexer)
3932 {
3933 #if (DEBUG)
3934 Span debugSpan;
3935 bool writeToLog = lexer.Log() != null;
3936 if (writeToLog)
3937 {
3938 debugSpan = lexer.GetSpan();
3939 System.Lex.WriteBeginRuleToLog(lexer, u"VariableReference");
3940 }
3941 #endif
3942 UniquePtr<Value<ustring>> qname;
3943 Match match(false);
3944 Match* parentMatch0 = &match;
3945 {
3946 long pos = lexer.GetPos();
3947 Match match(false);
3948 Match* parentMatch1 = &match;
3949 {
3950 Match match(false);
3951 Match* parentMatch2 = &match;
3952 {
3953 Match match(false);
3954 if (*lexer == DOLLAR)
3955 {
3956 ++lexer;
3957 match.hit = true;
3958 }
3959 *parentMatch2 = match;
3960 }
3961 if (match.hit)
3962 {
3963 Match match(false);
3964 Match* parentMatch3 = &match;
3965 {
3966 Match match = XPathParser.QName(lexer);
3967 qname.Reset(cast<Value<ustring>*>(match.value));
3968 *parentMatch3 = match;
3969 }
3970 *parentMatch2 = match;
3971 }
3972 *parentMatch1 = match;
3973 }
3974 if (match.hit)
3975 {
3976 {
3977 #if (DEBUG)
3978 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"VariableReference");
3979 #endif
3980 return Match(true, new System.XPath.XPathVariableReference(qname->value));
3981 }
3982 }
3983 *parentMatch0 = match;
3984 }
3985 #if (DEBUG)
3986 if (writeToLog)
3987 {
3988 if (match.hit)
3989 {
3990 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"VariableReference");
3991 }
3992 else
3993 {
3994 System.Lex.WriteFailureToLog(lexer, u"VariableReference");
3995 }
3996 }
3997 #endif
3998 if (!match.hit)
3999 {
4000 match.value = null;
4001 }
4002 return match;
4003 }
4004 public static Match FunctionCall(XPathLexer& lexer)
4005 {
4006 #if (DEBUG)
4007 Span debugSpan;
4008 bool writeToLog = lexer.Log() != null;
4009 if (writeToLog)
4010 {
4011 debugSpan = lexer.GetSpan();
4012 System.Lex.WriteBeginRuleToLog(lexer, u"FunctionCall");
4013 }
4014 #endif
4015 UniquePtr<System.XPath.XPathFunctionCall> functionCall;
4016 UniquePtr<Value<ustring>> functionName;
4017 UniquePtr<System.XPath.XPathExpr> arg;
4018 Match match(false);
4019 Match* parentMatch0 = &match;
4020 {
4021 long pos = lexer.GetPos();
4022 Match match(false);
4023 Match* parentMatch1 = &match;
4024 {
4025 Match match(false);
4026 Match* parentMatch2 = &match;
4027 {
4028 Match match(false);
4029 Match* parentMatch3 = &match;
4030 {
4031 Match match(false);
4032 Match* parentMatch4 = &match;
4033 {
4034 Match match = XPathParser.FunctionName(lexer);
4035 functionName.Reset(cast<Value<ustring>*>(match.value));
4036 *parentMatch4 = match;
4037 }
4038 if (match.hit)
4039 {
4040 Match match(false);
4041 Match* parentMatch5 = &match;
4042 {
4043 Match match(false);
4044 Match* parentMatch6 = &match;
4045 {
4046 long pos = lexer.GetPos();
4047 Match match(false);
4048 if (*lexer == LPAREN)
4049 {
4050 ++lexer;
4051 match.hit = true;
4052 }
4053 if (match.hit)
4054 {
4055 functionCall.Reset(new System.XPath.XPathFunctionCall(functionName->value));
4056 }
4057 *parentMatch6 = match;
4058 }
4059 *parentMatch5 = match;
4060 }
4061 *parentMatch4 = match;
4062 }
4063 *parentMatch3 = match;
4064 }
4065 if (match.hit)
4066 {
4067 Match match(false);
4068 Match* parentMatch7 = &match;
4069 {
4070 Match match(true);
4071 long save = lexer.GetPos();
4072 Match* parentMatch8 = &match;
4073 {
4074 Match match(false);
4075 Match* parentMatch9 = &match;
4076 {
4077 Match match(false);
4078 Match* parentMatch10 = &match;
4079 {
4080 Match match(false);
4081 Match* parentMatch11 = &match;
4082 {
4083 long pos = lexer.GetPos();
4084 Match match = XPathParser.Argument(lexer);
4085 arg.Reset(cast<System.XPath.XPathExpr*>(match.value));
4086 if (match.hit)
4087 {
4088 functionCall->AddArgument(arg.Release());
4089 }
4090 *parentMatch11 = match;
4091 }
4092 *parentMatch10 = match;
4093 }
4094 if (match.hit)
4095 {
4096 Match match(false);
4097 Match* parentMatch12 = &match;
4098 {
4099 Match match(true);
4100 Match* parentMatch13 = &match;
4101 {
4102 while (true)
4103 {
4104 long save = lexer.GetPos();
4105 {
4106 Match match(false);
4107 Match* parentMatch14 = &match;
4108 {
4109 Match match(false);
4110 if (*lexer == COMMA)
4111 {
4112 ++lexer;
4113 match.hit = true;
4114 }
4115 *parentMatch14 = match;
4116 }
4117 if (match.hit)
4118 {
4119 Match match(false);
4120 Match* parentMatch15 = &match;
4121 {
4122 Match match(false);
4123 Match* parentMatch16 = &match;
4124 {
4125 long pos = lexer.GetPos();
4126 Match match = XPathParser.Argument(lexer);
4127 arg.Reset(cast<System.XPath.XPathExpr*>(match.value));
4128 if (match.hit)
4129 {
4130 functionCall->AddArgument(arg.Release());
4131 }
4132 *parentMatch16 = match;
4133 }
4134 *parentMatch15 = match;
4135 }
4136 *parentMatch14 = match;
4137 }
4138 if (match.hit)
4139 {
4140 *parentMatch13 = match;
4141 }
4142 else
4143 {
4144 lexer.SetPos(save);
4145 break;
4146 }
4147 }
4148 }
4149 }
4150 *parentMatch12 = match;
4151 }
4152 *parentMatch10 = match;
4153 }
4154 *parentMatch9 = match;
4155 }
4156 if (match.hit)
4157 {
4158 *parentMatch8 = match;
4159 }
4160 else
4161 {
4162 lexer.SetPos(save);
4163 }
4164 }
4165 *parentMatch7 = match;
4166 }
4167 *parentMatch3 = match;
4168 }
4169 *parentMatch2 = match;
4170 }
4171 if (match.hit)
4172 {
4173 Match match(false);
4174 Match* parentMatch17 = &match;
4175 {
4176 Match match(false);
4177 if (*lexer == RPAREN)
4178 {
4179 ++lexer;
4180 match.hit = true;
4181 }
4182 *parentMatch17 = match;
4183 }
4184 *parentMatch2 = match;
4185 }
4186 *parentMatch1 = match;
4187 }
4188 if (match.hit)
4189 {
4190 {
4191 #if (DEBUG)
4192 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"FunctionCall");
4193 #endif
4194 return Match(true, functionCall.Release());
4195 }
4196 }
4197 *parentMatch0 = match;
4198 }
4199 #if (DEBUG)
4200 if (writeToLog)
4201 {
4202 if (match.hit)
4203 {
4204 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"FunctionCall");
4205 }
4206 else
4207 {
4208 System.Lex.WriteFailureToLog(lexer, u"FunctionCall");
4209 }
4210 }
4211 #endif
4212 if (!match.hit)
4213 {
4214 match.value = null;
4215 }
4216 return match;
4217 }
4218 public static Match FunctionName(XPathLexer& lexer)
4219 {
4220 #if (DEBUG)
4221 Span debugSpan;
4222 bool writeToLog = lexer.Log() != null;
4223 if (writeToLog)
4224 {
4225 debugSpan = lexer.GetSpan();
4226 System.Lex.WriteBeginRuleToLog(lexer, u"FunctionName");
4227 }
4228 #endif
4229 UniquePtr<Value<ustring>> qname;
4230 UniquePtr<System.XPath.XPathNodeTestExpr> nodeType;
4231 Match match(false);
4232 Match* parentMatch0 = &match;
4233 {
4234 long pos = lexer.GetPos();
4235 Match match(false);
4236 Match* parentMatch1 = &match;
4237 {
4238 Match match(false);
4239 Match* parentMatch2 = &match;
4240 long save = lexer.GetPos();
4241 {
4242 Match match = XPathParser.QName(lexer);
4243 qname.Reset(cast<Value<ustring>*>(match.value));
4244 *parentMatch2 = match;
4245 }
4246 if (match.hit)
4247 {
4248 Match match(false);
4249 Match* parentMatch3 = &match;
4250 {
4251 long tmp = lexer.GetPos();
4252 lexer.SetPos(save);
4253 save = tmp;
4254 Match match = XPathParser.NodeType(lexer);
4255 nodeType.Reset(cast<System.XPath.XPathNodeTestExpr*>(match.value));
4256 *parentMatch3 = match;
4257 }
4258 if (!match.hit)
4259 {
4260 lexer.SetPos(save);
4261 }
4262 *parentMatch2 = Match(!match.hit, match.value);
4263 }
4264 *parentMatch1 = match;
4265 }
4266 if (match.hit)
4267 {
4268 {
4269 #if (DEBUG)
4270 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"FunctionName");
4271 #endif
4272 return Match(true, new Value<ustring>(qname->value));
4273 }
4274 }
4275 *parentMatch0 = match;
4276 }
4277 #if (DEBUG)
4278 if (writeToLog)
4279 {
4280 if (match.hit)
4281 {
4282 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"FunctionName");
4283 }
4284 else
4285 {
4286 System.Lex.WriteFailureToLog(lexer, u"FunctionName");
4287 }
4288 }
4289 #endif
4290 if (!match.hit)
4291 {
4292 match.value = null;
4293 }
4294 return match;
4295 }
4296 public static Match Argument(XPathLexer& lexer)
4297 {
4298 #if (DEBUG)
4299 Span debugSpan;
4300 bool writeToLog = lexer.Log() != null;
4301 if (writeToLog)
4302 {
4303 debugSpan = lexer.GetSpan();
4304 System.Lex.WriteBeginRuleToLog(lexer, u"Argument");
4305 }
4306 #endif
4307 UniquePtr<System.XPath.XPathExpr> expr;
4308 Match match(false);
4309 Match* parentMatch0 = &match;
4310 {
4311 long pos = lexer.GetPos();
4312 Match match = XPathParser.Expr(lexer);
4313 expr.Reset(cast<System.XPath.XPathExpr*>(match.value));
4314 if (match.hit)
4315 {
4316 {
4317 #if (DEBUG)
4318 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Argument");
4319 #endif
4320 return Match(true, expr.Release());
4321 }
4322 }
4323 *parentMatch0 = match;
4324 }
4325 #if (DEBUG)
4326 if (writeToLog)
4327 {
4328 if (match.hit)
4329 {
4330 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Argument");
4331 }
4332 else
4333 {
4334 System.Lex.WriteFailureToLog(lexer, u"Argument");
4335 }
4336 }
4337 #endif
4338 if (!match.hit)
4339 {
4340 match.value = null;
4341 }
4342 return match;
4343 }
4344 public static Match QName(XPathLexer& lexer)
4345 {
4346 #if (DEBUG)
4347 Span debugSpan;
4348 bool writeToLog = lexer.Log() != null;
4349 if (writeToLog)
4350 {
4351 debugSpan = lexer.GetSpan();
4352 System.Lex.WriteBeginRuleToLog(lexer, u"QName");
4353 }
4354 #endif
4355 UniquePtr<Value<ustring>> prefixedName;
4356 UniquePtr<Value<ustring>> unprefixedName;
4357 Match match(false);
4358 Match* parentMatch0 = &match;
4359 {
4360 long save = lexer.GetPos();
4361 Match match(false);
4362 Match* parentMatch1 = &match;
4363 {
4364 long pos = lexer.GetPos();
4365 Match match = XPathParser.PrefixedName(lexer);
4366 prefixedName.Reset(cast<Value<ustring>*>(match.value));
4367 if (match.hit)
4368 {
4369 {
4370 #if (DEBUG)
4371 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"QName");
4372 #endif
4373 return Match(true, new Value<ustring>(prefixedName->value));
4374 }
4375 }
4376 *parentMatch1 = match;
4377 }
4378 *parentMatch0 = match;
4379 if (!match.hit)
4380 {
4381 Match match(false);
4382 Match* parentMatch2 = &match;
4383 lexer.SetPos(save);
4384 {
4385 Match match(false);
4386 Match* parentMatch3 = &match;
4387 {
4388 long pos = lexer.GetPos();
4389 Match match = XPathParser.UnprefixedName(lexer);
4390 unprefixedName.Reset(cast<Value<ustring>*>(match.value));
4391 if (match.hit)
4392 {
4393 {
4394 #if (DEBUG)
4395 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"QName");
4396 #endif
4397 return Match(true, new Value<ustring>(unprefixedName->value));
4398 }
4399 }
4400 *parentMatch3 = match;
4401 }
4402 *parentMatch2 = match;
4403 }
4404 *parentMatch0 = match;
4405 }
4406 }
4407 #if (DEBUG)
4408 if (writeToLog)
4409 {
4410 if (match.hit)
4411 {
4412 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"QName");
4413 }
4414 else
4415 {
4416 System.Lex.WriteFailureToLog(lexer, u"QName");
4417 }
4418 }
4419 #endif
4420 if (!match.hit)
4421 {
4422 match.value = null;
4423 }
4424 return match;
4425 }
4426 public static Match PrefixedName(XPathLexer& lexer)
4427 {
4428 #if (DEBUG)
4429 Span debugSpan;
4430 bool writeToLog = lexer.Log() != null;
4431 if (writeToLog)
4432 {
4433 debugSpan = lexer.GetSpan();
4434 System.Lex.WriteBeginRuleToLog(lexer, u"PrefixedName");
4435 }
4436 #endif
4437 UniquePtr<Value<ustring>> prefix;
4438 UniquePtr<Value<ustring>> localPart;
4439 Match match(false);
4440 Match* parentMatch0 = &match;
4441 {
4442 long pos = lexer.GetPos();
4443 Match match(false);
4444 Match* parentMatch1 = &match;
4445 {
4446 Match match(false);
4447 Match* parentMatch2 = &match;
4448 {
4449 Match match(false);
4450 Match* parentMatch3 = &match;
4451 {
4452 Match match = XPathParser.Prefix(lexer);
4453 prefix.Reset(cast<Value<ustring>*>(match.value));
4454 *parentMatch3 = match;
4455 }
4456 if (match.hit)
4457 {
4458 Match match(false);
4459 Match* parentMatch4 = &match;
4460 {
4461 Match match(false);
4462 if (*lexer == COLON)
4463 {
4464 ++lexer;
4465 match.hit = true;
4466 }
4467 *parentMatch4 = match;
4468 }
4469 *parentMatch3 = match;
4470 }
4471 *parentMatch2 = match;
4472 }
4473 if (match.hit)
4474 {
4475 Match match(false);
4476 Match* parentMatch5 = &match;
4477 {
4478 Match match = XPathParser.LocalPart(lexer);
4479 localPart.Reset(cast<Value<ustring>*>(match.value));
4480 *parentMatch5 = match;
4481 }
4482 *parentMatch2 = match;
4483 }
4484 *parentMatch1 = match;
4485 }
4486 if (match.hit)
4487 {
4488 {
4489 #if (DEBUG)
4490 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrefixedName");
4491 #endif
4492 return Match(true, new Value<ustring>(prefix->value + u":" + localPart->value));
4493 }
4494 }
4495 *parentMatch0 = match;
4496 }
4497 #if (DEBUG)
4498 if (writeToLog)
4499 {
4500 if (match.hit)
4501 {
4502 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrefixedName");
4503 }
4504 else
4505 {
4506 System.Lex.WriteFailureToLog(lexer, u"PrefixedName");
4507 }
4508 }
4509 #endif
4510 if (!match.hit)
4511 {
4512 match.value = null;
4513 }
4514 return match;
4515 }
4516 public static Match Prefix(XPathLexer& lexer)
4517 {
4518 #if (DEBUG)
4519 Span debugSpan;
4520 bool writeToLog = lexer.Log() != null;
4521 if (writeToLog)
4522 {
4523 debugSpan = lexer.GetSpan();
4524 System.Lex.WriteBeginRuleToLog(lexer, u"Prefix");
4525 }
4526 #endif
4527 UniquePtr<Value<ustring>> ncname;
4528 Match match(false);
4529 Match* parentMatch0 = &match;
4530 {
4531 long pos = lexer.GetPos();
4532 Match match = XPathParser.NCName(lexer);
4533 ncname.Reset(cast<Value<ustring>*>(match.value));
4534 if (match.hit)
4535 {
4536 {
4537 #if (DEBUG)
4538 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Prefix");
4539 #endif
4540 return Match(true, new Value<ustring>(ncname->value));
4541 }
4542 }
4543 *parentMatch0 = match;
4544 }
4545 #if (DEBUG)
4546 if (writeToLog)
4547 {
4548 if (match.hit)
4549 {
4550 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Prefix");
4551 }
4552 else
4553 {
4554 System.Lex.WriteFailureToLog(lexer, u"Prefix");
4555 }
4556 }
4557 #endif
4558 if (!match.hit)
4559 {
4560 match.value = null;
4561 }
4562 return match;
4563 }
4564 public static Match UnprefixedName(XPathLexer& lexer)
4565 {
4566 #if (DEBUG)
4567 Span debugSpan;
4568 bool writeToLog = lexer.Log() != null;
4569 if (writeToLog)
4570 {
4571 debugSpan = lexer.GetSpan();
4572 System.Lex.WriteBeginRuleToLog(lexer, u"UnprefixedName");
4573 }
4574 #endif
4575 UniquePtr<Value<ustring>> localPart;
4576 Match match(false);
4577 Match* parentMatch0 = &match;
4578 {
4579 long pos = lexer.GetPos();
4580 Match match = XPathParser.LocalPart(lexer);
4581 localPart.Reset(cast<Value<ustring>*>(match.value));
4582 if (match.hit)
4583 {
4584 {
4585 #if (DEBUG)
4586 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnprefixedName");
4587 #endif
4588 return Match(true, new Value<ustring>(localPart->value));
4589 }
4590 }
4591 *parentMatch0 = match;
4592 }
4593 #if (DEBUG)
4594 if (writeToLog)
4595 {
4596 if (match.hit)
4597 {
4598 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnprefixedName");
4599 }
4600 else
4601 {
4602 System.Lex.WriteFailureToLog(lexer, u"UnprefixedName");
4603 }
4604 }
4605 #endif
4606 if (!match.hit)
4607 {
4608 match.value = null;
4609 }
4610 return match;
4611 }
4612 public static Match LocalPart(XPathLexer& lexer)
4613 {
4614 #if (DEBUG)
4615 Span debugSpan;
4616 bool writeToLog = lexer.Log() != null;
4617 if (writeToLog)
4618 {
4619 debugSpan = lexer.GetSpan();
4620 System.Lex.WriteBeginRuleToLog(lexer, u"LocalPart");
4621 }
4622 #endif
4623 UniquePtr<Value<ustring>> ncname;
4624 Match match(false);
4625 Match* parentMatch0 = &match;
4626 {
4627 long pos = lexer.GetPos();
4628 Match match = XPathParser.NCName(lexer);
4629 ncname.Reset(cast<Value<ustring>*>(match.value));
4630 if (match.hit)
4631 {
4632 {
4633 #if (DEBUG)
4634 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LocalPart");
4635 #endif
4636 return Match(true, new Value<ustring>(ncname->value));
4637 }
4638 }
4639 *parentMatch0 = match;
4640 }
4641 #if (DEBUG)
4642 if (writeToLog)
4643 {
4644 if (match.hit)
4645 {
4646 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LocalPart");
4647 }
4648 else
4649 {
4650 System.Lex.WriteFailureToLog(lexer, u"LocalPart");
4651 }
4652 }
4653 #endif
4654 if (!match.hit)
4655 {
4656 match.value = null;
4657 }
4658 return match;
4659 }
4660 public static Match NCName(XPathLexer& lexer)
4661 {
4662 #if (DEBUG)
4663 Span debugSpan;
4664 bool writeToLog = lexer.Log() != null;
4665 if (writeToLog)
4666 {
4667 debugSpan = lexer.GetSpan();
4668 System.Lex.WriteBeginRuleToLog(lexer, u"NCName");
4669 }
4670 #endif
4671 Match match(false);
4672 Match* parentMatch0 = &match;
4673 {
4674 long pos = lexer.GetPos();
4675 Match match(false);
4676 if (*lexer == NAME)
4677 {
4678 ++lexer;
4679 match.hit = true;
4680 }
4681 if (match.hit)
4682 {
4683 Token token = lexer.GetToken(pos);
4684 {
4685 #if (DEBUG)
4686 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NCName");
4687 #endif
4688 return Match(true, new Value<ustring>(token.match.ToString()));
4689 }
4690 }
4691 *parentMatch0 = match;
4692 }
4693 #if (DEBUG)
4694 if (writeToLog)
4695 {
4696 if (match.hit)
4697 {
4698 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NCName");
4699 }
4700 else
4701 {
4702 System.Lex.WriteFailureToLog(lexer, u"NCName");
4703 }
4704 }
4705 #endif
4706 if (!match.hit)
4707 {
4708 match.value = null;
4709 }
4710 return match;
4711 }
4712 }