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