1 using System;
2 using System.Collections;
3 using System.Lex;
4 using System.Parsing;
5 using System.Net.Http;
6 using HttpTokens;
7
8
9
10 public static class Http
11 {
12 public static Match token(HttpLexer& lexer)
13 {
14 #if (DEBUG)
15 Span debugSpan;
16 bool writeToLog = lexer.Log() != null;
17 if (writeToLog)
18 {
19 debugSpan = lexer.GetSpan();
20 System.Lex.WriteBeginRuleToLog(lexer, u"token");
21 }
22 #endif
23 string s;
24 UniquePtr<Value<char>> ch;
25 UniquePtr<Value<char>> c;
26 UniquePtr<Value<char>> t;
27 Match match(false);
28 Match* parentMatch0 = &match;
29 {
30 long pos = lexer.GetPos();
31 Match match(false);
32 Match* parentMatch1 = &match;
33 {
34 Match match(false);
35 Match* parentMatch2 = &match;
36 {
37 Match match(false);
38 Match* parentMatch3 = &match;
39 {
40 Match match(false);
41 Match* parentMatch4 = &match;
42 {
43 long pos = lexer.GetPos();
44 Match match(false);
45 Match* parentMatch5 = &match;
46 {
47 Match match(false);
48 Match* parentMatch6 = &match;
49 long save = lexer.GetPos();
50 {
51 Match match = Http.chr(lexer);
52 ch.Reset(cast<Value<char>*>(match.value));
53 *parentMatch6 = match;
54 }
55 if (match.hit)
56 {
57 Match match(false);
58 Match* parentMatch7 = &match;
59 {
60 long tmp = lexer.GetPos();
61 lexer.SetPos(save);
62 save = tmp;
63 Match match(false);
64 Match* parentMatch8 = &match;
65 {
66 Match match(false);
67 Match* parentMatch9 = &match;
68 {
69 long save = lexer.GetPos();
70 Match match = Http.ctl(lexer);
71 c.Reset(cast<Value<char>*>(match.value));
72 *parentMatch9 = match;
73 if (!match.hit)
74 {
75 Match match(false);
76 Match* parentMatch10 = &match;
77 lexer.SetPos(save);
78 {
79 Match match = Http.tspecial(lexer);
80 t.Reset(cast<Value<char>*>(match.value));
81 *parentMatch10 = match;
82 }
83 *parentMatch9 = match;
84 }
85 }
86 *parentMatch8 = match;
87 }
88 *parentMatch7 = match;
89 }
90 if (!match.hit)
91 {
92 lexer.SetPos(save);
93 }
94 *parentMatch6 = Match(!match.hit, match.value);
95 }
96 *parentMatch5 = match;
97 }
98 if (match.hit)
99 {
100 s.Append(ch->value);
101 }
102 *parentMatch4 = match;
103 }
104 *parentMatch3 = match;
105 }
106 *parentMatch2 = match;
107 }
108 if (match.hit)
109 {
110 Match match(true);
111 Match* parentMatch11 = &match;
112 while (true)
113 {
114 long save = lexer.GetPos();
115 {
116 Match match(false);
117 Match* parentMatch12 = &match;
118 {
119 Match match(false);
120 Match* parentMatch13 = &match;
121 {
122 long pos = lexer.GetPos();
123 Match match(false);
124 Match* parentMatch14 = &match;
125 {
126 Match match(false);
127 Match* parentMatch15 = &match;
128 long save = lexer.GetPos();
129 {
130 Match match = Http.chr(lexer);
131 ch.Reset(cast<Value<char>*>(match.value));
132 *parentMatch15 = match;
133 }
134 if (match.hit)
135 {
136 Match match(false);
137 Match* parentMatch16 = &match;
138 {
139 long tmp = lexer.GetPos();
140 lexer.SetPos(save);
141 save = tmp;
142 Match match(false);
143 Match* parentMatch17 = &match;
144 {
145 Match match(false);
146 Match* parentMatch18 = &match;
147 {
148 long save = lexer.GetPos();
149 Match match = Http.ctl(lexer);
150 c.Reset(cast<Value<char>*>(match.value));
151 *parentMatch18 = match;
152 if (!match.hit)
153 {
154 Match match(false);
155 Match* parentMatch19 = &match;
156 lexer.SetPos(save);
157 {
158 Match match = Http.tspecial(lexer);
159 t.Reset(cast<Value<char>*>(match.value));
160 *parentMatch19 = match;
161 }
162 *parentMatch18 = match;
163 }
164 }
165 *parentMatch17 = match;
166 }
167 *parentMatch16 = match;
168 }
169 if (!match.hit)
170 {
171 lexer.SetPos(save);
172 }
173 *parentMatch15 = Match(!match.hit, match.value);
174 }
175 *parentMatch14 = match;
176 }
177 if (match.hit)
178 {
179 s.Append(ch->value);
180 }
181 *parentMatch13 = match;
182 }
183 *parentMatch12 = match;
184 }
185 if (match.hit)
186 {
187 *parentMatch11 = match;
188 }
189 else
190 {
191 lexer.SetPos(save);
192 break;
193 }
194 }
195 }
196 }
197 *parentMatch1 = match;
198 }
199 if (match.hit)
200 {
201 {
202 #if (DEBUG)
203 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"token");
204 #endif
205 return Match(true, new Value<string>(s));
206 }
207 }
208 *parentMatch0 = match;
209 }
210 #if (DEBUG)
211 if (writeToLog)
212 {
213 if (match.hit)
214 {
215 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"token");
216 }
217 else
218 {
219 System.Lex.WriteFailureToLog(lexer, u"token");
220 }
221 }
222 #endif
223 if (!match.hit)
224 {
225 match.value = null;
226 }
227 return match;
228 }
229 public static Match comment(HttpLexer& lexer)
230 {
231 #if (DEBUG)
232 Span debugSpan;
233 bool writeToLog = lexer.Log() != null;
234 if (writeToLog)
235 {
236 debugSpan = lexer.GetSpan();
237 System.Lex.WriteBeginRuleToLog(lexer, u"comment");
238 }
239 #endif
240 string s;
241 UniquePtr<Value<char>> ct;
242 UniquePtr<Value<char>> qp;
243 UniquePtr<Value<string>> c;
244 Match match(false);
245 Match* parentMatch0 = &match;
246 {
247 long pos = lexer.GetPos();
248 Match match(false);
249 Match* parentMatch1 = &match;
250 {
251 Match match(false);
252 Match* parentMatch2 = &match;
253 {
254 Match match(false);
255 Match* parentMatch3 = &match;
256 {
257 Match match(false);
258 if (*lexer == LPAREN)
259 {
260 ++lexer;
261 match.hit = true;
262 }
263 *parentMatch3 = match;
264 }
265 if (match.hit)
266 {
267 Match match(false);
268 Match* parentMatch4 = &match;
269 {
270 Match match(true);
271 Match* parentMatch5 = &match;
272 {
273 while (true)
274 {
275 long save = lexer.GetPos();
276 {
277 Match match(false);
278 Match* parentMatch6 = &match;
279 {
280 Match match(false);
281 Match* parentMatch7 = &match;
282 {
283 long save = lexer.GetPos();
284 Match match(false);
285 Match* parentMatch8 = &match;
286 {
287 Match match(false);
288 Match* parentMatch9 = &match;
289 {
290 long pos = lexer.GetPos();
291 Match match = Http.ctext(lexer);
292 ct.Reset(cast<Value<char>*>(match.value));
293 if (match.hit)
294 {
295 s.Append(ct->value);
296 }
297 *parentMatch9 = match;
298 }
299 *parentMatch8 = match;
300 }
301 if (match.hit)
302 {
303 Match match(false);
304 Match* parentMatch10 = &match;
305 {
306 Match match(false);
307 Match* parentMatch11 = &match;
308 {
309 long pos = lexer.GetPos();
310 Match match = Http.quoted_pair(lexer);
311 qp.Reset(cast<Value<char>*>(match.value));
312 if (match.hit)
313 {
314 s.Append(qp->value);
315 }
316 *parentMatch11 = match;
317 }
318 *parentMatch10 = match;
319 }
320 *parentMatch8 = match;
321 }
322 *parentMatch7 = match;
323 if (!match.hit)
324 {
325 Match match(false);
326 Match* parentMatch12 = &match;
327 lexer.SetPos(save);
328 {
329 Match match(false);
330 Match* parentMatch13 = &match;
331 {
332 long pos = lexer.GetPos();
333 Match match = Http.comment(lexer);
334 c.Reset(cast<Value<string>*>(match.value));
335 if (match.hit)
336 {
337 s.Append(c->value);
338 }
339 *parentMatch13 = match;
340 }
341 *parentMatch12 = match;
342 }
343 *parentMatch7 = match;
344 }
345 }
346 *parentMatch6 = match;
347 }
348 if (match.hit)
349 {
350 *parentMatch5 = match;
351 }
352 else
353 {
354 lexer.SetPos(save);
355 break;
356 }
357 }
358 }
359 }
360 *parentMatch4 = match;
361 }
362 *parentMatch3 = match;
363 }
364 *parentMatch2 = match;
365 }
366 if (match.hit)
367 {
368 Match match(false);
369 Match* parentMatch14 = &match;
370 {
371 Match match(false);
372 if (*lexer == RPAREN)
373 {
374 ++lexer;
375 match.hit = true;
376 }
377 *parentMatch14 = match;
378 }
379 *parentMatch2 = match;
380 }
381 *parentMatch1 = match;
382 }
383 if (match.hit)
384 {
385 {
386 #if (DEBUG)
387 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"comment");
388 #endif
389 return Match(true, new Value<string>(s));
390 }
391 }
392 *parentMatch0 = match;
393 }
394 #if (DEBUG)
395 if (writeToLog)
396 {
397 if (match.hit)
398 {
399 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"comment");
400 }
401 else
402 {
403 System.Lex.WriteFailureToLog(lexer, u"comment");
404 }
405 }
406 #endif
407 if (!match.hit)
408 {
409 match.value = null;
410 }
411 return match;
412 }
413 public static Match parameter(HttpLexer& lexer)
414 {
415 #if (DEBUG)
416 Span debugSpan;
417 bool writeToLog = lexer.Log() != null;
418 if (writeToLog)
419 {
420 debugSpan = lexer.GetSpan();
421 System.Lex.WriteBeginRuleToLog(lexer, u"parameter");
422 }
423 #endif
424 UniquePtr<Value<string>> a;
425 UniquePtr<Value<string>> av;
426 Match match(false);
427 Match* parentMatch0 = &match;
428 {
429 long pos = lexer.GetPos();
430 Match match(false);
431 Match* parentMatch1 = &match;
432 {
433 Match match(false);
434 Match* parentMatch2 = &match;
435 {
436 Match match(false);
437 Match* parentMatch3 = &match;
438 {
439 Match match = Http.attribute(lexer);
440 a.Reset(cast<Value<string>*>(match.value));
441 *parentMatch3 = match;
442 }
443 if (match.hit)
444 {
445 Match match(false);
446 Match* parentMatch4 = &match;
447 {
448 Match match(false);
449 if (*lexer == EQ)
450 {
451 ++lexer;
452 match.hit = true;
453 }
454 *parentMatch4 = match;
455 }
456 *parentMatch3 = match;
457 }
458 *parentMatch2 = match;
459 }
460 if (match.hit)
461 {
462 Match match(false);
463 Match* parentMatch5 = &match;
464 {
465 Match match = Http.attrval(lexer);
466 av.Reset(cast<Value<string>*>(match.value));
467 *parentMatch5 = match;
468 }
469 *parentMatch2 = match;
470 }
471 *parentMatch1 = match;
472 }
473 if (match.hit)
474 {
475 {
476 #if (DEBUG)
477 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"parameter");
478 #endif
479 return Match(true, new Value<Pair<string, string>>(MakePair(a->value, av->value)));
480 }
481 }
482 *parentMatch0 = match;
483 }
484 #if (DEBUG)
485 if (writeToLog)
486 {
487 if (match.hit)
488 {
489 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"parameter");
490 }
491 else
492 {
493 System.Lex.WriteFailureToLog(lexer, u"parameter");
494 }
495 }
496 #endif
497 if (!match.hit)
498 {
499 match.value = null;
500 }
501 return match;
502 }
503 public static Match attribute(HttpLexer& lexer)
504 {
505 #if (DEBUG)
506 Span debugSpan;
507 bool writeToLog = lexer.Log() != null;
508 if (writeToLog)
509 {
510 debugSpan = lexer.GetSpan();
511 System.Lex.WriteBeginRuleToLog(lexer, u"attribute");
512 }
513 #endif
514 UniquePtr<Value<string>> t;
515 Match match(false);
516 Match* parentMatch0 = &match;
517 {
518 long pos = lexer.GetPos();
519 Match match = Http.token(lexer);
520 t.Reset(cast<Value<string>*>(match.value));
521 if (match.hit)
522 {
523 {
524 #if (DEBUG)
525 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"attribute");
526 #endif
527 return Match(true, new Value<string>(t->value));
528 }
529 }
530 *parentMatch0 = match;
531 }
532 #if (DEBUG)
533 if (writeToLog)
534 {
535 if (match.hit)
536 {
537 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"attribute");
538 }
539 else
540 {
541 System.Lex.WriteFailureToLog(lexer, u"attribute");
542 }
543 }
544 #endif
545 if (!match.hit)
546 {
547 match.value = null;
548 }
549 return match;
550 }
551 public static Match attrval(HttpLexer& lexer)
552 {
553 #if (DEBUG)
554 Span debugSpan;
555 bool writeToLog = lexer.Log() != null;
556 if (writeToLog)
557 {
558 debugSpan = lexer.GetSpan();
559 System.Lex.WriteBeginRuleToLog(lexer, u"attrval");
560 }
561 #endif
562 UniquePtr<Value<string>> t;
563 UniquePtr<Value<string>> qs;
564 Match match(false);
565 Match* parentMatch0 = &match;
566 {
567 long save = lexer.GetPos();
568 Match match(false);
569 Match* parentMatch1 = &match;
570 {
571 long pos = lexer.GetPos();
572 Match match = Http.token(lexer);
573 t.Reset(cast<Value<string>*>(match.value));
574 if (match.hit)
575 {
576 {
577 #if (DEBUG)
578 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"attrval");
579 #endif
580 return Match(true, new Value<string>(t->value));
581 }
582 }
583 *parentMatch1 = match;
584 }
585 *parentMatch0 = match;
586 if (!match.hit)
587 {
588 Match match(false);
589 Match* parentMatch2 = &match;
590 lexer.SetPos(save);
591 {
592 Match match(false);
593 Match* parentMatch3 = &match;
594 {
595 long pos = lexer.GetPos();
596 Match match = Http.quoted_string(lexer);
597 qs.Reset(cast<Value<string>*>(match.value));
598 if (match.hit)
599 {
600 {
601 #if (DEBUG)
602 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"attrval");
603 #endif
604 return Match(true, new Value<string>(qs->value));
605 }
606 }
607 *parentMatch3 = match;
608 }
609 *parentMatch2 = match;
610 }
611 *parentMatch0 = match;
612 }
613 }
614 #if (DEBUG)
615 if (writeToLog)
616 {
617 if (match.hit)
618 {
619 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"attrval");
620 }
621 else
622 {
623 System.Lex.WriteFailureToLog(lexer, u"attrval");
624 }
625 }
626 #endif
627 if (!match.hit)
628 {
629 match.value = null;
630 }
631 return match;
632 }
633 public static Match hex(HttpLexer& lexer)
634 {
635 #if (DEBUG)
636 Span debugSpan;
637 bool writeToLog = lexer.Log() != null;
638 if (writeToLog)
639 {
640 debugSpan = lexer.GetSpan();
641 System.Lex.WriteBeginRuleToLog(lexer, u"hex");
642 }
643 #endif
644 Match match(false);
645 long pos = lexer.GetPos();
646 Span span = lexer.GetSpan();
647 switch (*lexer)
648 {
649 case DIGIT:
650 {
651 ++lexer;
652 {
653 #if (DEBUG)
654 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"hex");
655 #endif
656 return Match(true, new Value<char>(lexer.GetChar(pos)));
657 }
658 break;
659 }
660 case HEX:
661 {
662 ++lexer;
663 {
664 #if (DEBUG)
665 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"hex");
666 #endif
667 return Match(true, new Value<char>(lexer.GetChar(pos)));
668 }
669 break;
670 }
671 }
672 #if (DEBUG)
673 if (writeToLog)
674 {
675 if (match.hit)
676 {
677 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"hex");
678 }
679 else
680 {
681 System.Lex.WriteFailureToLog(lexer, u"hex");
682 }
683 }
684 #endif
685 if (!match.hit)
686 {
687 match.value = null;
688 }
689 return match;
690 }
691 public static Match chr(HttpLexer& lexer)
692 {
693 #if (DEBUG)
694 Span debugSpan;
695 bool writeToLog = lexer.Log() != null;
696 if (writeToLog)
697 {
698 debugSpan = lexer.GetSpan();
699 System.Lex.WriteBeginRuleToLog(lexer, u"chr");
700 }
701 #endif
702 Match match(false);
703 long pos = lexer.GetPos();
704 Span span = lexer.GetSpan();
705 switch (*lexer)
706 {
707 case DIGIT:
708 {
709 ++lexer;
710 {
711 #if (DEBUG)
712 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
713 #endif
714 return Match(true, new Value<char>(lexer.GetChar(pos)));
715 }
716 break;
717 }
718 case HEX:
719 {
720 ++lexer;
721 {
722 #if (DEBUG)
723 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
724 #endif
725 return Match(true, new Value<char>(lexer.GetChar(pos)));
726 }
727 break;
728 }
729 case ALPHA:
730 {
731 ++lexer;
732 {
733 #if (DEBUG)
734 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
735 #endif
736 return Match(true, new Value<char>(lexer.GetChar(pos)));
737 }
738 break;
739 }
740 case HT:
741 {
742 ++lexer;
743 {
744 #if (DEBUG)
745 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
746 #endif
747 return Match(true, new Value<char>('\t'));
748 }
749 break;
750 }
751 case DQ:
752 {
753 ++lexer;
754 {
755 #if (DEBUG)
756 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
757 #endif
758 return Match(true, new Value<char>('\"'));
759 }
760 break;
761 }
762 case CR:
763 {
764 ++lexer;
765 {
766 #if (DEBUG)
767 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
768 #endif
769 return Match(true, new Value<char>('\r'));
770 }
771 break;
772 }
773 case LF:
774 {
775 ++lexer;
776 {
777 #if (DEBUG)
778 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
779 #endif
780 return Match(true, new Value<char>('\n'));
781 }
782 break;
783 }
784 case CTL:
785 {
786 ++lexer;
787 {
788 #if (DEBUG)
789 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
790 #endif
791 return Match(true, new Value<char>(lexer.GetChar(pos)));
792 }
793 break;
794 }
795 case SP:
796 {
797 ++lexer;
798 {
799 #if (DEBUG)
800 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
801 #endif
802 return Match(true, new Value<char>(' '));
803 }
804 break;
805 }
806 case COLON:
807 {
808 ++lexer;
809 {
810 #if (DEBUG)
811 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
812 #endif
813 return Match(true, new Value<char>(':'));
814 }
815 break;
816 }
817 case SEMICOLON:
818 {
819 ++lexer;
820 {
821 #if (DEBUG)
822 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
823 #endif
824 return Match(true, new Value<char>(';'));
825 }
826 break;
827 }
828 case COMMA:
829 {
830 ++lexer;
831 {
832 #if (DEBUG)
833 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
834 #endif
835 return Match(true, new Value<char>(','));
836 }
837 break;
838 }
839 case DOT:
840 {
841 ++lexer;
842 {
843 #if (DEBUG)
844 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
845 #endif
846 return Match(true, new Value<char>('.'));
847 }
848 break;
849 }
850 case LPAREN:
851 {
852 ++lexer;
853 {
854 #if (DEBUG)
855 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
856 #endif
857 return Match(true, new Value<char>('('));
858 }
859 break;
860 }
861 case RPAREN:
862 {
863 ++lexer;
864 {
865 #if (DEBUG)
866 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
867 #endif
868 return Match(true, new Value<char>(')'));
869 }
870 break;
871 }
872 case LANGLE:
873 {
874 ++lexer;
875 {
876 #if (DEBUG)
877 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
878 #endif
879 return Match(true, new Value<char>('<'));
880 }
881 break;
882 }
883 case RANGLE:
884 {
885 ++lexer;
886 {
887 #if (DEBUG)
888 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
889 #endif
890 return Match(true, new Value<char>('>'));
891 }
892 break;
893 }
894 case LBRACKET:
895 {
896 ++lexer;
897 {
898 #if (DEBUG)
899 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
900 #endif
901 return Match(true, new Value<char>('['));
902 }
903 break;
904 }
905 case RBRACKET:
906 {
907 ++lexer;
908 {
909 #if (DEBUG)
910 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
911 #endif
912 return Match(true, new Value<char>(']'));
913 }
914 break;
915 }
916 case LBRACE:
917 {
918 ++lexer;
919 {
920 #if (DEBUG)
921 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
922 #endif
923 return Match(true, new Value<char>('{'));
924 }
925 break;
926 }
927 case RBRACE:
928 {
929 ++lexer;
930 {
931 #if (DEBUG)
932 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
933 #endif
934 return Match(true, new Value<char>('}'));
935 }
936 break;
937 }
938 case SLASH:
939 {
940 ++lexer;
941 {
942 #if (DEBUG)
943 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
944 #endif
945 return Match(true, new Value<char>('/'));
946 }
947 break;
948 }
949 case BACKSLASH:
950 {
951 ++lexer;
952 {
953 #if (DEBUG)
954 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
955 #endif
956 return Match(true, new Value<char>('\\'));
957 }
958 break;
959 }
960 case EQ:
961 {
962 ++lexer;
963 {
964 #if (DEBUG)
965 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
966 #endif
967 return Match(true, new Value<char>('='));
968 }
969 break;
970 }
971 case CHAR:
972 {
973 ++lexer;
974 {
975 #if (DEBUG)
976 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
977 #endif
978 return Match(true, new Value<char>(lexer.GetChar(pos)));
979 }
980 break;
981 }
982 }
983 #if (DEBUG)
984 if (writeToLog)
985 {
986 if (match.hit)
987 {
988 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"chr");
989 }
990 else
991 {
992 System.Lex.WriteFailureToLog(lexer, u"chr");
993 }
994 }
995 #endif
996 if (!match.hit)
997 {
998 match.value = null;
999 }
1000 return match;
1001 }
1002 public static Match text(HttpLexer& lexer)
1003 {
1004 #if (DEBUG)
1005 Span debugSpan;
1006 bool writeToLog = lexer.Log() != null;
1007 if (writeToLog)
1008 {
1009 debugSpan = lexer.GetSpan();
1010 System.Lex.WriteBeginRuleToLog(lexer, u"text");
1011 }
1012 #endif
1013 UniquePtr<Value<char>> o;
1014 UniquePtr<Value<char>> c;
1015 Match match(false);
1016 Match* parentMatch0 = &match;
1017 {
1018 long pos = lexer.GetPos();
1019 Match match(false);
1020 Match* parentMatch1 = &match;
1021 {
1022 Match match(false);
1023 Match* parentMatch2 = &match;
1024 long save = lexer.GetPos();
1025 {
1026 Match match = Http.octet(lexer);
1027 o.Reset(cast<Value<char>*>(match.value));
1028 *parentMatch2 = match;
1029 }
1030 if (match.hit)
1031 {
1032 Match match(false);
1033 Match* parentMatch3 = &match;
1034 {
1035 long tmp = lexer.GetPos();
1036 lexer.SetPos(save);
1037 save = tmp;
1038 Match match = Http.ctl(lexer);
1039 c.Reset(cast<Value<char>*>(match.value));
1040 *parentMatch3 = match;
1041 }
1042 if (!match.hit)
1043 {
1044 lexer.SetPos(save);
1045 }
1046 *parentMatch2 = Match(!match.hit, match.value);
1047 }
1048 *parentMatch1 = match;
1049 }
1050 if (match.hit)
1051 {
1052 {
1053 #if (DEBUG)
1054 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"text");
1055 #endif
1056 return Match(true, new Value<char>(o->value));
1057 }
1058 }
1059 *parentMatch0 = match;
1060 }
1061 #if (DEBUG)
1062 if (writeToLog)
1063 {
1064 if (match.hit)
1065 {
1066 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"text");
1067 }
1068 else
1069 {
1070 System.Lex.WriteFailureToLog(lexer, u"text");
1071 }
1072 }
1073 #endif
1074 if (!match.hit)
1075 {
1076 match.value = null;
1077 }
1078 return match;
1079 }
1080 public static Match ctext(HttpLexer& lexer)
1081 {
1082 #if (DEBUG)
1083 Span debugSpan;
1084 bool writeToLog = lexer.Log() != null;
1085 if (writeToLog)
1086 {
1087 debugSpan = lexer.GetSpan();
1088 System.Lex.WriteBeginRuleToLog(lexer, u"ctext");
1089 }
1090 #endif
1091 UniquePtr<Value<char>> t;
1092 Match match(false);
1093 Match* parentMatch0 = &match;
1094 {
1095 long pos = lexer.GetPos();
1096 Match match(false);
1097 Match* parentMatch1 = &match;
1098 {
1099 Match match(false);
1100 Match* parentMatch2 = &match;
1101 long save = lexer.GetPos();
1102 {
1103 Match match = Http.text(lexer);
1104 t.Reset(cast<Value<char>*>(match.value));
1105 *parentMatch2 = match;
1106 }
1107 if (match.hit)
1108 {
1109 Match match(false);
1110 Match* parentMatch3 = &match;
1111 {
1112 long tmp = lexer.GetPos();
1113 lexer.SetPos(save);
1114 save = tmp;
1115 Match match(false);
1116 Match* parentMatch4 = &match;
1117 {
1118 Match match(false);
1119 Match* parentMatch5 = &match;
1120 {
1121 long save = lexer.GetPos();
1122 Match match(false);
1123 if (*lexer == LPAREN)
1124 {
1125 ++lexer;
1126 match.hit = true;
1127 }
1128 *parentMatch5 = match;
1129 if (!match.hit)
1130 {
1131 Match match(false);
1132 Match* parentMatch6 = &match;
1133 lexer.SetPos(save);
1134 {
1135 Match match(false);
1136 if (*lexer == RPAREN)
1137 {
1138 ++lexer;
1139 match.hit = true;
1140 }
1141 *parentMatch6 = match;
1142 }
1143 *parentMatch5 = match;
1144 }
1145 }
1146 *parentMatch4 = match;
1147 }
1148 *parentMatch3 = match;
1149 }
1150 if (!match.hit)
1151 {
1152 lexer.SetPos(save);
1153 }
1154 *parentMatch2 = Match(!match.hit, match.value);
1155 }
1156 *parentMatch1 = match;
1157 }
1158 if (match.hit)
1159 {
1160 {
1161 #if (DEBUG)
1162 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ctext");
1163 #endif
1164 return Match(true, new Value<char>(t->value));
1165 }
1166 }
1167 *parentMatch0 = match;
1168 }
1169 #if (DEBUG)
1170 if (writeToLog)
1171 {
1172 if (match.hit)
1173 {
1174 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ctext");
1175 }
1176 else
1177 {
1178 System.Lex.WriteFailureToLog(lexer, u"ctext");
1179 }
1180 }
1181 #endif
1182 if (!match.hit)
1183 {
1184 match.value = null;
1185 }
1186 return match;
1187 }
1188 public static Match quoted_string(HttpLexer& lexer)
1189 {
1190 #if (DEBUG)
1191 Span debugSpan;
1192 bool writeToLog = lexer.Log() != null;
1193 if (writeToLog)
1194 {
1195 debugSpan = lexer.GetSpan();
1196 System.Lex.WriteBeginRuleToLog(lexer, u"quoted_string");
1197 }
1198 #endif
1199 string s;
1200 UniquePtr<Value<char>> qdt;
1201 UniquePtr<Value<char>> qp;
1202 Match match(false);
1203 Match* parentMatch0 = &match;
1204 {
1205 long pos = lexer.GetPos();
1206 Match match(false);
1207 Match* parentMatch1 = &match;
1208 {
1209 Match match(false);
1210 Match* parentMatch2 = &match;
1211 {
1212 Match match(false);
1213 Match* parentMatch3 = &match;
1214 {
1215 Match match(false);
1216 if (*lexer == DQ)
1217 {
1218 ++lexer;
1219 match.hit = true;
1220 }
1221 *parentMatch3 = match;
1222 }
1223 if (match.hit)
1224 {
1225 Match match(false);
1226 Match* parentMatch4 = &match;
1227 {
1228 Match match(true);
1229 Match* parentMatch5 = &match;
1230 {
1231 while (true)
1232 {
1233 long save = lexer.GetPos();
1234 {
1235 Match match(false);
1236 Match* parentMatch6 = &match;
1237 {
1238 Match match(false);
1239 Match* parentMatch7 = &match;
1240 {
1241 long save = lexer.GetPos();
1242 Match match(false);
1243 Match* parentMatch8 = &match;
1244 {
1245 long pos = lexer.GetPos();
1246 Match match = Http.qdtext(lexer);
1247 qdt.Reset(cast<Value<char>*>(match.value));
1248 if (match.hit)
1249 {
1250 s.Append(qdt->value);
1251 }
1252 *parentMatch8 = match;
1253 }
1254 *parentMatch7 = match;
1255 if (!match.hit)
1256 {
1257 Match match(false);
1258 Match* parentMatch9 = &match;
1259 lexer.SetPos(save);
1260 {
1261 Match match(false);
1262 Match* parentMatch10 = &match;
1263 {
1264 long pos = lexer.GetPos();
1265 Match match = Http.quoted_pair(lexer);
1266 qp.Reset(cast<Value<char>*>(match.value));
1267 if (match.hit)
1268 {
1269 s.Append(qp->value);
1270 }
1271 *parentMatch10 = match;
1272 }
1273 *parentMatch9 = match;
1274 }
1275 *parentMatch7 = match;
1276 }
1277 }
1278 *parentMatch6 = match;
1279 }
1280 if (match.hit)
1281 {
1282 *parentMatch5 = match;
1283 }
1284 else
1285 {
1286 lexer.SetPos(save);
1287 break;
1288 }
1289 }
1290 }
1291 }
1292 *parentMatch4 = match;
1293 }
1294 *parentMatch3 = match;
1295 }
1296 *parentMatch2 = match;
1297 }
1298 if (match.hit)
1299 {
1300 Match match(false);
1301 Match* parentMatch11 = &match;
1302 {
1303 Match match(false);
1304 if (*lexer == DQ)
1305 {
1306 ++lexer;
1307 match.hit = true;
1308 }
1309 *parentMatch11 = match;
1310 }
1311 *parentMatch2 = match;
1312 }
1313 *parentMatch1 = match;
1314 }
1315 if (match.hit)
1316 {
1317 {
1318 #if (DEBUG)
1319 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"quoted_string");
1320 #endif
1321 return Match(true, new Value<string>(s));
1322 }
1323 }
1324 *parentMatch0 = match;
1325 }
1326 #if (DEBUG)
1327 if (writeToLog)
1328 {
1329 if (match.hit)
1330 {
1331 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"quoted_string");
1332 }
1333 else
1334 {
1335 System.Lex.WriteFailureToLog(lexer, u"quoted_string");
1336 }
1337 }
1338 #endif
1339 if (!match.hit)
1340 {
1341 match.value = null;
1342 }
1343 return match;
1344 }
1345 public static Match qdtext(HttpLexer& lexer)
1346 {
1347 #if (DEBUG)
1348 Span debugSpan;
1349 bool writeToLog = lexer.Log() != null;
1350 if (writeToLog)
1351 {
1352 debugSpan = lexer.GetSpan();
1353 System.Lex.WriteBeginRuleToLog(lexer, u"qdtext");
1354 }
1355 #endif
1356 UniquePtr<Value<char>> t;
1357 Match match(false);
1358 Match* parentMatch0 = &match;
1359 {
1360 long pos = lexer.GetPos();
1361 Match match(false);
1362 Match* parentMatch1 = &match;
1363 {
1364 Match match(false);
1365 Match* parentMatch2 = &match;
1366 long save = lexer.GetPos();
1367 {
1368 Match match = Http.text(lexer);
1369 t.Reset(cast<Value<char>*>(match.value));
1370 *parentMatch2 = match;
1371 }
1372 if (match.hit)
1373 {
1374 Match match(false);
1375 Match* parentMatch3 = &match;
1376 {
1377 long tmp = lexer.GetPos();
1378 lexer.SetPos(save);
1379 save = tmp;
1380 Match match(false);
1381 if (*lexer == DQ)
1382 {
1383 ++lexer;
1384 match.hit = true;
1385 }
1386 *parentMatch3 = match;
1387 }
1388 if (!match.hit)
1389 {
1390 lexer.SetPos(save);
1391 }
1392 *parentMatch2 = Match(!match.hit, match.value);
1393 }
1394 *parentMatch1 = match;
1395 }
1396 if (match.hit)
1397 {
1398 {
1399 #if (DEBUG)
1400 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"qdtext");
1401 #endif
1402 return Match(true, new Value<char>(t->value));
1403 }
1404 }
1405 *parentMatch0 = match;
1406 }
1407 #if (DEBUG)
1408 if (writeToLog)
1409 {
1410 if (match.hit)
1411 {
1412 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"qdtext");
1413 }
1414 else
1415 {
1416 System.Lex.WriteFailureToLog(lexer, u"qdtext");
1417 }
1418 }
1419 #endif
1420 if (!match.hit)
1421 {
1422 match.value = null;
1423 }
1424 return match;
1425 }
1426 public static Match quoted_pair(HttpLexer& lexer)
1427 {
1428 #if (DEBUG)
1429 Span debugSpan;
1430 bool writeToLog = lexer.Log() != null;
1431 if (writeToLog)
1432 {
1433 debugSpan = lexer.GetSpan();
1434 System.Lex.WriteBeginRuleToLog(lexer, u"quoted_pair");
1435 }
1436 #endif
1437 UniquePtr<Value<char>> ch;
1438 Match match(false);
1439 Match* parentMatch0 = &match;
1440 {
1441 Match match(false);
1442 if (*lexer == BACKSLASH)
1443 {
1444 ++lexer;
1445 match.hit = true;
1446 }
1447 *parentMatch0 = match;
1448 }
1449 if (match.hit)
1450 {
1451 Match match(false);
1452 Match* parentMatch1 = &match;
1453 {
1454 Match match(false);
1455 Match* parentMatch2 = &match;
1456 {
1457 long pos = lexer.GetPos();
1458 Match match = Http.chr(lexer);
1459 ch.Reset(cast<Value<char>*>(match.value));
1460 if (match.hit)
1461 {
1462 {
1463 #if (DEBUG)
1464 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"quoted_pair");
1465 #endif
1466 return Match(true, new Value<char>(ch->value));
1467 }
1468 }
1469 *parentMatch2 = match;
1470 }
1471 *parentMatch1 = match;
1472 }
1473 *parentMatch0 = match;
1474 }
1475 #if (DEBUG)
1476 if (writeToLog)
1477 {
1478 if (match.hit)
1479 {
1480 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"quoted_pair");
1481 }
1482 else
1483 {
1484 System.Lex.WriteFailureToLog(lexer, u"quoted_pair");
1485 }
1486 }
1487 #endif
1488 if (!match.hit)
1489 {
1490 match.value = null;
1491 }
1492 return match;
1493 }
1494 public static Match ctl(HttpLexer& lexer)
1495 {
1496 #if (DEBUG)
1497 Span debugSpan;
1498 bool writeToLog = lexer.Log() != null;
1499 if (writeToLog)
1500 {
1501 debugSpan = lexer.GetSpan();
1502 System.Lex.WriteBeginRuleToLog(lexer, u"ctl");
1503 }
1504 #endif
1505 Match match(false);
1506 long pos = lexer.GetPos();
1507 Span span = lexer.GetSpan();
1508 switch (*lexer)
1509 {
1510 case HT:
1511 {
1512 ++lexer;
1513 {
1514 #if (DEBUG)
1515 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ctl");
1516 #endif
1517 return Match(true, new Value<char>('\t'));
1518 }
1519 break;
1520 }
1521 case CR:
1522 {
1523 ++lexer;
1524 {
1525 #if (DEBUG)
1526 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ctl");
1527 #endif
1528 return Match(true, new Value<char>('\r'));
1529 }
1530 break;
1531 }
1532 case LF:
1533 {
1534 ++lexer;
1535 {
1536 #if (DEBUG)
1537 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ctl");
1538 #endif
1539 return Match(true, new Value<char>('\n'));
1540 }
1541 break;
1542 }
1543 case CTL:
1544 {
1545 ++lexer;
1546 {
1547 #if (DEBUG)
1548 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ctl");
1549 #endif
1550 return Match(true, new Value<char>(lexer.GetChar(pos)));
1551 }
1552 break;
1553 }
1554 }
1555 #if (DEBUG)
1556 if (writeToLog)
1557 {
1558 if (match.hit)
1559 {
1560 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ctl");
1561 }
1562 else
1563 {
1564 System.Lex.WriteFailureToLog(lexer, u"ctl");
1565 }
1566 }
1567 #endif
1568 if (!match.hit)
1569 {
1570 match.value = null;
1571 }
1572 return match;
1573 }
1574 public static Match tspecial(HttpLexer& lexer)
1575 {
1576 #if (DEBUG)
1577 Span debugSpan;
1578 bool writeToLog = lexer.Log() != null;
1579 if (writeToLog)
1580 {
1581 debugSpan = lexer.GetSpan();
1582 System.Lex.WriteBeginRuleToLog(lexer, u"tspecial");
1583 }
1584 #endif
1585 Match match(false);
1586 long pos = lexer.GetPos();
1587 Span span = lexer.GetSpan();
1588 switch (*lexer)
1589 {
1590 case LPAREN:
1591 {
1592 ++lexer;
1593 {
1594 #if (DEBUG)
1595 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1596 #endif
1597 return Match(true, new Value<char>('('));
1598 }
1599 break;
1600 }
1601 case RPAREN:
1602 {
1603 ++lexer;
1604 {
1605 #if (DEBUG)
1606 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1607 #endif
1608 return Match(true, new Value<char>(')'));
1609 }
1610 break;
1611 }
1612 case LANGLE:
1613 {
1614 ++lexer;
1615 {
1616 #if (DEBUG)
1617 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1618 #endif
1619 return Match(true, new Value<char>('<'));
1620 }
1621 break;
1622 }
1623 case RANGLE:
1624 {
1625 ++lexer;
1626 {
1627 #if (DEBUG)
1628 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1629 #endif
1630 return Match(true, new Value<char>('>'));
1631 }
1632 break;
1633 }
1634 case AT:
1635 {
1636 ++lexer;
1637 {
1638 #if (DEBUG)
1639 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1640 #endif
1641 return Match(true, new Value<char>('@'));
1642 }
1643 break;
1644 }
1645 case COMMA:
1646 {
1647 ++lexer;
1648 {
1649 #if (DEBUG)
1650 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1651 #endif
1652 return Match(true, new Value<char>(','));
1653 }
1654 break;
1655 }
1656 case SEMICOLON:
1657 {
1658 ++lexer;
1659 {
1660 #if (DEBUG)
1661 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1662 #endif
1663 return Match(true, new Value<char>(';'));
1664 }
1665 break;
1666 }
1667 case COLON:
1668 {
1669 ++lexer;
1670 {
1671 #if (DEBUG)
1672 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1673 #endif
1674 return Match(true, new Value<char>(':'));
1675 }
1676 break;
1677 }
1678 case BACKSLASH:
1679 {
1680 ++lexer;
1681 {
1682 #if (DEBUG)
1683 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1684 #endif
1685 return Match(true, new Value<char>('\\'));
1686 }
1687 break;
1688 }
1689 case DQ:
1690 {
1691 ++lexer;
1692 {
1693 #if (DEBUG)
1694 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1695 #endif
1696 return Match(true, new Value<char>('\"'));
1697 }
1698 break;
1699 }
1700 case SLASH:
1701 {
1702 ++lexer;
1703 {
1704 #if (DEBUG)
1705 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1706 #endif
1707 return Match(true, new Value<char>('/'));
1708 }
1709 break;
1710 }
1711 case LBRACKET:
1712 {
1713 ++lexer;
1714 {
1715 #if (DEBUG)
1716 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1717 #endif
1718 return Match(true, new Value<char>('['));
1719 }
1720 break;
1721 }
1722 case RBRACKET:
1723 {
1724 ++lexer;
1725 {
1726 #if (DEBUG)
1727 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1728 #endif
1729 return Match(true, new Value<char>(']'));
1730 }
1731 break;
1732 }
1733 case QUEST:
1734 {
1735 ++lexer;
1736 {
1737 #if (DEBUG)
1738 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1739 #endif
1740 return Match(true, new Value<char>('?'));
1741 }
1742 break;
1743 }
1744 case EQ:
1745 {
1746 ++lexer;
1747 {
1748 #if (DEBUG)
1749 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1750 #endif
1751 return Match(true, new Value<char>('='));
1752 }
1753 break;
1754 }
1755 case LBRACE:
1756 {
1757 ++lexer;
1758 {
1759 #if (DEBUG)
1760 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1761 #endif
1762 return Match(true, new Value<char>('{'));
1763 }
1764 break;
1765 }
1766 case RBRACE:
1767 {
1768 ++lexer;
1769 {
1770 #if (DEBUG)
1771 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1772 #endif
1773 return Match(true, new Value<char>('}'));
1774 }
1775 break;
1776 }
1777 case SP:
1778 {
1779 ++lexer;
1780 {
1781 #if (DEBUG)
1782 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1783 #endif
1784 return Match(true, new Value<char>(' '));
1785 }
1786 break;
1787 }
1788 case HT:
1789 {
1790 ++lexer;
1791 {
1792 #if (DEBUG)
1793 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1794 #endif
1795 return Match(true, new Value<char>('\t'));
1796 }
1797 break;
1798 }
1799 }
1800 #if (DEBUG)
1801 if (writeToLog)
1802 {
1803 if (match.hit)
1804 {
1805 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"tspecial");
1806 }
1807 else
1808 {
1809 System.Lex.WriteFailureToLog(lexer, u"tspecial");
1810 }
1811 }
1812 #endif
1813 if (!match.hit)
1814 {
1815 match.value = null;
1816 }
1817 return match;
1818 }
1819 public static Match octet(HttpLexer& lexer)
1820 {
1821 #if (DEBUG)
1822 Span debugSpan;
1823 bool writeToLog = lexer.Log() != null;
1824 if (writeToLog)
1825 {
1826 debugSpan = lexer.GetSpan();
1827 System.Lex.WriteBeginRuleToLog(lexer, u"octet");
1828 }
1829 #endif
1830 UniquePtr<Value<char>> c;
1831 Match match(false);
1832 Match* parentMatch0 = &match;
1833 {
1834 long save = lexer.GetPos();
1835 Match match(false);
1836 Match* parentMatch1 = &match;
1837 {
1838 long pos = lexer.GetPos();
1839 Match match = Http.chr(lexer);
1840 c.Reset(cast<Value<char>*>(match.value));
1841 if (match.hit)
1842 {
1843 {
1844 #if (DEBUG)
1845 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"octet");
1846 #endif
1847 return Match(true, new Value<char>(c->value));
1848 }
1849 }
1850 *parentMatch1 = match;
1851 }
1852 *parentMatch0 = match;
1853 if (!match.hit)
1854 {
1855 Match match(false);
1856 Match* parentMatch2 = &match;
1857 lexer.SetPos(save);
1858 {
1859 Match match(false);
1860 Match* parentMatch3 = &match;
1861 {
1862 long pos = lexer.GetPos();
1863 Match match(false);
1864 if (*lexer == OCTET)
1865 {
1866 ++lexer;
1867 match.hit = true;
1868 }
1869 if (match.hit)
1870 {
1871 {
1872 #if (DEBUG)
1873 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"octet");
1874 #endif
1875 return Match(true, new Value<char>(lexer.GetChar(pos)));
1876 }
1877 }
1878 *parentMatch3 = match;
1879 }
1880 *parentMatch2 = match;
1881 }
1882 *parentMatch0 = match;
1883 }
1884 }
1885 #if (DEBUG)
1886 if (writeToLog)
1887 {
1888 if (match.hit)
1889 {
1890 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"octet");
1891 }
1892 else
1893 {
1894 System.Lex.WriteFailureToLog(lexer, u"octet");
1895 }
1896 }
1897 #endif
1898 if (!match.hit)
1899 {
1900 match.value = null;
1901 }
1902 return match;
1903 }
1904 public static Match lws(HttpLexer& lexer)
1905 {
1906 #if (DEBUG)
1907 Span debugSpan;
1908 bool writeToLog = lexer.Log() != null;
1909 if (writeToLog)
1910 {
1911 debugSpan = lexer.GetSpan();
1912 System.Lex.WriteBeginRuleToLog(lexer, u"lws");
1913 }
1914 #endif
1915 Match match(false);
1916 Match* parentMatch0 = &match;
1917 {
1918 Match match(false);
1919 Match* parentMatch1 = &match;
1920 {
1921 Match match(false);
1922 Match* parentMatch2 = &match;
1923 {
1924 Match match(true);
1925 long save = lexer.GetPos();
1926 Match* parentMatch3 = &match;
1927 {
1928 Match match(false);
1929 Match* parentMatch4 = &match;
1930 {
1931 Match match(false);
1932 Match* parentMatch5 = &match;
1933 {
1934 long save = lexer.GetPos();
1935 Match match(false);
1936 if (*lexer == CR)
1937 {
1938 ++lexer;
1939 match.hit = true;
1940 }
1941 *parentMatch5 = match;
1942 if (!match.hit)
1943 {
1944 Match match(false);
1945 Match* parentMatch6 = &match;
1946 lexer.SetPos(save);
1947 {
1948 Match match(false);
1949 if (*lexer == LF)
1950 {
1951 ++lexer;
1952 match.hit = true;
1953 }
1954 *parentMatch6 = match;
1955 }
1956 *parentMatch5 = match;
1957 }
1958 }
1959 *parentMatch4 = match;
1960 }
1961 if (match.hit)
1962 {
1963 *parentMatch3 = match;
1964 }
1965 else
1966 {
1967 lexer.SetPos(save);
1968 }
1969 }
1970 *parentMatch2 = match;
1971 }
1972 if (match.hit)
1973 {
1974 Match match(false);
1975 Match* parentMatch7 = &match;
1976 {
1977 Match match(false);
1978 Match* parentMatch8 = &match;
1979 {
1980 Match match(false);
1981 Match* parentMatch9 = &match;
1982 {
1983 long save = lexer.GetPos();
1984 Match match(false);
1985 if (*lexer == SP)
1986 {
1987 ++lexer;
1988 match.hit = true;
1989 }
1990 *parentMatch9 = match;
1991 if (!match.hit)
1992 {
1993 Match match(false);
1994 Match* parentMatch10 = &match;
1995 lexer.SetPos(save);
1996 {
1997 Match match(false);
1998 if (*lexer == HT)
1999 {
2000 ++lexer;
2001 match.hit = true;
2002 }
2003 *parentMatch10 = match;
2004 }
2005 *parentMatch9 = match;
2006 }
2007 }
2008 *parentMatch8 = match;
2009 }
2010 *parentMatch7 = match;
2011 }
2012 *parentMatch2 = match;
2013 }
2014 *parentMatch1 = match;
2015 }
2016 *parentMatch0 = match;
2017 }
2018 if (match.hit)
2019 {
2020 Match match(true);
2021 Match* parentMatch11 = &match;
2022 while (true)
2023 {
2024 long save = lexer.GetPos();
2025 {
2026 Match match(false);
2027 Match* parentMatch12 = &match;
2028 {
2029 Match match(false);
2030 Match* parentMatch13 = &match;
2031 {
2032 Match match(true);
2033 long save = lexer.GetPos();
2034 Match* parentMatch14 = &match;
2035 {
2036 Match match(false);
2037 Match* parentMatch15 = &match;
2038 {
2039 Match match(false);
2040 Match* parentMatch16 = &match;
2041 {
2042 long save = lexer.GetPos();
2043 Match match(false);
2044 if (*lexer == CR)
2045 {
2046 ++lexer;
2047 match.hit = true;
2048 }
2049 *parentMatch16 = match;
2050 if (!match.hit)
2051 {
2052 Match match(false);
2053 Match* parentMatch17 = &match;
2054 lexer.SetPos(save);
2055 {
2056 Match match(false);
2057 if (*lexer == LF)
2058 {
2059 ++lexer;
2060 match.hit = true;
2061 }
2062 *parentMatch17 = match;
2063 }
2064 *parentMatch16 = match;
2065 }
2066 }
2067 *parentMatch15 = match;
2068 }
2069 if (match.hit)
2070 {
2071 *parentMatch14 = match;
2072 }
2073 else
2074 {
2075 lexer.SetPos(save);
2076 }
2077 }
2078 *parentMatch13 = match;
2079 }
2080 if (match.hit)
2081 {
2082 Match match(false);
2083 Match* parentMatch18 = &match;
2084 {
2085 Match match(false);
2086 Match* parentMatch19 = &match;
2087 {
2088 Match match(false);
2089 Match* parentMatch20 = &match;
2090 {
2091 long save = lexer.GetPos();
2092 Match match(false);
2093 if (*lexer == SP)
2094 {
2095 ++lexer;
2096 match.hit = true;
2097 }
2098 *parentMatch20 = match;
2099 if (!match.hit)
2100 {
2101 Match match(false);
2102 Match* parentMatch21 = &match;
2103 lexer.SetPos(save);
2104 {
2105 Match match(false);
2106 if (*lexer == HT)
2107 {
2108 ++lexer;
2109 match.hit = true;
2110 }
2111 *parentMatch21 = match;
2112 }
2113 *parentMatch20 = match;
2114 }
2115 }
2116 *parentMatch19 = match;
2117 }
2118 *parentMatch18 = match;
2119 }
2120 *parentMatch13 = match;
2121 }
2122 *parentMatch12 = match;
2123 }
2124 if (match.hit)
2125 {
2126 *parentMatch11 = match;
2127 }
2128 else
2129 {
2130 lexer.SetPos(save);
2131 break;
2132 }
2133 }
2134 }
2135 }
2136 #if (DEBUG)
2137 if (writeToLog)
2138 {
2139 if (match.hit)
2140 {
2141 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"lws");
2142 }
2143 else
2144 {
2145 System.Lex.WriteFailureToLog(lexer, u"lws");
2146 }
2147 }
2148 #endif
2149 if (!match.hit)
2150 {
2151 match.value = null;
2152 }
2153 return match;
2154 }
2155 }