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