1 #include "CommandLine.hpp"
2 #include <soulng/util/Unicode.hpp>
3 #include <soulng/lexer/TrivialLexer.hpp>
4 #include <soulng/parser/Range.hpp>
5
6
7
8 static const soulng::parser::Range s0[] = {{9, 9} {32, 32}};
9
10 static const soulng::parser::Range s1[] = {{9, 9} {10, 10} {13, 13} {32, 32}};
11
12 static const soulng::parser::Range s2[] = {{92, 92}};
13
14 static const soulng::parser::Range s3[] = {{92, 92}};
15
16 static const soulng::parser::Range s4[] = {{92, 92}};
17
18 static const soulng::parser::Range s5[] = {{10, 10} {13, 13}};
19
20 using namespace soulng::unicode;
21 using namespace soulng::lexer;
22
23 std::std::vector<std::string>CommandLineParser::Parse(TrivialLexer&lexer)
24 {
25 std::unique_ptr<soulng::parser::soulng::parser::Value<std::std::vector<std::string>>>value;
26 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
27
28
29
30
31
32 #endif // SOULNG_PARSER_DEBUG_SUPPORT
33 ++lexer;
34 soulng::lexer::Span span = lexer.GetSpan();
35 soulng::parser::Match match = CommandLineParser::CommandLine(lexer);
36 value.reset(static_cast<soulng::parser::soulng::parser::Value<std::std::vector<std::string>>*>(match.value));
37 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
38
39
40
41
42
43 #endif // SOULNG_PARSER_DEBUG_SUPPORT
44 if (match.hit)
45 {
46 if (*lexer == soulng::lexer::END_TOKEN)
47 {
48 return value->value;
49 }
50 else
51 {
52 lexer.ThrowExpectationFailure(lexer.GetSpan(), ToUtf32(soulng::lexer::GetEndTokenInfo()));
53 }
54 }
55 else
56 {
57 lexer.ThrowExpectationFailure(span, U"CommandLine");
58 }
59 return value->value;
60 }
61
62 soulng::parser::Match CommandLineParser::CommandLine(TrivialLexer& lexer)
63 {
64 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
65
66
67
68
69
70
71
72 #endif // SOULNG_PARSER_DEBUG_SUPPORT
73 std::vector<std::string> value = std::vector<std::string>();
74 std::unique_ptr<soulng::parser::soulng::parser::Value<std::string>>first;
75 std::unique_ptr<soulng::parser::soulng::parser::Value<std::string>>next;
76 soulng::parser::Match match(false);
77 soulng::parser::Match* parentMatch0 = &match;
78 {
79 int64_t pos = lexer.GetPos();
80 soulng::parser::Match match(false);
81 soulng::parser::Match* parentMatch1 = &match;
82 {
83 soulng::parser::Match match(false);
84 soulng::parser::Match* parentMatch2 = &match;
85 {
86 soulng::parser::Match match(false);
87 soulng::parser::Match* parentMatch3 = &match;
88 {
89 soulng::parser::Match match(false);
90 soulng::parser::Match* parentMatch4 = &match;
91 {
92 soulng::parser::Match match(false);
93 soulng::parser::Match* parentMatch5 = &match;
94 {
95 soulng::parser::Match match(true);
96 int64_t save = lexer.GetPos();
97 soulng::parser::Match* parentMatch6 = &match;
98 {
99 soulng::parser::Match match = CommandLineParser::Spaces(lexer);
100 if (match.hit)
101 {
102 *parentMatch6 = match;
103 }
104 else
105 {
106 lexer.SetPos(save);
107 }
108 }
109 *parentMatch5 = match;
110 }
111 if (match.hit)
112 {
113 soulng::parser::Match match(false);
114 soulng::parser::Match* parentMatch7 = &match;
115 {
116 soulng::parser::Match match(false);
117 soulng::parser::Match* parentMatch8 = &match;
118 {
119 int64_t pos = lexer.GetPos();
120 soulng::parser::Match match = CommandLineParser::Argument(lexer);
121 first.reset(static_cast<soulng::parser::soulng::parser::Value<std::string>*>(match.value));
122 if (match.hit)
123 {
124 value.push_back(first->value);
125 }
126 *parentMatch8 = match;
127 }
128 *parentMatch7 = match;
129 }
130 *parentMatch5 = match;
131 }
132 *parentMatch4 = match;
133 }
134 if (match.hit)
135 {
136 soulng::parser::Match match(false);
137 soulng::parser::Match* parentMatch9 = &match;
138 {
139 soulng::parser::Match match(true);
140 soulng::parser::Match* parentMatch10 = &match;
141 {
142 while (true)
143 {
144 int64_t save = lexer.GetPos();
145 {
146 soulng::parser::Match match(false);
147 soulng::parser::Match* parentMatch11 = &match;
148 {
149 soulng::parser::Match match(false);
150 soulng::parser::Match* parentMatch12 = &match;
151 {
152 soulng::parser::Match match = CommandLineParser::Spaces(lexer);
153 *parentMatch12 = match;
154 }
155 if (match.hit)
156 {
157 soulng::parser::Match match(false);
158 soulng::parser::Match* parentMatch13 = &match;
159 {
160 soulng::parser::Match match(false);
161 soulng::parser::Match* parentMatch14 = &match;
162 {
163 int64_t pos = lexer.GetPos();
164 soulng::parser::Match match = CommandLineParser::Argument(lexer);
165 next.reset(static_cast<soulng::parser::soulng::parser::Value<std::string>*>(match.value));
166 if (match.hit)
167 {
168 value.push_back(next->value);
169 }
170 *parentMatch14 = match;
171 }
172 *parentMatch13 = match;
173 }
174 *parentMatch12 = match;
175 }
176 *parentMatch11 = match;
177 }
178 if (match.hit)
179 {
180 *parentMatch10 = match;
181 }
182 else
183 {
184 lexer.SetPos(save);
185 break;
186 }
187 }
188 }
189 }
190 *parentMatch9 = match;
191 }
192 *parentMatch4 = match;
193 }
194 *parentMatch3 = match;
195 }
196 if (match.hit)
197 {
198 soulng::parser::Match match(false);
199 soulng::parser::Match* parentMatch15 = &match;
200 {
201 soulng::parser::Match match(true);
202 int64_t save = lexer.GetPos();
203 soulng::parser::Match* parentMatch16 = &match;
204 {
205 soulng::parser::Match match = CommandLineParser::Spaces(lexer);
206 if (match.hit)
207 {
208 *parentMatch16 = match;
209 }
210 else
211 {
212 lexer.SetPos(save);
213 }
214 }
215 *parentMatch15 = match;
216 }
217 *parentMatch3 = match;
218 }
219 *parentMatch2 = match;
220 }
221 if (match.hit)
222 {
223 soulng::parser::Match match(false);
224 soulng::parser::Match* parentMatch17 = &match;
225 {
226 soulng::parser::Match match(false);
227 if (*lexer == 10)
228 {
229 ++lexer;
230 match.hit = true;
231 }
232 *parentMatch17 = match;
233 }
234 *parentMatch2 = match;
235 }
236 *parentMatch1 = match;
237 }
238 if (match.hit)
239 {
240 {
241 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
242
243 #endif // SOULNG_PARSER_DEBUG_SUPPORT
244 return soulng::parser::Match(true, new soulng::parser::Value<std::std::vector<std::string>>(value));
245 }
246 }
247 *parentMatch0 = match;
248 }
249 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
250
251
252
253
254
255 #endif // SOULNG_PARSER_DEBUG_SUPPORT
256 if (!match.hit)
257 {
258 match.value = nullptr;
259 }
260 return match;
261 }
262
263 soulng::parser::Match CommandLineParser::Spaces(TrivialLexer& lexer)
264 {
265 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
266
267
268
269
270
271
272
273 #endif // SOULNG_PARSER_DEBUG_SUPPORT
274 soulng::parser::Match match(false);
275 soulng::parser::Match* parentMatch0 = &match;
276 {
277 soulng::parser::Match match(false);
278 for (const soulng::parser::Range& range : s0)
279 {
280 if (*lexer >= range.first && *lexer <= range.last)
281 {
282 match.hit = true;
283 ++lexer;
284 break;
285 }
286 }
287 *parentMatch0 = match;
288 }
289 if (match.hit)
290 {
291 soulng::parser::Match match(true);
292 soulng::parser::Match* parentMatch1 = &match;
293 while (true)
294 {
295 int64_t save = lexer.GetPos();
296 {
297 soulng::parser::Match match(false);
298 for (const soulng::parser::Range& range : s0)
299 {
300 if (*lexer >= range.first && *lexer <= range.last)
301 {
302 match.hit = true;
303 ++lexer;
304 break;
305 }
306 }
307 if (match.hit)
308 {
309 *parentMatch1 = match;
310 }
311 else
312 {
313 lexer.SetPos(save);
314 break;
315 }
316 }
317 }
318 }
319 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
320
321
322
323
324
325 #endif // SOULNG_PARSER_DEBUG_SUPPORT
326 if (!match.hit)
327 {
328 match.value = nullptr;
329 }
330 return match;
331 }
332
333 soulng::parser::Match CommandLineParser::Argument(TrivialLexer& lexer)
334 {
335 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
336
337
338
339
340
341
342
343 #endif // SOULNG_PARSER_DEBUG_SUPPORT
344 std::string value = std::string();
345 std::unique_ptr<soulng::parser::soulng::parser::Value<std::string>>element;
346 soulng::parser::Match match(false);
347 soulng::parser::Match* parentMatch0 = &match;
348 {
349 int64_t pos = lexer.GetPos();
350 soulng::parser::Match match(false);
351 soulng::parser::Match* parentMatch1 = &match;
352 {
353 soulng::parser::Match match(false);
354 soulng::parser::Match* parentMatch2 = &match;
355 {
356 soulng::parser::Match match(false);
357 soulng::parser::Match* parentMatch3 = &match;
358 {
359 soulng::parser::Match match(false);
360 soulng::parser::Match* parentMatch4 = &match;
361 {
362 int64_t pos = lexer.GetPos();
363 soulng::parser::Match match = CommandLineParser::ArgElement(lexer);
364 element.reset(static_cast<soulng::parser::soulng::parser::Value<std::string>*>(match.value));
365 if (match.hit)
366 {
367 value.append(element->value);
368 }
369 *parentMatch4 = match;
370 }
371 *parentMatch3 = match;
372 }
373 *parentMatch2 = match;
374 }
375 if (match.hit)
376 {
377 soulng::parser::Match match(true);
378 soulng::parser::Match* parentMatch5 = &match;
379 while (true)
380 {
381 int64_t save = lexer.GetPos();
382 {
383 soulng::parser::Match match(false);
384 soulng::parser::Match* parentMatch6 = &match;
385 {
386 soulng::parser::Match match(false);
387 soulng::parser::Match* parentMatch7 = &match;
388 {
389 int64_t pos = lexer.GetPos();
390 soulng::parser::Match match = CommandLineParser::ArgElement(lexer);
391 element.reset(static_cast<soulng::parser::soulng::parser::Value<std::string>*>(match.value));
392 if (match.hit)
393 {
394 value.append(element->value);
395 }
396 *parentMatch7 = match;
397 }
398 *parentMatch6 = match;
399 }
400 if (match.hit)
401 {
402 *parentMatch5 = match;
403 }
404 else
405 {
406 lexer.SetPos(save);
407 break;
408 }
409 }
410 }
411 }
412 *parentMatch1 = match;
413 }
414 if (match.hit)
415 {
416 {
417 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
418
419 #endif // SOULNG_PARSER_DEBUG_SUPPORT
420 return soulng::parser::Match(true, new soulng::parser::Value<std::string>(value));
421 }
422 }
423 *parentMatch0 = match;
424 }
425 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
426
427
428
429
430
431 #endif // SOULNG_PARSER_DEBUG_SUPPORT
432 if (!match.hit)
433 {
434 match.value = nullptr;
435 }
436 return match;
437 }
438
439 soulng::parser::Match CommandLineParser::ArgElement(TrivialLexer& lexer)
440 {
441 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
442
443
444
445
446
447
448
449 #endif // SOULNG_PARSER_DEBUG_SUPPORT
450 std::string value = std::string();
451 std::unique_ptr<soulng::parser::soulng::parser::Value<std::string>>o;
452 std::unique_ptr<soulng::parser::soulng::parser::Value<std::string>>s;
453 std::unique_ptr<soulng::parser::soulng::parser::Value<std::string>>sc;
454 std::unique_ptr<soulng::parser::soulng::parser::Value<std::string>>e;
455 soulng::parser::Match match(false);
456 soulng::parser::Match* parentMatch0 = &match;
457 {
458 int64_t save = lexer.GetPos();
459 soulng::parser::Match match(false);
460 soulng::parser::Match* parentMatch1 = &match;
461 {
462 int64_t save = lexer.GetPos();
463 soulng::parser::Match match(false);
464 soulng::parser::Match* parentMatch2 = &match;
465 {
466 int64_t pos = lexer.GetPos();
467 soulng::parser::Match match = CommandLineParser::OddBackslashesAndLiteralQuotationMark(lexer);
468 o.reset(static_cast<soulng::parser::soulng::parser::Value<std::string>*>(match.value));
469 if (match.hit)
470 {
471 {
472 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
473
474 #endif // SOULNG_PARSER_DEBUG_SUPPORT
475 return soulng::parser::Match(true, new soulng::parser::Value<std::string>(o->value));
476 }
477 }
478 *parentMatch2 = match;
479 }
480 *parentMatch1 = match;
481 if (!match.hit)
482 {
483 soulng::parser::Match match(false);
484 soulng::parser::Match* parentMatch3 = &match;
485 lexer.SetPos(save);
486 {
487 soulng::parser::Match match(false);
488 soulng::parser::Match* parentMatch4 = &match;
489 {
490 soulng::parser::Match match(false);
491 soulng::parser::Match* parentMatch5 = &match;
492 {
493 soulng::parser::Match match(false);
494 soulng::parser::Match* parentMatch6 = &match;
495 {
496 int64_t pos = lexer.GetPos();
497 soulng::parser::Match match = CommandLineParser::EvenBackslashesAndQuotationMark(lexer);
498 s.reset(static_cast<soulng::parser::soulng::parser::Value<std::string>*>(match.value));
499 if (match.hit)
500 {
501 value.append(s->value);
502 }
503 *parentMatch6 = match;
504 }
505 *parentMatch5 = match;
506 }
507 if (match.hit)
508 {
509 soulng::parser::Match match(false);
510 soulng::parser::Match* parentMatch7 = &match;
511 {
512 soulng::parser::Match match(true);
513 soulng::parser::Match* parentMatch8 = &match;
514 {
515 while (true)
516 {
517 int64_t save = lexer.GetPos();
518 {
519 soulng::parser::Match match(false);
520 soulng::parser::Match* parentMatch9 = &match;
521 {
522 soulng::parser::Match match(false);
523 soulng::parser::Match* parentMatch10 = &match;
524 {
525 int64_t pos = lexer.GetPos();
526 soulng::parser::Match match = CommandLineParser::StringChar(lexer);
527 sc.reset(static_cast<soulng::parser::soulng::parser::Value<std::string>*>(match.value));
528 if (match.hit)
529 {
530 value.append(sc->value);
531 }
532 *parentMatch10 = match;
533 }
534 *parentMatch9 = match;
535 }
536 if (match.hit)
537 {
538 *parentMatch8 = match;
539 }
540 else
541 {
542 lexer.SetPos(save);
543 break;
544 }
545 }
546 }
547 }
548 *parentMatch7 = match;
549 }
550 *parentMatch5 = match;
551 }
552 *parentMatch4 = match;
553 }
554 if (match.hit)
555 {
556 soulng::parser::Match match(false);
557 soulng::parser::Match* parentMatch11 = &match;
558 {
559 soulng::parser::Match match(false);
560 soulng::parser::Match* parentMatch12 = &match;
561 {
562 int64_t pos = lexer.GetPos();
563 soulng::parser::Match match = CommandLineParser::EvenBackslashesAndQuotationMark(lexer);
564 e.reset(static_cast<soulng::parser::soulng::parser::Value<std::string>*>(match.value));
565 if (match.hit)
566 {
567 value.append(e->value);
568 {
569 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
570
571 #endif // SOULNG_PARSER_DEBUG_SUPPORT
572 return soulng::parser::Match(true, new soulng::parser::Value<std::string>(value));
573 }
574 }
575 *parentMatch12 = match;
576 }
577 *parentMatch11 = match;
578 }
579 *parentMatch4 = match;
580 }
581 *parentMatch3 = match;
582 }
583 *parentMatch1 = match;
584 }
585 }
586 *parentMatch0 = match;
587 if (!match.hit)
588 {
589 soulng::parser::Match match(false);
590 soulng::parser::Match* parentMatch13 = &match;
591 lexer.SetPos(save);
592 {
593 soulng::parser::Match match(false);
594 soulng::parser::Match* parentMatch14 = &match;
595 {
596 int64_t pos = lexer.GetPos();
597 soulng::lexer::Span span = lexer.GetSpan();
598 soulng::parser::Match match(lexer.Pos() != lexer.End());
599 for (const soulng::parser::Range& range : s1)
600 {
601 if (*lexer >= range.first && *lexer <= range.last)
602 {
603 match.hit = false;
604 break;
605 }
606 }
607 if (match.hit)
608 {
609 ++lexer;
610 }
611 if (match.hit)
612 {
613 value.append(ToUtf8(lexer.GetMatch(span)));
614 {
615 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
616
617 #endif // SOULNG_PARSER_DEBUG_SUPPORT
618 return soulng::parser::Match(true, new soulng::parser::Value<std::string>(value));
619 }
620 }
621 *parentMatch14 = match;
622 }
623 *parentMatch13 = match;
624 }
625 *parentMatch0 = match;
626 }
627 }
628 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
629
630
631
632
633
634 #endif // SOULNG_PARSER_DEBUG_SUPPORT
635 if (!match.hit)
636 {
637 match.value = nullptr;
638 }
639 return match;
640 }
641
642 soulng::parser::Match CommandLineParser::OddBackslashesAndLiteralQuotationMark(TrivialLexer& lexer)
643 {
644 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
645
646
647
648
649
650
651
652 #endif // SOULNG_PARSER_DEBUG_SUPPORT
653 Span s = Span();
654 std::string value = std::string();
655 soulng::parser::Match match(false);
656 soulng::parser::Match* parentMatch0 = &match;
657 {
658 soulng::parser::Match match(false);
659 soulng::parser::Match* parentMatch1 = &match;
660 {
661 soulng::parser::Match match(false);
662 soulng::parser::Match* parentMatch2 = &match;
663 {
664 int64_t pos = lexer.GetPos();
665 soulng::lexer::Span span = lexer.GetSpan();
666 soulng::parser::Match match(false);
667 for (const soulng::parser::Range& range : s2)
668 {
669 if (*lexer >= range.first && *lexer <= range.last)
670 {
671 match.hit = true;
672 ++lexer;
673 break;
674 }
675 }
676 if (match.hit)
677 {
678 s = span;
679 }
680 *parentMatch2 = match;
681 }
682 *parentMatch1 = match;
683 }
684 if (match.hit)
685 {
686 soulng::parser::Match match(false);
687 soulng::parser::Match* parentMatch3 = &match;
688 {
689 soulng::parser::Match match(true);
690 soulng::parser::Match* parentMatch4 = &match;
691 {
692 while (true)
693 {
694 int64_t save = lexer.GetPos();
695 {
696 soulng::parser::Match match(false);
697 for (const soulng::parser::Range& range : s3)
698 {
699 if (*lexer >= range.first && *lexer <= range.last)
700 {
701 match.hit = true;
702 ++lexer;
703 break;
704 }
705 }
706 if (match.hit)
707 {
708 *parentMatch4 = match;
709 }
710 else
711 {
712 lexer.SetPos(save);
713 break;
714 }
715 }
716 }
717 }
718 *parentMatch3 = match;
719 }
720 *parentMatch1 = match;
721 }
722 *parentMatch0 = match;
723 }
724 if (match.hit)
725 {
726 soulng::parser::Match match(false);
727 soulng::parser::Match* parentMatch5 = &match;
728 {
729 soulng::parser::Match match(false);
730 soulng::parser::Match* parentMatch6 = &match;
731 {
732 int64_t pos = lexer.GetPos();
733 soulng::lexer::Span span = lexer.GetSpan();
734 bool pass = true;
735 soulng::parser::Match match(false);
736 if (*lexer == 34)
737 {
738 ++lexer;
739 match.hit = true;
740 }
741 if (match.hit)
742 {
743 s.end = span.end;
744 std::u32string bs = lexer.GetMatch(s);
745 int n = bs.length() - 1;
746 pass = n % 2 == 1;
747 if (pass)
748 {
749 value = std::string(n / 2, '\\');
750 value.append(1, '"');
751 {
752 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
753
754 #endif // SOULNG_PARSER_DEBUG_SUPPORT
755 return soulng::parser::Match(true, new soulng::parser::Value<std::string>(value));
756 }
757 }
758 }
759 if (match.hit && !pass)
760 {
761 match = soulng::parser::Match(false);
762 }
763 *parentMatch6 = match;
764 }
765 *parentMatch5 = match;
766 }
767 *parentMatch0 = match;
768 }
769 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
770
771
772
773
774
775 #endif // SOULNG_PARSER_DEBUG_SUPPORT
776 if (!match.hit)
777 {
778 match.value = nullptr;
779 }
780 return match;
781 }
782
783 soulng::parser::Match CommandLineParser::EvenBackslashesAndQuotationMark(TrivialLexer& lexer)
784 {
785 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
786
787
788
789
790
791
792
793 #endif // SOULNG_PARSER_DEBUG_SUPPORT
794 Span s = Span();
795 std::string value = std::string();
796 soulng::parser::Match match(false);
797 soulng::parser::Match* parentMatch0 = &match;
798 {
799 soulng::parser::Match match(false);
800 soulng::parser::Match* parentMatch1 = &match;
801 {
802 soulng::parser::Match match(false);
803 soulng::parser::Match* parentMatch2 = &match;
804 {
805 int64_t pos = lexer.GetPos();
806 soulng::lexer::Span span = lexer.GetSpan();
807 soulng::parser::Match match(true);
808 if (match.hit)
809 {
810 s = span;
811 }
812 *parentMatch2 = match;
813 }
814 *parentMatch1 = match;
815 }
816 if (match.hit)
817 {
818 soulng::parser::Match match(false);
819 soulng::parser::Match* parentMatch3 = &match;
820 {
821 soulng::parser::Match match(true);
822 soulng::parser::Match* parentMatch4 = &match;
823 {
824 while (true)
825 {
826 int64_t save = lexer.GetPos();
827 {
828 soulng::parser::Match match(false);
829 for (const soulng::parser::Range& range : s4)
830 {
831 if (*lexer >= range.first && *lexer <= range.last)
832 {
833 match.hit = true;
834 ++lexer;
835 break;
836 }
837 }
838 if (match.hit)
839 {
840 *parentMatch4 = match;
841 }
842 else
843 {
844 lexer.SetPos(save);
845 break;
846 }
847 }
848 }
849 }
850 *parentMatch3 = match;
851 }
852 *parentMatch1 = match;
853 }
854 *parentMatch0 = match;
855 }
856 if (match.hit)
857 {
858 soulng::parser::Match match(false);
859 soulng::parser::Match* parentMatch5 = &match;
860 {
861 soulng::parser::Match match(false);
862 soulng::parser::Match* parentMatch6 = &match;
863 {
864 int64_t pos = lexer.GetPos();
865 soulng::lexer::Span span = lexer.GetSpan();
866 bool pass = true;
867 soulng::parser::Match match(false);
868 if (*lexer == 34)
869 {
870 ++lexer;
871 match.hit = true;
872 }
873 if (match.hit)
874 {
875 s.end = span.end;
876 std::u32string bs = lexer.GetMatch(s);
877 int n = bs.length() - 1;
878 pass = n % 2 == 0;
879 if (pass)
880 {
881 value = std::string(n / 2, '\\');
882 {
883 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
884
885 #endif // SOULNG_PARSER_DEBUG_SUPPORT
886 return soulng::parser::Match(true, new soulng::parser::Value<std::string>(value));
887 }
888 }
889 }
890 if (match.hit && !pass)
891 {
892 match = soulng::parser::Match(false);
893 }
894 *parentMatch6 = match;
895 }
896 *parentMatch5 = match;
897 }
898 *parentMatch0 = match;
899 }
900 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
901
902
903
904
905
906 #endif // SOULNG_PARSER_DEBUG_SUPPORT
907 if (!match.hit)
908 {
909 match.value = nullptr;
910 }
911 return match;
912 }
913
914 soulng::parser::Match CommandLineParser::StringChar(TrivialLexer& lexer)
915 {
916 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
917
918
919
920
921
922
923
924 #endif // SOULNG_PARSER_DEBUG_SUPPORT
925 Span s = Span();
926 std::unique_ptr<soulng::parser::soulng::parser::Value<std::string>>o;
927 std::unique_ptr<soulng::parser::soulng::parser::Value<std::string>>m;
928 soulng::parser::Match match(false);
929 soulng::parser::Match* parentMatch0 = &match;
930 {
931 int64_t save = lexer.GetPos();
932 soulng::parser::Match match(false);
933 soulng::parser::Match* parentMatch1 = &match;
934 {
935 int64_t pos = lexer.GetPos();
936 soulng::parser::Match match = CommandLineParser::OddBackslashesAndLiteralQuotationMark(lexer);
937 o.reset(static_cast<soulng::parser::soulng::parser::Value<std::string>*>(match.value));
938 if (match.hit)
939 {
940 {
941 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
942
943 #endif // SOULNG_PARSER_DEBUG_SUPPORT
944 return soulng::parser::Match(true, new soulng::parser::Value<std::string>(o->value));
945 }
946 }
947 *parentMatch1 = match;
948 }
949 *parentMatch0 = match;
950 if (!match.hit)
951 {
952 soulng::parser::Match match(false);
953 soulng::parser::Match* parentMatch2 = &match;
954 lexer.SetPos(save);
955 {
956 soulng::parser::Match match(false);
957 soulng::parser::Match* parentMatch3 = &match;
958 {
959 int64_t pos = lexer.GetPos();
960 soulng::parser::Match match(false);
961 soulng::parser::Match* parentMatch4 = &match;
962 {
963 soulng::parser::Match match(false);
964 soulng::parser::Match* parentMatch5 = &match;
965 int64_t save = lexer.GetPos();
966 {
967 soulng::parser::Match match(false);
968 soulng::parser::Match* parentMatch6 = &match;
969 {
970 soulng::parser::Match match(false);
971 soulng::parser::Match* parentMatch7 = &match;
972 {
973 int64_t pos = lexer.GetPos();
974 soulng::lexer::Span span = lexer.GetSpan();
975 soulng::parser::Match match(lexer.Pos() != lexer.End());
976 for (const soulng::parser::Range& range : s5)
977 {
978 if (*lexer >= range.first && *lexer <= range.last)
979 {
980 match.hit = false;
981 break;
982 }
983 }
984 if (match.hit)
985 {
986 ++lexer;
987 }
988 if (match.hit)
989 {
990 s = span;
991 }
992 *parentMatch7 = match;
993 }
994 *parentMatch6 = match;
995 }
996 *parentMatch5 = match;
997 }
998 if (match.hit)
999 {
1000 soulng::parser::Match match(false);
1001 soulng::parser::Match* parentMatch8 = &match;
1002 {
1003 int64_t tmp = lexer.GetPos();
1004 lexer.SetPos(save);
1005 save = tmp;
1006 soulng::parser::Match match = CommandLineParser::EvenBackslashesAndQuotationMark(lexer);
1007 m.reset(static_cast<soulng::parser::soulng::parser::Value<std::string>*>(match.value));
1008 *parentMatch8 = match;
1009 }
1010 if (!match.hit)
1011 {
1012 lexer.SetPos(save);
1013 }
1014 *parentMatch5 = soulng::parser::Match(!match.hit, match.value);
1015 }
1016 *parentMatch4 = match;
1017 }
1018 if (match.hit)
1019 {
1020 {
1021 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1022
1023 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1024 return soulng::parser::Match(true, new soulng::parser::Value<std::string>(ToUtf8(lexer.GetMatch(s))));
1025 }
1026 }
1027 *parentMatch3 = match;
1028 }
1029 *parentMatch2 = match;
1030 }
1031 *parentMatch0 = match;
1032 }
1033 }
1034 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1035
1036
1037
1038
1039
1040 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1041 if (!match.hit)
1042 {
1043 match.value = nullptr;
1044 }
1045 return match;
1046 }