1 // this file has been generated from 'C:/work/cmajor-mod/cmajor/masm/system/System.XPath/XPath.parser' using SoulCm parser generator scmpg version 5.0.0
   2 
   3 using System;
   4 using System.Lex;
   5 using System.Parsing;
   6 using System;
   7 using System.XPath.Token;
   8 
   9 namespace System.XPath
  10 {
  11     public static class XPathParser<LexerT>
  12     {
  13         public static System.Result<System.UniquePtr<System.XPath.Expr>> Parse(LexerT& lexer)
  14         {
  15             System.UniquePtr<System.XPath.Expr> value;
  16             #if (DEBUG)
  17             if (lexer.Log() != null)
  18             {
  19                 auto result = lexer.Log()->WriteBeginRule(u"parse");
  20                 if (result.Error())
  21                 {
  22                     return System.Result<System.UniquePtr<System.XPath.Expr>>(System.ErrorId(result.GetErrorId()));
  23                 }
  24                 lexer.Log()->IncIndent();
  25             }
  26             #endif
  27             auto incResult0 = ++lexer;
  28             if (incResult0.Error())
  29             {
  30                 return System.Result<System.UniquePtr<System.XPath.Expr>>(System.ErrorId(incResult0.GetErrorId()));
  31             }
  32             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.Expr(lexer);
  33             if (matchResult.Error())
  34             {
  35                 return System.Result<System.UniquePtr<System.XPath.Expr>>(System.ErrorId(matchResult.GetErrorId()));
  36             }
  37             System.Parsing.Match match = matchResult.Value();
  38             value.Reset(cast<System.XPath.Expr*>(match.value));
  39             #if (DEBUG)
  40             if (lexer.Log() != null)
  41             {
  42                 lexer.Log()->DecIndent();
  43                 auto result = lexer.Log()->WriteEndRule(u"parse");
  44                 if (result.Error())
  45                 {
  46                     return System.Result<System.UniquePtr<System.XPath.Expr>>(System.ErrorId(result.GetErrorId()));
  47                 }
  48             }
  49             #endif
  50             if (match.hit)
  51             {
  52                 if (*lexer == System.Lex.END_TOKEN)
  53                 {
  54                     return System.Result<System.UniquePtr<System.XPath.Expr>>(System.Rvalue(value));
  55                 }
  56                 else
  57                 {
  58                     return System.Result<System.UniquePtr<System.XPath.Expr>>(lexer.GetFarthestError());
  59                 }
  60             }
  61             else
  62             {
  63                 return System.Result<System.UniquePtr<System.XPath.Expr>>(lexer.GetFarthestError());
  64             }
  65         }
  66         public static System.Result<System.Parsing.Match> Expr(LexerT& lexer)
  67         {
  68             #if (DEBUG)
  69             long parser_debug_match_pos = 0;
  70             bool parser_debug_write_to_log = lexer.Log() != null;
  71             if (parser_debug_write_to_log)
  72             {
  73                 parser_debug_match_pos = lexer.GetPos();
  74                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"Expr");
  75                 if (result.Error())
  76                 {
  77                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
  78                 }
  79             }
  80             #endif
  81             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434433);
  82             System.UniquePtr<System.XPath.Expr> orExpr;
  83             System.Parsing.Match match(false);
  84             System.Parsing.Match* parentMatch0 = &match;
  85             {
  86                 long pos = lexer.GetPos();
  87                 System.Parsing.Match match(false);
  88                 System.Parsing.Match* parentMatch1 = &match;
  89                 {
  90                     System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.OrExpr(lexer);
  91                     if (matchResult.Error())
  92                     {
  93                         return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
  94                     }
  95                     System.Parsing.Match match = matchResult.Value();
  96                     orExpr.Reset(cast<System.XPath.Expr*>(match.value));
  97                     *parentMatch1 = match;
  98                 }
  99                 if (match.hit)
 100                 {
 101                     #if (DEBUG)
 102                         if (parser_debug_write_to_log)
 103                         {
 104                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Expr");
 105                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 106                         }
 107                     #endif
 108                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueorExpr.Release()));
 109                 }
 110                 *parentMatch0 = match;
 111             }
 112             #if (DEBUG)
 113             if (parser_debug_write_to_log)
 114             {
 115                 if (match.hit)
 116                 {
 117                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Expr");
 118                     if (result.Error())
 119                     {
 120                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 121                     }
 122                 }
 123                 else
 124                 {
 125                     auto result = System.Lex.WriteFailureToLog(lexeru"Expr");
 126                     if (result.Error())
 127                     {
 128                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 129                     }
 130                 }
 131             }
 132             #endif
 133             if (!match.hit)
 134             {
 135                 match.value = null;
 136             }
 137             return System.Result<System.Parsing.Match>(match);
 138         }
 139         public static System.Result<System.Parsing.Match> OrExpr(LexerT& lexer)
 140         {
 141             #if (DEBUG)
 142             long parser_debug_match_pos = 0;
 143             bool parser_debug_write_to_log = lexer.Log() != null;
 144             if (parser_debug_write_to_log)
 145             {
 146                 parser_debug_match_pos = lexer.GetPos();
 147                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"OrExpr");
 148                 if (result.Error())
 149                 {
 150                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 151                 }
 152             }
 153             #endif
 154             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434434);
 155             UniquePtr<System.XPath.Expr> expr = UniquePtr<System.XPath.Expr>();
 156             System.UniquePtr<System.XPath.Expr> left;
 157             System.UniquePtr<System.XPath.Expr> right;
 158             System.Parsing.Match match(false);
 159             System.Parsing.Match* parentMatch0 = &match;
 160             {
 161                 long pos = lexer.GetPos();
 162                 System.Parsing.Match match(false);
 163                 System.Parsing.Match* parentMatch1 = &match;
 164                 {
 165                     System.Parsing.Match match(false);
 166                     System.Parsing.Match* parentMatch2 = &match;
 167                     {
 168                         System.Parsing.Match match(false);
 169                         System.Parsing.Match* parentMatch3 = &match;
 170                         {
 171                             long pos = lexer.GetPos();
 172                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.AndExpr(lexer);
 173                             if (matchResult.Error())
 174                             {
 175                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 176                             }
 177                             System.Parsing.Match match = matchResult.Value();
 178                             left.Reset(cast<System.XPath.Expr*>(match.value));
 179                             if (match.hit)
 180                             {
 181                                 expr.Reset(left.Release());
 182                             }
 183                             *parentMatch3 = match;
 184                         }
 185                         *parentMatch2 = match;
 186                     }
 187                     if (match.hit)
 188                     {
 189                         System.Parsing.Match match(false);
 190                         System.Parsing.Match* parentMatch4 = &match;
 191                         {
 192                             System.Parsing.Match match(true);
 193                             System.Parsing.Match* parentMatch5 = &match;
 194                             {
 195                                 while (true)
 196                                 {
 197                                     long save = lexer.GetPos();
 198                                     {
 199                                         System.Parsing.Match match(false);
 200                                         System.Parsing.Match* parentMatch6 = &match;
 201                                         {
 202                                             System.Parsing.Match match(false);
 203                                             System.Parsing.Match* parentMatch7 = &match;
 204                                             {
 205                                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.OrKeyword(lexer);
 206                                                 if (matchResult.Error())
 207                                                 {
 208                                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 209                                                 }
 210                                                 System.Parsing.Match match = matchResult.Value();
 211                                                 *parentMatch7 = match;
 212                                             }
 213                                             if (match.hit)
 214                                             {
 215                                                 System.Parsing.Match match(false);
 216                                                 System.Parsing.Match* parentMatch8 = &match;
 217                                                 {
 218                                                     System.Parsing.Match match(false);
 219                                                     System.Parsing.Match* parentMatch9 = &match;
 220                                                     {
 221                                                         long pos = lexer.GetPos();
 222                                                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.AndExpr(lexer);
 223                                                         if (matchResult.Error())
 224                                                         {
 225                                                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 226                                                         }
 227                                                         System.Parsing.Match match = matchResult.Value();
 228                                                         right.Reset(cast<System.XPath.Expr*>(match.value));
 229                                                         if (match.hit)
 230                                                         {
 231                                                             expr.Reset(new System.XPath.BinaryExpr(System.XPath.Operator.or_expr.Release()right.Release()));
 232                                                         }
 233                                                         *parentMatch9 = match;
 234                                                     }
 235                                                     *parentMatch8 = match;
 236                                                 }
 237                                                 *parentMatch7 = match;
 238                                             }
 239                                             *parentMatch6 = match;
 240                                         }
 241                                         if (match.hit)
 242                                         {
 243                                             *parentMatch5 = match;
 244                                         }
 245                                         else
 246                                         {
 247                                             lexer.SetPos(save);
 248                                             break;
 249                                         }
 250                                     }
 251                                 }
 252                             }
 253                             *parentMatch4 = match;
 254                         }
 255                         *parentMatch2 = match;
 256                     }
 257                     *parentMatch1 = match;
 258                 }
 259                 if (match.hit)
 260                 {
 261                     #if (DEBUG)
 262                         if (parser_debug_write_to_log)
 263                         {
 264                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"OrExpr");
 265                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 266                         }
 267                     #endif
 268                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueexpr.Release()));
 269                 }
 270                 *parentMatch0 = match;
 271             }
 272             #if (DEBUG)
 273             if (parser_debug_write_to_log)
 274             {
 275                 if (match.hit)
 276                 {
 277                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"OrExpr");
 278                     if (result.Error())
 279                     {
 280                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 281                     }
 282                 }
 283                 else
 284                 {
 285                     auto result = System.Lex.WriteFailureToLog(lexeru"OrExpr");
 286                     if (result.Error())
 287                     {
 288                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 289                     }
 290                 }
 291             }
 292             #endif
 293             if (!match.hit)
 294             {
 295                 match.value = null;
 296             }
 297             return System.Result<System.Parsing.Match>(match);
 298         }
 299         public static System.Result<System.Parsing.Match> AndExpr(LexerT& lexer)
 300         {
 301             #if (DEBUG)
 302             long parser_debug_match_pos = 0;
 303             bool parser_debug_write_to_log = lexer.Log() != null;
 304             if (parser_debug_write_to_log)
 305             {
 306                 parser_debug_match_pos = lexer.GetPos();
 307                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"AndExpr");
 308                 if (result.Error())
 309                 {
 310                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 311                 }
 312             }
 313             #endif
 314             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434435);
 315             UniquePtr<System.XPath.Expr> expr = UniquePtr<System.XPath.Expr>();
 316             System.UniquePtr<System.XPath.Expr> left;
 317             System.UniquePtr<System.XPath.Expr> right;
 318             System.Parsing.Match match(false);
 319             System.Parsing.Match* parentMatch0 = &match;
 320             {
 321                 long pos = lexer.GetPos();
 322                 System.Parsing.Match match(false);
 323                 System.Parsing.Match* parentMatch1 = &match;
 324                 {
 325                     System.Parsing.Match match(false);
 326                     System.Parsing.Match* parentMatch2 = &match;
 327                     {
 328                         System.Parsing.Match match(false);
 329                         System.Parsing.Match* parentMatch3 = &match;
 330                         {
 331                             long pos = lexer.GetPos();
 332                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.EqualityExpr(lexer);
 333                             if (matchResult.Error())
 334                             {
 335                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 336                             }
 337                             System.Parsing.Match match = matchResult.Value();
 338                             left.Reset(cast<System.XPath.Expr*>(match.value));
 339                             if (match.hit)
 340                             {
 341                                 expr.Reset(left.Release());
 342                             }
 343                             *parentMatch3 = match;
 344                         }
 345                         *parentMatch2 = match;
 346                     }
 347                     if (match.hit)
 348                     {
 349                         System.Parsing.Match match(false);
 350                         System.Parsing.Match* parentMatch4 = &match;
 351                         {
 352                             System.Parsing.Match match(true);
 353                             System.Parsing.Match* parentMatch5 = &match;
 354                             {
 355                                 while (true)
 356                                 {
 357                                     long save = lexer.GetPos();
 358                                     {
 359                                         System.Parsing.Match match(false);
 360                                         System.Parsing.Match* parentMatch6 = &match;
 361                                         {
 362                                             System.Parsing.Match match(false);
 363                                             System.Parsing.Match* parentMatch7 = &match;
 364                                             {
 365                                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.AndKeyword(lexer);
 366                                                 if (matchResult.Error())
 367                                                 {
 368                                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 369                                                 }
 370                                                 System.Parsing.Match match = matchResult.Value();
 371                                                 *parentMatch7 = match;
 372                                             }
 373                                             if (match.hit)
 374                                             {
 375                                                 System.Parsing.Match match(false);
 376                                                 System.Parsing.Match* parentMatch8 = &match;
 377                                                 {
 378                                                     System.Parsing.Match match(false);
 379                                                     System.Parsing.Match* parentMatch9 = &match;
 380                                                     {
 381                                                         long pos = lexer.GetPos();
 382                                                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.EqualityExpr(lexer);
 383                                                         if (matchResult.Error())
 384                                                         {
 385                                                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 386                                                         }
 387                                                         System.Parsing.Match match = matchResult.Value();
 388                                                         right.Reset(cast<System.XPath.Expr*>(match.value));
 389                                                         if (match.hit)
 390                                                         {
 391                                                             expr.Reset(new System.XPath.BinaryExpr(System.XPath.Operator.and_expr.Release()right.Release()));
 392                                                         }
 393                                                         *parentMatch9 = match;
 394                                                     }
 395                                                     *parentMatch8 = match;
 396                                                 }
 397                                                 *parentMatch7 = match;
 398                                             }
 399                                             *parentMatch6 = match;
 400                                         }
 401                                         if (match.hit)
 402                                         {
 403                                             *parentMatch5 = match;
 404                                         }
 405                                         else
 406                                         {
 407                                             lexer.SetPos(save);
 408                                             break;
 409                                         }
 410                                     }
 411                                 }
 412                             }
 413                             *parentMatch4 = match;
 414                         }
 415                         *parentMatch2 = match;
 416                     }
 417                     *parentMatch1 = match;
 418                 }
 419                 if (match.hit)
 420                 {
 421                     #if (DEBUG)
 422                         if (parser_debug_write_to_log)
 423                         {
 424                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AndExpr");
 425                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 426                         }
 427                     #endif
 428                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueexpr.Release()));
 429                 }
 430                 *parentMatch0 = match;
 431             }
 432             #if (DEBUG)
 433             if (parser_debug_write_to_log)
 434             {
 435                 if (match.hit)
 436                 {
 437                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AndExpr");
 438                     if (result.Error())
 439                     {
 440                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 441                     }
 442                 }
 443                 else
 444                 {
 445                     auto result = System.Lex.WriteFailureToLog(lexeru"AndExpr");
 446                     if (result.Error())
 447                     {
 448                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 449                     }
 450                 }
 451             }
 452             #endif
 453             if (!match.hit)
 454             {
 455                 match.value = null;
 456             }
 457             return System.Result<System.Parsing.Match>(match);
 458         }
 459         public static System.Result<System.Parsing.Match> EqualityExpr(LexerT& lexer)
 460         {
 461             #if (DEBUG)
 462             long parser_debug_match_pos = 0;
 463             bool parser_debug_write_to_log = lexer.Log() != null;
 464             if (parser_debug_write_to_log)
 465             {
 466                 parser_debug_match_pos = lexer.GetPos();
 467                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"EqualityExpr");
 468                 if (result.Error())
 469                 {
 470                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 471                 }
 472             }
 473             #endif
 474             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434436);
 475             UniquePtr<System.XPath.Expr> expr = UniquePtr<System.XPath.Expr>();
 476             System.UniquePtr<System.XPath.Expr> left;
 477             System.UniquePtr<System.Parsing.Value<System.XPath.Operator>> op;
 478             System.UniquePtr<System.XPath.Expr> right;
 479             System.Parsing.Match match(false);
 480             System.Parsing.Match* parentMatch0 = &match;
 481             {
 482                 long pos = lexer.GetPos();
 483                 System.Parsing.Match match(false);
 484                 System.Parsing.Match* parentMatch1 = &match;
 485                 {
 486                     System.Parsing.Match match(false);
 487                     System.Parsing.Match* parentMatch2 = &match;
 488                     {
 489                         System.Parsing.Match match(false);
 490                         System.Parsing.Match* parentMatch3 = &match;
 491                         {
 492                             long pos = lexer.GetPos();
 493                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.RelationalExpr(lexer);
 494                             if (matchResult.Error())
 495                             {
 496                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 497                             }
 498                             System.Parsing.Match match = matchResult.Value();
 499                             left.Reset(cast<System.XPath.Expr*>(match.value));
 500                             if (match.hit)
 501                             {
 502                                 expr.Reset(left.Release());
 503                             }
 504                             *parentMatch3 = match;
 505                         }
 506                         *parentMatch2 = match;
 507                     }
 508                     if (match.hit)
 509                     {
 510                         System.Parsing.Match match(false);
 511                         System.Parsing.Match* parentMatch4 = &match;
 512                         {
 513                             System.Parsing.Match match(true);
 514                             System.Parsing.Match* parentMatch5 = &match;
 515                             {
 516                                 while (true)
 517                                 {
 518                                     long save = lexer.GetPos();
 519                                     {
 520                                         System.Parsing.Match match(false);
 521                                         System.Parsing.Match* parentMatch6 = &match;
 522                                         {
 523                                             System.Parsing.Match match(false);
 524                                             System.Parsing.Match* parentMatch7 = &match;
 525                                             {
 526                                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.EqualityOp(lexer);
 527                                                 if (matchResult.Error())
 528                                                 {
 529                                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 530                                                 }
 531                                                 System.Parsing.Match match = matchResult.Value();
 532                                                 op.Reset(cast<System.Parsing.Value<System.XPath.Operator>*>(match.value));
 533                                                 *parentMatch7 = match;
 534                                             }
 535                                             if (match.hit)
 536                                             {
 537                                                 System.Parsing.Match match(false);
 538                                                 System.Parsing.Match* parentMatch8 = &match;
 539                                                 {
 540                                                     System.Parsing.Match match(false);
 541                                                     System.Parsing.Match* parentMatch9 = &match;
 542                                                     {
 543                                                         long pos = lexer.GetPos();
 544                                                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.RelationalExpr(lexer);
 545                                                         if (matchResult.Error())
 546                                                         {
 547                                                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 548                                                         }
 549                                                         System.Parsing.Match match = matchResult.Value();
 550                                                         right.Reset(cast<System.XPath.Expr*>(match.value));
 551                                                         if (match.hit)
 552                                                         {
 553                                                             expr.Reset(new System.XPath.BinaryExpr(op->valueexpr.Release()right.Release()));
 554                                                         }
 555                                                         *parentMatch9 = match;
 556                                                     }
 557                                                     *parentMatch8 = match;
 558                                                 }
 559                                                 *parentMatch7 = match;
 560                                             }
 561                                             *parentMatch6 = match;
 562                                         }
 563                                         if (match.hit)
 564                                         {
 565                                             *parentMatch5 = match;
 566                                         }
 567                                         else
 568                                         {
 569                                             lexer.SetPos(save);
 570                                             break;
 571                                         }
 572                                     }
 573                                 }
 574                             }
 575                             *parentMatch4 = match;
 576                         }
 577                         *parentMatch2 = match;
 578                     }
 579                     *parentMatch1 = match;
 580                 }
 581                 if (match.hit)
 582                 {
 583                     #if (DEBUG)
 584                         if (parser_debug_write_to_log)
 585                         {
 586                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"EqualityExpr");
 587                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 588                         }
 589                     #endif
 590                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueexpr.Release()));
 591                 }
 592                 *parentMatch0 = match;
 593             }
 594             #if (DEBUG)
 595             if (parser_debug_write_to_log)
 596             {
 597                 if (match.hit)
 598                 {
 599                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"EqualityExpr");
 600                     if (result.Error())
 601                     {
 602                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 603                     }
 604                 }
 605                 else
 606                 {
 607                     auto result = System.Lex.WriteFailureToLog(lexeru"EqualityExpr");
 608                     if (result.Error())
 609                     {
 610                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 611                     }
 612                 }
 613             }
 614             #endif
 615             if (!match.hit)
 616             {
 617                 match.value = null;
 618             }
 619             return System.Result<System.Parsing.Match>(match);
 620         }
 621         public static System.Result<System.Parsing.Match> RelationalExpr(LexerT& lexer)
 622         {
 623             #if (DEBUG)
 624             long parser_debug_match_pos = 0;
 625             bool parser_debug_write_to_log = lexer.Log() != null;
 626             if (parser_debug_write_to_log)
 627             {
 628                 parser_debug_match_pos = lexer.GetPos();
 629                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"RelationalExpr");
 630                 if (result.Error())
 631                 {
 632                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 633                 }
 634             }
 635             #endif
 636             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434437);
 637             UniquePtr<System.XPath.Expr> expr = UniquePtr<System.XPath.Expr>();
 638             System.UniquePtr<System.XPath.Expr> left;
 639             System.UniquePtr<System.Parsing.Value<System.XPath.Operator>> op;
 640             System.UniquePtr<System.XPath.Expr> right;
 641             System.Parsing.Match match(false);
 642             System.Parsing.Match* parentMatch0 = &match;
 643             {
 644                 long pos = lexer.GetPos();
 645                 System.Parsing.Match match(false);
 646                 System.Parsing.Match* parentMatch1 = &match;
 647                 {
 648                     System.Parsing.Match match(false);
 649                     System.Parsing.Match* parentMatch2 = &match;
 650                     {
 651                         System.Parsing.Match match(false);
 652                         System.Parsing.Match* parentMatch3 = &match;
 653                         {
 654                             long pos = lexer.GetPos();
 655                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.AdditiveExpr(lexer);
 656                             if (matchResult.Error())
 657                             {
 658                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 659                             }
 660                             System.Parsing.Match match = matchResult.Value();
 661                             left.Reset(cast<System.XPath.Expr*>(match.value));
 662                             if (match.hit)
 663                             {
 664                                 expr.Reset(left.Release());
 665                             }
 666                             *parentMatch3 = match;
 667                         }
 668                         *parentMatch2 = match;
 669                     }
 670                     if (match.hit)
 671                     {
 672                         System.Parsing.Match match(false);
 673                         System.Parsing.Match* parentMatch4 = &match;
 674                         {
 675                             System.Parsing.Match match(true);
 676                             System.Parsing.Match* parentMatch5 = &match;
 677                             {
 678                                 while (true)
 679                                 {
 680                                     long save = lexer.GetPos();
 681                                     {
 682                                         System.Parsing.Match match(false);
 683                                         System.Parsing.Match* parentMatch6 = &match;
 684                                         {
 685                                             System.Parsing.Match match(false);
 686                                             System.Parsing.Match* parentMatch7 = &match;
 687                                             {
 688                                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.RelationalOp(lexer);
 689                                                 if (matchResult.Error())
 690                                                 {
 691                                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 692                                                 }
 693                                                 System.Parsing.Match match = matchResult.Value();
 694                                                 op.Reset(cast<System.Parsing.Value<System.XPath.Operator>*>(match.value));
 695                                                 *parentMatch7 = match;
 696                                             }
 697                                             if (match.hit)
 698                                             {
 699                                                 System.Parsing.Match match(false);
 700                                                 System.Parsing.Match* parentMatch8 = &match;
 701                                                 {
 702                                                     System.Parsing.Match match(false);
 703                                                     System.Parsing.Match* parentMatch9 = &match;
 704                                                     {
 705                                                         long pos = lexer.GetPos();
 706                                                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.AdditiveExpr(lexer);
 707                                                         if (matchResult.Error())
 708                                                         {
 709                                                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 710                                                         }
 711                                                         System.Parsing.Match match = matchResult.Value();
 712                                                         right.Reset(cast<System.XPath.Expr*>(match.value));
 713                                                         if (match.hit)
 714                                                         {
 715                                                             expr.Reset(new System.XPath.BinaryExpr(op->valueexpr.Release()right.Release()));
 716                                                         }
 717                                                         *parentMatch9 = match;
 718                                                     }
 719                                                     *parentMatch8 = match;
 720                                                 }
 721                                                 *parentMatch7 = match;
 722                                             }
 723                                             *parentMatch6 = match;
 724                                         }
 725                                         if (match.hit)
 726                                         {
 727                                             *parentMatch5 = match;
 728                                         }
 729                                         else
 730                                         {
 731                                             lexer.SetPos(save);
 732                                             break;
 733                                         }
 734                                     }
 735                                 }
 736                             }
 737                             *parentMatch4 = match;
 738                         }
 739                         *parentMatch2 = match;
 740                     }
 741                     *parentMatch1 = match;
 742                 }
 743                 if (match.hit)
 744                 {
 745                     #if (DEBUG)
 746                         if (parser_debug_write_to_log)
 747                         {
 748                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"RelationalExpr");
 749                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 750                         }
 751                     #endif
 752                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueexpr.Release()));
 753                 }
 754                 *parentMatch0 = match;
 755             }
 756             #if (DEBUG)
 757             if (parser_debug_write_to_log)
 758             {
 759                 if (match.hit)
 760                 {
 761                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"RelationalExpr");
 762                     if (result.Error())
 763                     {
 764                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 765                     }
 766                 }
 767                 else
 768                 {
 769                     auto result = System.Lex.WriteFailureToLog(lexeru"RelationalExpr");
 770                     if (result.Error())
 771                     {
 772                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 773                     }
 774                 }
 775             }
 776             #endif
 777             if (!match.hit)
 778             {
 779                 match.value = null;
 780             }
 781             return System.Result<System.Parsing.Match>(match);
 782         }
 783         public static System.Result<System.Parsing.Match> AdditiveExpr(LexerT& lexer)
 784         {
 785             #if (DEBUG)
 786             long parser_debug_match_pos = 0;
 787             bool parser_debug_write_to_log = lexer.Log() != null;
 788             if (parser_debug_write_to_log)
 789             {
 790                 parser_debug_match_pos = lexer.GetPos();
 791                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"AdditiveExpr");
 792                 if (result.Error())
 793                 {
 794                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 795                 }
 796             }
 797             #endif
 798             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434438);
 799             UniquePtr<System.XPath.Expr> expr = UniquePtr<System.XPath.Expr>();
 800             System.UniquePtr<System.XPath.Expr> left;
 801             System.UniquePtr<System.Parsing.Value<System.XPath.Operator>> op;
 802             System.UniquePtr<System.XPath.Expr> right;
 803             System.Parsing.Match match(false);
 804             System.Parsing.Match* parentMatch0 = &match;
 805             {
 806                 long pos = lexer.GetPos();
 807                 System.Parsing.Match match(false);
 808                 System.Parsing.Match* parentMatch1 = &match;
 809                 {
 810                     System.Parsing.Match match(false);
 811                     System.Parsing.Match* parentMatch2 = &match;
 812                     {
 813                         System.Parsing.Match match(false);
 814                         System.Parsing.Match* parentMatch3 = &match;
 815                         {
 816                             long pos = lexer.GetPos();
 817                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.MultiplicativeExpr(lexer);
 818                             if (matchResult.Error())
 819                             {
 820                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 821                             }
 822                             System.Parsing.Match match = matchResult.Value();
 823                             left.Reset(cast<System.XPath.Expr*>(match.value));
 824                             if (match.hit)
 825                             {
 826                                 expr.Reset(left.Release());
 827                             }
 828                             *parentMatch3 = match;
 829                         }
 830                         *parentMatch2 = match;
 831                     }
 832                     if (match.hit)
 833                     {
 834                         System.Parsing.Match match(false);
 835                         System.Parsing.Match* parentMatch4 = &match;
 836                         {
 837                             System.Parsing.Match match(true);
 838                             System.Parsing.Match* parentMatch5 = &match;
 839                             {
 840                                 while (true)
 841                                 {
 842                                     long save = lexer.GetPos();
 843                                     {
 844                                         System.Parsing.Match match(false);
 845                                         System.Parsing.Match* parentMatch6 = &match;
 846                                         {
 847                                             System.Parsing.Match match(false);
 848                                             System.Parsing.Match* parentMatch7 = &match;
 849                                             {
 850                                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.AdditiveOp(lexer);
 851                                                 if (matchResult.Error())
 852                                                 {
 853                                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 854                                                 }
 855                                                 System.Parsing.Match match = matchResult.Value();
 856                                                 op.Reset(cast<System.Parsing.Value<System.XPath.Operator>*>(match.value));
 857                                                 *parentMatch7 = match;
 858                                             }
 859                                             if (match.hit)
 860                                             {
 861                                                 System.Parsing.Match match(false);
 862                                                 System.Parsing.Match* parentMatch8 = &match;
 863                                                 {
 864                                                     System.Parsing.Match match(false);
 865                                                     System.Parsing.Match* parentMatch9 = &match;
 866                                                     {
 867                                                         long pos = lexer.GetPos();
 868                                                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.MultiplicativeExpr(lexer);
 869                                                         if (matchResult.Error())
 870                                                         {
 871                                                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 872                                                         }
 873                                                         System.Parsing.Match match = matchResult.Value();
 874                                                         right.Reset(cast<System.XPath.Expr*>(match.value));
 875                                                         if (match.hit)
 876                                                         {
 877                                                             expr.Reset(new System.XPath.BinaryExpr(op->valueexpr.Release()right.Release()));
 878                                                         }
 879                                                         *parentMatch9 = match;
 880                                                     }
 881                                                     *parentMatch8 = match;
 882                                                 }
 883                                                 *parentMatch7 = match;
 884                                             }
 885                                             *parentMatch6 = match;
 886                                         }
 887                                         if (match.hit)
 888                                         {
 889                                             *parentMatch5 = match;
 890                                         }
 891                                         else
 892                                         {
 893                                             lexer.SetPos(save);
 894                                             break;
 895                                         }
 896                                     }
 897                                 }
 898                             }
 899                             *parentMatch4 = match;
 900                         }
 901                         *parentMatch2 = match;
 902                     }
 903                     *parentMatch1 = match;
 904                 }
 905                 if (match.hit)
 906                 {
 907                     #if (DEBUG)
 908                         if (parser_debug_write_to_log)
 909                         {
 910                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AdditiveExpr");
 911                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 912                         }
 913                     #endif
 914                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueexpr.Release()));
 915                 }
 916                 *parentMatch0 = match;
 917             }
 918             #if (DEBUG)
 919             if (parser_debug_write_to_log)
 920             {
 921                 if (match.hit)
 922                 {
 923                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AdditiveExpr");
 924                     if (result.Error())
 925                     {
 926                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 927                     }
 928                 }
 929                 else
 930                 {
 931                     auto result = System.Lex.WriteFailureToLog(lexeru"AdditiveExpr");
 932                     if (result.Error())
 933                     {
 934                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 935                     }
 936                 }
 937             }
 938             #endif
 939             if (!match.hit)
 940             {
 941                 match.value = null;
 942             }
 943             return System.Result<System.Parsing.Match>(match);
 944         }
 945         public static System.Result<System.Parsing.Match> MultiplicativeExpr(LexerT& lexer)
 946         {
 947             #if (DEBUG)
 948             long parser_debug_match_pos = 0;
 949             bool parser_debug_write_to_log = lexer.Log() != null;
 950             if (parser_debug_write_to_log)
 951             {
 952                 parser_debug_match_pos = lexer.GetPos();
 953                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"MultiplicativeExpr");
 954                 if (result.Error())
 955                 {
 956                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
 957                 }
 958             }
 959             #endif
 960             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434439);
 961             UniquePtr<System.XPath.Expr> expr = UniquePtr<System.XPath.Expr>();
 962             System.UniquePtr<System.XPath.Expr> left;
 963             System.UniquePtr<System.Parsing.Value<System.XPath.Operator>> op;
 964             System.UniquePtr<System.XPath.Expr> right;
 965             System.Parsing.Match match(false);
 966             System.Parsing.Match* parentMatch0 = &match;
 967             {
 968                 long pos = lexer.GetPos();
 969                 System.Parsing.Match match(false);
 970                 System.Parsing.Match* parentMatch1 = &match;
 971                 {
 972                     System.Parsing.Match match(false);
 973                     System.Parsing.Match* parentMatch2 = &match;
 974                     {
 975                         System.Parsing.Match match(false);
 976                         System.Parsing.Match* parentMatch3 = &match;
 977                         {
 978                             long pos = lexer.GetPos();
 979                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.UnaryExpr(lexer);
 980                             if (matchResult.Error())
 981                             {
 982                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
 983                             }
 984                             System.Parsing.Match match = matchResult.Value();
 985                             left.Reset(cast<System.XPath.Expr*>(match.value));
 986                             if (match.hit)
 987                             {
 988                                 expr.Reset(left.Release());
 989                             }
 990                             *parentMatch3 = match;
 991                         }
 992                         *parentMatch2 = match;
 993                     }
 994                     if (match.hit)
 995                     {
 996                         System.Parsing.Match match(false);
 997                         System.Parsing.Match* parentMatch4 = &match;
 998                         {
 999                             System.Parsing.Match match(true);
1000                             System.Parsing.Match* parentMatch5 = &match;
1001                             {
1002                                 while (true)
1003                                 {
1004                                     long save = lexer.GetPos();
1005                                     {
1006                                         System.Parsing.Match match(false);
1007                                         System.Parsing.Match* parentMatch6 = &match;
1008                                         {
1009                                             System.Parsing.Match match(false);
1010                                             System.Parsing.Match* parentMatch7 = &match;
1011                                             {
1012                                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.MultiplicativeOp(lexer);
1013                                                 if (matchResult.Error())
1014                                                 {
1015                                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1016                                                 }
1017                                                 System.Parsing.Match match = matchResult.Value();
1018                                                 op.Reset(cast<System.Parsing.Value<System.XPath.Operator>*>(match.value));
1019                                                 *parentMatch7 = match;
1020                                             }
1021                                             if (match.hit)
1022                                             {
1023                                                 System.Parsing.Match match(false);
1024                                                 System.Parsing.Match* parentMatch8 = &match;
1025                                                 {
1026                                                     System.Parsing.Match match(false);
1027                                                     System.Parsing.Match* parentMatch9 = &match;
1028                                                     {
1029                                                         long pos = lexer.GetPos();
1030                                                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.UnaryExpr(lexer);
1031                                                         if (matchResult.Error())
1032                                                         {
1033                                                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1034                                                         }
1035                                                         System.Parsing.Match match = matchResult.Value();
1036                                                         right.Reset(cast<System.XPath.Expr*>(match.value));
1037                                                         if (match.hit)
1038                                                         {
1039                                                             expr.Reset(new System.XPath.BinaryExpr(op->valueexpr.Release()right.Release()));
1040                                                         }
1041                                                         *parentMatch9 = match;
1042                                                     }
1043                                                     *parentMatch8 = match;
1044                                                 }
1045                                                 *parentMatch7 = match;
1046                                             }
1047                                             *parentMatch6 = match;
1048                                         }
1049                                         if (match.hit)
1050                                         {
1051                                             *parentMatch5 = match;
1052                                         }
1053                                         else
1054                                         {
1055                                             lexer.SetPos(save);
1056                                             break;
1057                                         }
1058                                     }
1059                                 }
1060                             }
1061                             *parentMatch4 = match;
1062                         }
1063                         *parentMatch2 = match;
1064                     }
1065                     *parentMatch1 = match;
1066                 }
1067                 if (match.hit)
1068                 {
1069                     #if (DEBUG)
1070                         if (parser_debug_write_to_log)
1071                         {
1072                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"MultiplicativeExpr");
1073                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1074                         }
1075                     #endif
1076                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueexpr.Release()));
1077                 }
1078                 *parentMatch0 = match;
1079             }
1080             #if (DEBUG)
1081             if (parser_debug_write_to_log)
1082             {
1083                 if (match.hit)
1084                 {
1085                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"MultiplicativeExpr");
1086                     if (result.Error())
1087                     {
1088                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1089                     }
1090                 }
1091                 else
1092                 {
1093                     auto result = System.Lex.WriteFailureToLog(lexeru"MultiplicativeExpr");
1094                     if (result.Error())
1095                     {
1096                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1097                     }
1098                 }
1099             }
1100             #endif
1101             if (!match.hit)
1102             {
1103                 match.value = null;
1104             }
1105             return System.Result<System.Parsing.Match>(match);
1106         }
1107         public static System.Result<System.Parsing.Match> UnaryExpr(LexerT& lexer)
1108         {
1109             #if (DEBUG)
1110             long parser_debug_match_pos = 0;
1111             bool parser_debug_write_to_log = lexer.Log() != null;
1112             if (parser_debug_write_to_log)
1113             {
1114                 parser_debug_match_pos = lexer.GetPos();
1115                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"UnaryExpr");
1116                 if (result.Error())
1117                 {
1118                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1119                 }
1120             }
1121             #endif
1122             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434440);
1123             System.UniquePtr<System.XPath.Expr> subject;
1124             System.UniquePtr<System.XPath.Expr> unionExpr;
1125             System.Parsing.Match match(false);
1126             System.Parsing.Match* parentMatch0 = &match;
1127             {
1128                 long save = lexer.GetPos();
1129                 System.Parsing.Match match(false);
1130                 System.Parsing.Match* parentMatch1 = &match;
1131                 {
1132                     System.Parsing.Match match(false);
1133                     if (*lexer == MINUS)
1134                     {
1135                         auto incResult0 = ++lexer;
1136                         if (incResult0.Error())
1137                         {
1138                             return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
1139                         }
1140                         match.hit = true;
1141                     }
1142                     *parentMatch1 = match;
1143                 }
1144                 if (match.hit)
1145                 {
1146                     System.Parsing.Match match(false);
1147                     System.Parsing.Match* parentMatch2 = &match;
1148                     {
1149                         System.Parsing.Match match(false);
1150                         System.Parsing.Match* parentMatch3 = &match;
1151                         {
1152                             long pos = lexer.GetPos();
1153                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.UnaryExpr(lexer);
1154                             if (matchResult.Error())
1155                             {
1156                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1157                             }
1158                             System.Parsing.Match match = matchResult.Value();
1159                             subject.Reset(cast<System.XPath.Expr*>(match.value));
1160                             if (match.hit)
1161                             {
1162                                 #if (DEBUG)
1163                                     if (parser_debug_write_to_log)
1164                                     {
1165                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"UnaryExpr");
1166                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1167                                     }
1168                                 #endif
1169                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.UnaryExpr(System.XPath.Operator.minussubject.Release())));
1170                             }
1171                             *parentMatch3 = match;
1172                         }
1173                         *parentMatch2 = match;
1174                     }
1175                     *parentMatch1 = match;
1176                 }
1177                 *parentMatch0 = match;
1178                 if (!match.hit)
1179                 {
1180                     System.Parsing.Match match(false);
1181                     System.Parsing.Match* parentMatch4 = &match;
1182                     lexer.SetPos(save);
1183                     {
1184                         System.Parsing.Match match(false);
1185                         System.Parsing.Match* parentMatch5 = &match;
1186                         {
1187                             long pos = lexer.GetPos();
1188                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.UnionExpr(lexer);
1189                             if (matchResult.Error())
1190                             {
1191                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1192                             }
1193                             System.Parsing.Match match = matchResult.Value();
1194                             unionExpr.Reset(cast<System.XPath.Expr*>(match.value));
1195                             if (match.hit)
1196                             {
1197                                 #if (DEBUG)
1198                                     if (parser_debug_write_to_log)
1199                                     {
1200                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"UnaryExpr");
1201                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1202                                     }
1203                                 #endif
1204                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(trueunionExpr.Release()));
1205                             }
1206                             *parentMatch5 = match;
1207                         }
1208                         *parentMatch4 = match;
1209                     }
1210                     *parentMatch0 = match;
1211                 }
1212             }
1213             #if (DEBUG)
1214             if (parser_debug_write_to_log)
1215             {
1216                 if (match.hit)
1217                 {
1218                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"UnaryExpr");
1219                     if (result.Error())
1220                     {
1221                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1222                     }
1223                 }
1224                 else
1225                 {
1226                     auto result = System.Lex.WriteFailureToLog(lexeru"UnaryExpr");
1227                     if (result.Error())
1228                     {
1229                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1230                     }
1231                 }
1232             }
1233             #endif
1234             if (!match.hit)
1235             {
1236                 match.value = null;
1237             }
1238             return System.Result<System.Parsing.Match>(match);
1239         }
1240         public static System.Result<System.Parsing.Match> UnionExpr(LexerT& lexer)
1241         {
1242             #if (DEBUG)
1243             long parser_debug_match_pos = 0;
1244             bool parser_debug_write_to_log = lexer.Log() != null;
1245             if (parser_debug_write_to_log)
1246             {
1247                 parser_debug_match_pos = lexer.GetPos();
1248                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"UnionExpr");
1249                 if (result.Error())
1250                 {
1251                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1252                 }
1253             }
1254             #endif
1255             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434441);
1256             UniquePtr<System.XPath.Expr> expr = UniquePtr<System.XPath.Expr>();
1257             System.UniquePtr<System.XPath.Expr> left;
1258             System.UniquePtr<System.XPath.Expr> right;
1259             System.Parsing.Match match(false);
1260             System.Parsing.Match* parentMatch0 = &match;
1261             {
1262                 long pos = lexer.GetPos();
1263                 System.Parsing.Match match(false);
1264                 System.Parsing.Match* parentMatch1 = &match;
1265                 {
1266                     System.Parsing.Match match(false);
1267                     System.Parsing.Match* parentMatch2 = &match;
1268                     {
1269                         System.Parsing.Match match(false);
1270                         System.Parsing.Match* parentMatch3 = &match;
1271                         {
1272                             long pos = lexer.GetPos();
1273                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.PathExpr(lexer);
1274                             if (matchResult.Error())
1275                             {
1276                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1277                             }
1278                             System.Parsing.Match match = matchResult.Value();
1279                             left.Reset(cast<System.XPath.Expr*>(match.value));
1280                             if (match.hit)
1281                             {
1282                                 expr.Reset(left.Release());
1283                             }
1284                             *parentMatch3 = match;
1285                         }
1286                         *parentMatch2 = match;
1287                     }
1288                     if (match.hit)
1289                     {
1290                         System.Parsing.Match match(false);
1291                         System.Parsing.Match* parentMatch4 = &match;
1292                         {
1293                             System.Parsing.Match match(true);
1294                             System.Parsing.Match* parentMatch5 = &match;
1295                             {
1296                                 while (true)
1297                                 {
1298                                     long save = lexer.GetPos();
1299                                     {
1300                                         System.Parsing.Match match(false);
1301                                         System.Parsing.Match* parentMatch6 = &match;
1302                                         {
1303                                             System.Parsing.Match match(false);
1304                                             System.Parsing.Match* parentMatch7 = &match;
1305                                             {
1306                                                 System.Parsing.Match match(false);
1307                                                 if (*lexer == UNION)
1308                                                 {
1309                                                     auto incResult0 = ++lexer;
1310                                                     if (incResult0.Error())
1311                                                     {
1312                                                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
1313                                                     }
1314                                                     match.hit = true;
1315                                                 }
1316                                                 *parentMatch7 = match;
1317                                             }
1318                                             if (match.hit)
1319                                             {
1320                                                 System.Parsing.Match match(false);
1321                                                 System.Parsing.Match* parentMatch8 = &match;
1322                                                 {
1323                                                     System.Parsing.Match match(false);
1324                                                     System.Parsing.Match* parentMatch9 = &match;
1325                                                     {
1326                                                         long pos = lexer.GetPos();
1327                                                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.PathExpr(lexer);
1328                                                         if (matchResult.Error())
1329                                                         {
1330                                                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1331                                                         }
1332                                                         System.Parsing.Match match = matchResult.Value();
1333                                                         right.Reset(cast<System.XPath.Expr*>(match.value));
1334                                                         if (match.hit)
1335                                                         {
1336                                                             expr.Reset(new System.XPath.BinaryExpr(System.XPath.Operator.unionexpr.Release()right.Release()));
1337                                                         }
1338                                                         *parentMatch9 = match;
1339                                                     }
1340                                                     *parentMatch8 = match;
1341                                                 }
1342                                                 *parentMatch7 = match;
1343                                             }
1344                                             *parentMatch6 = match;
1345                                         }
1346                                         if (match.hit)
1347                                         {
1348                                             *parentMatch5 = match;
1349                                         }
1350                                         else
1351                                         {
1352                                             lexer.SetPos(save);
1353                                             break;
1354                                         }
1355                                     }
1356                                 }
1357                             }
1358                             *parentMatch4 = match;
1359                         }
1360                         *parentMatch2 = match;
1361                     }
1362                     *parentMatch1 = match;
1363                 }
1364                 if (match.hit)
1365                 {
1366                     #if (DEBUG)
1367                         if (parser_debug_write_to_log)
1368                         {
1369                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"UnionExpr");
1370                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1371                         }
1372                     #endif
1373                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueexpr.Release()));
1374                 }
1375                 *parentMatch0 = match;
1376             }
1377             #if (DEBUG)
1378             if (parser_debug_write_to_log)
1379             {
1380                 if (match.hit)
1381                 {
1382                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"UnionExpr");
1383                     if (result.Error())
1384                     {
1385                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1386                     }
1387                 }
1388                 else
1389                 {
1390                     auto result = System.Lex.WriteFailureToLog(lexeru"UnionExpr");
1391                     if (result.Error())
1392                     {
1393                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1394                     }
1395                 }
1396             }
1397             #endif
1398             if (!match.hit)
1399             {
1400                 match.value = null;
1401             }
1402             return System.Result<System.Parsing.Match>(match);
1403         }
1404         public static System.Result<System.Parsing.Match> PathExpr(LexerT& lexer)
1405         {
1406             #if (DEBUG)
1407             long parser_debug_match_pos = 0;
1408             bool parser_debug_write_to_log = lexer.Log() != null;
1409             if (parser_debug_write_to_log)
1410             {
1411                 parser_debug_match_pos = lexer.GetPos();
1412                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"PathExpr");
1413                 if (result.Error())
1414                 {
1415                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1416                 }
1417             }
1418             #endif
1419             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434442);
1420             UniquePtr<System.XPath.Expr> expr = UniquePtr<System.XPath.Expr>();
1421             System.UniquePtr<System.XPath.Expr> locationPath;
1422             System.UniquePtr<System.XPath.Expr> functionCall;
1423             System.UniquePtr<System.XPath.Expr> filterExpr;
1424             System.UniquePtr<System.Parsing.Value<System.XPath.Operator>> op;
1425             System.UniquePtr<System.XPath.Expr> right;
1426             System.Parsing.Match match(false);
1427             System.Parsing.Match* parentMatch0 = &match;
1428             {
1429                 long save = lexer.GetPos();
1430                 System.Parsing.Match match(false);
1431                 System.Parsing.Match* parentMatch1 = &match;
1432                 {
1433                     System.Parsing.Match match(false);
1434                     System.Parsing.Match* parentMatch2 = &match;
1435                     {
1436                         long pos = lexer.GetPos();
1437                         System.Parsing.Match match(false);
1438                         System.Parsing.Match* parentMatch3 = &match;
1439                         {
1440                             System.Parsing.Match match(false);
1441                             System.Parsing.Match* parentMatch4 = &match;
1442                             long save = lexer.GetPos();
1443                             {
1444                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.LocationPath(lexer);
1445                                 if (matchResult.Error())
1446                                 {
1447                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1448                                 }
1449                                 System.Parsing.Match match = matchResult.Value();
1450                                 locationPath.Reset(cast<System.XPath.Expr*>(match.value));
1451                                 *parentMatch4 = match;
1452                             }
1453                             if (match.hit)
1454                             {
1455                                 System.Parsing.Match match(false);
1456                                 System.Parsing.Match* parentMatch5 = &match;
1457                                 {
1458                                     long tmp = lexer.GetPos();
1459                                     lexer.SetPos(save);
1460                                     save = tmp;
1461                                     System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.FunctionCall(lexer);
1462                                     if (matchResult.Error())
1463                                     {
1464                                         return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1465                                     }
1466                                     System.Parsing.Match match = matchResult.Value();
1467                                     functionCall.Reset(cast<System.XPath.Expr*>(match.value));
1468                                     *parentMatch5 = match;
1469                                 }
1470                                 if (!match.hit)
1471                                 {
1472                                     lexer.SetPos(save);
1473                                 }
1474                                 *parentMatch4 = System.Parsing.Match(!match.hitmatch.value);
1475                             }
1476                             *parentMatch3 = match;
1477                         }
1478                         if (match.hit)
1479                         {
1480                             #if (DEBUG)
1481                                 if (parser_debug_write_to_log)
1482                                 {
1483                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"PathExpr");
1484                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1485                                 }
1486                             #endif
1487                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truelocationPath.Release()));
1488                         }
1489                         *parentMatch2 = match;
1490                     }
1491                     *parentMatch1 = match;
1492                 }
1493                 *parentMatch0 = match;
1494                 if (!match.hit)
1495                 {
1496                     System.Parsing.Match match(false);
1497                     System.Parsing.Match* parentMatch6 = &match;
1498                     lexer.SetPos(save);
1499                     {
1500                         System.Parsing.Match match(false);
1501                         System.Parsing.Match* parentMatch7 = &match;
1502                         {
1503                             System.Parsing.Match match(false);
1504                             System.Parsing.Match* parentMatch8 = &match;
1505                             {
1506                                 System.Parsing.Match match(false);
1507                                 System.Parsing.Match* parentMatch9 = &match;
1508                                 {
1509                                     long pos = lexer.GetPos();
1510                                     System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.FilterExpr(lexer);
1511                                     if (matchResult.Error())
1512                                     {
1513                                         return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1514                                     }
1515                                     System.Parsing.Match match = matchResult.Value();
1516                                     filterExpr.Reset(cast<System.XPath.Expr*>(match.value));
1517                                     if (match.hit)
1518                                     {
1519                                         expr.Reset(filterExpr.Release());
1520                                     }
1521                                     *parentMatch9 = match;
1522                                 }
1523                                 *parentMatch8 = match;
1524                             }
1525                             if (match.hit)
1526                             {
1527                                 System.Parsing.Match match(false);
1528                                 System.Parsing.Match* parentMatch10 = &match;
1529                                 {
1530                                     System.Parsing.Match match(false);
1531                                     System.Parsing.Match* parentMatch11 = &match;
1532                                     {
1533                                         long pos = lexer.GetPos();
1534                                         System.Parsing.Match match(false);
1535                                         System.Parsing.Match* parentMatch12 = &match;
1536                                         {
1537                                             System.Parsing.Match match(true);
1538                                             long save = lexer.GetPos();
1539                                             System.Parsing.Match* parentMatch13 = &match;
1540                                             {
1541                                                 System.Parsing.Match match(false);
1542                                                 System.Parsing.Match* parentMatch14 = &match;
1543                                                 {
1544                                                     System.Parsing.Match match(false);
1545                                                     System.Parsing.Match* parentMatch15 = &match;
1546                                                     {
1547                                                         long pos = lexer.GetPos();
1548                                                         System.Parsing.Match match(false);
1549                                                         System.Parsing.Match* parentMatch16 = &match;
1550                                                         {
1551                                                             System.Parsing.Match match(false);
1552                                                             System.Parsing.Match* parentMatch17 = &match;
1553                                                             {
1554                                                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.CombinePathOp(lexer);
1555                                                                 if (matchResult.Error())
1556                                                                 {
1557                                                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1558                                                                 }
1559                                                                 System.Parsing.Match match = matchResult.Value();
1560                                                                 op.Reset(cast<System.Parsing.Value<System.XPath.Operator>*>(match.value));
1561                                                                 *parentMatch17 = match;
1562                                                             }
1563                                                             if (match.hit)
1564                                                             {
1565                                                                 System.Parsing.Match match(false);
1566                                                                 System.Parsing.Match* parentMatch18 = &match;
1567                                                                 {
1568                                                                     System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.RelativeLocationPath(lexer);
1569                                                                     if (matchResult.Error())
1570                                                                     {
1571                                                                         return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1572                                                                     }
1573                                                                     System.Parsing.Match match = matchResult.Value();
1574                                                                     right.Reset(cast<System.XPath.Expr*>(match.value));
1575                                                                     *parentMatch18 = match;
1576                                                                 }
1577                                                                 *parentMatch17 = match;
1578                                                             }
1579                                                             *parentMatch16 = match;
1580                                                         }
1581                                                         if (match.hit)
1582                                                         {
1583                                                             switch (op->value)
1584                                                             {
1585                                                                 case System.XPath.Operator.slash:
1586                                                                 {
1587                                                                     #if (DEBUG)
1588                                                                         if (parser_debug_write_to_log)
1589                                                                         {
1590                                                                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"PathExpr");
1591                                                                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1592                                                                         }
1593                                                                     #endif
1594                                                                     return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.BinaryExpr(System.XPath.Operator.slashexpr.Release()right.Release())));
1595                                                                 }
1596                                                                 case System.XPath.Operator.slashSlash:
1597                                                                 {
1598                                                                     #if (DEBUG)
1599                                                                         if (parser_debug_write_to_log)
1600                                                                         {
1601                                                                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"PathExpr");
1602                                                                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1603                                                                         }
1604                                                                     #endif
1605                                                                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueSystem.XPath.MakeSlashSlashExpr(expr.Release()right.Release())));
1606                                                                 }
1607                                                             }
1608                                                         }
1609                                                         *parentMatch15 = match;
1610                                                     }
1611                                                     *parentMatch14 = match;
1612                                                 }
1613                                                 if (match.hit)
1614                                                 {
1615                                                     *parentMatch13 = match;
1616                                                 }
1617                                                 else
1618                                                 {
1619                                                     lexer.SetPos(save);
1620                                                 }
1621                                             }
1622                                             *parentMatch12 = match;
1623                                         }
1624                                         if (match.hit)
1625                                         {
1626                                             #if (DEBUG)
1627                                                 if (parser_debug_write_to_log)
1628                                                 {
1629                                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"PathExpr");
1630                                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1631                                                 }
1632                                             #endif
1633                                             return System.Result<System.Parsing.Match>(System.Parsing.Match(trueexpr.Release()));
1634                                         }
1635                                         *parentMatch11 = match;
1636                                     }
1637                                     *parentMatch10 = match;
1638                                 }
1639                                 *parentMatch8 = match;
1640                             }
1641                             *parentMatch7 = match;
1642                         }
1643                         *parentMatch6 = match;
1644                     }
1645                     *parentMatch0 = match;
1646                 }
1647             }
1648             #if (DEBUG)
1649             if (parser_debug_write_to_log)
1650             {
1651                 if (match.hit)
1652                 {
1653                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"PathExpr");
1654                     if (result.Error())
1655                     {
1656                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1657                     }
1658                 }
1659                 else
1660                 {
1661                     auto result = System.Lex.WriteFailureToLog(lexeru"PathExpr");
1662                     if (result.Error())
1663                     {
1664                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1665                     }
1666                 }
1667             }
1668             #endif
1669             if (!match.hit)
1670             {
1671                 match.value = null;
1672             }
1673             return System.Result<System.Parsing.Match>(match);
1674         }
1675         public static System.Result<System.Parsing.Match> LocationPath(LexerT& lexer)
1676         {
1677             #if (DEBUG)
1678             long parser_debug_match_pos = 0;
1679             bool parser_debug_write_to_log = lexer.Log() != null;
1680             if (parser_debug_write_to_log)
1681             {
1682                 parser_debug_match_pos = lexer.GetPos();
1683                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"LocationPath");
1684                 if (result.Error())
1685                 {
1686                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1687                 }
1688             }
1689             #endif
1690             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434443);
1691             System.UniquePtr<System.XPath.Expr> absoluteLocationPath;
1692             System.UniquePtr<System.XPath.Expr> relativeLocationPath;
1693             System.Parsing.Match match(false);
1694             System.Parsing.Match* parentMatch0 = &match;
1695             {
1696                 long save = lexer.GetPos();
1697                 System.Parsing.Match match(false);
1698                 System.Parsing.Match* parentMatch1 = &match;
1699                 {
1700                     long pos = lexer.GetPos();
1701                     System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.AbsoluteLocationPath(lexer);
1702                     if (matchResult.Error())
1703                     {
1704                         return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1705                     }
1706                     System.Parsing.Match match = matchResult.Value();
1707                     absoluteLocationPath.Reset(cast<System.XPath.Expr*>(match.value));
1708                     if (match.hit)
1709                     {
1710                         #if (DEBUG)
1711                             if (parser_debug_write_to_log)
1712                             {
1713                                 auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"LocationPath");
1714                                 if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1715                             }
1716                         #endif
1717                         return System.Result<System.Parsing.Match>(System.Parsing.Match(trueabsoluteLocationPath.Release()));
1718                     }
1719                     *parentMatch1 = match;
1720                 }
1721                 *parentMatch0 = match;
1722                 if (!match.hit)
1723                 {
1724                     System.Parsing.Match match(false);
1725                     System.Parsing.Match* parentMatch2 = &match;
1726                     lexer.SetPos(save);
1727                     {
1728                         System.Parsing.Match match(false);
1729                         System.Parsing.Match* parentMatch3 = &match;
1730                         {
1731                             long pos = lexer.GetPos();
1732                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.RelativeLocationPath(lexer);
1733                             if (matchResult.Error())
1734                             {
1735                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1736                             }
1737                             System.Parsing.Match match = matchResult.Value();
1738                             relativeLocationPath.Reset(cast<System.XPath.Expr*>(match.value));
1739                             if (match.hit)
1740                             {
1741                                 #if (DEBUG)
1742                                     if (parser_debug_write_to_log)
1743                                     {
1744                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"LocationPath");
1745                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1746                                     }
1747                                 #endif
1748                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(truerelativeLocationPath.Release()));
1749                             }
1750                             *parentMatch3 = match;
1751                         }
1752                         *parentMatch2 = match;
1753                     }
1754                     *parentMatch0 = match;
1755                 }
1756             }
1757             #if (DEBUG)
1758             if (parser_debug_write_to_log)
1759             {
1760                 if (match.hit)
1761                 {
1762                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"LocationPath");
1763                     if (result.Error())
1764                     {
1765                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1766                     }
1767                 }
1768                 else
1769                 {
1770                     auto result = System.Lex.WriteFailureToLog(lexeru"LocationPath");
1771                     if (result.Error())
1772                     {
1773                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1774                     }
1775                 }
1776             }
1777             #endif
1778             if (!match.hit)
1779             {
1780                 match.value = null;
1781             }
1782             return System.Result<System.Parsing.Match>(match);
1783         }
1784         public static System.Result<System.Parsing.Match> AbsoluteLocationPath(LexerT& lexer)
1785         {
1786             #if (DEBUG)
1787             long parser_debug_match_pos = 0;
1788             bool parser_debug_write_to_log = lexer.Log() != null;
1789             if (parser_debug_write_to_log)
1790             {
1791                 parser_debug_match_pos = lexer.GetPos();
1792                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"AbsoluteLocationPath");
1793                 if (result.Error())
1794                 {
1795                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1796                 }
1797             }
1798             #endif
1799             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434444);
1800             UniquePtr<System.XPath.Expr> expr = UniquePtr<System.XPath.Expr>();
1801             System.UniquePtr<System.XPath.Expr> abbreviatedAbsoluteLocationPath;
1802             System.UniquePtr<System.XPath.Expr> right;
1803             System.Parsing.Match match(false);
1804             System.Parsing.Match* parentMatch0 = &match;
1805             {
1806                 long pos = lexer.GetPos();
1807                 System.Parsing.Match match(false);
1808                 System.Parsing.Match* parentMatch1 = &match;
1809                 {
1810                     System.Parsing.Match match(false);
1811                     System.Parsing.Match* parentMatch2 = &match;
1812                     switch (*lexer)
1813                     {
1814                         case SLASH_SLASH:
1815                         {
1816                             System.Parsing.Match match(false);
1817                             System.Parsing.Match* parentMatch3 = &match;
1818                             {
1819                                 long pos = lexer.GetPos();
1820                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.AbbreviatedAbsoluteLocationPath(lexer);
1821                                 if (matchResult.Error())
1822                                 {
1823                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1824                                 }
1825                                 System.Parsing.Match match = matchResult.Value();
1826                                 abbreviatedAbsoluteLocationPath.Reset(cast<System.XPath.Expr*>(match.value));
1827                                 if (match.hit)
1828                                 {
1829                                     expr.Reset(abbreviatedAbsoluteLocationPath.Release());
1830                                 }
1831                                 *parentMatch3 = match;
1832                             }
1833                             if (match.hit)
1834                             {
1835                                 *parentMatch2 = match;
1836                             }
1837                             break;
1838                         }
1839                         case SLASH:
1840                         {
1841                             System.Parsing.Match match(false);
1842                             System.Parsing.Match* parentMatch4 = &match;
1843                             {
1844                                 System.Parsing.Match match(false);
1845                                 System.Parsing.Match* parentMatch5 = &match;
1846                                 {
1847                                     long pos = lexer.GetPos();
1848                                     System.Parsing.Match match(false);
1849                                     if (*lexer == SLASH)
1850                                     {
1851                                         auto incResult0 = ++lexer;
1852                                         if (incResult0.Error())
1853                                         {
1854                                             return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
1855                                         }
1856                                         match.hit = true;
1857                                     }
1858                                     if (match.hit)
1859                                     {
1860                                         expr.Reset(new System.XPath.Root());
1861                                     }
1862                                     *parentMatch5 = match;
1863                                 }
1864                                 *parentMatch4 = match;
1865                             }
1866                             if (match.hit)
1867                             {
1868                                 System.Parsing.Match match(false);
1869                                 System.Parsing.Match* parentMatch6 = &match;
1870                                 {
1871                                     System.Parsing.Match match(true);
1872                                     long save = lexer.GetPos();
1873                                     System.Parsing.Match* parentMatch7 = &match;
1874                                     {
1875                                         System.Parsing.Match match(false);
1876                                         System.Parsing.Match* parentMatch8 = &match;
1877                                         {
1878                                             System.Parsing.Match match(false);
1879                                             System.Parsing.Match* parentMatch9 = &match;
1880                                             {
1881                                                 long pos = lexer.GetPos();
1882                                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.RelativeLocationPath(lexer);
1883                                                 if (matchResult.Error())
1884                                                 {
1885                                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
1886                                                 }
1887                                                 System.Parsing.Match match = matchResult.Value();
1888                                                 right.Reset(cast<System.XPath.Expr*>(match.value));
1889                                                 if (match.hit)
1890                                                 {
1891                                                     expr.Reset(new System.XPath.BinaryExpr(System.XPath.Operator.slashexpr.Release()right.Release()));
1892                                                 }
1893                                                 *parentMatch9 = match;
1894                                             }
1895                                             *parentMatch8 = match;
1896                                         }
1897                                         if (match.hit)
1898                                         {
1899                                             *parentMatch7 = match;
1900                                         }
1901                                         else
1902                                         {
1903                                             lexer.SetPos(save);
1904                                         }
1905                                     }
1906                                     *parentMatch6 = match;
1907                                 }
1908                                 *parentMatch4 = match;
1909                             }
1910                             if (match.hit)
1911                             {
1912                                 *parentMatch2 = match;
1913                             }
1914                             break;
1915                         }
1916                     }
1917                     *parentMatch1 = match;
1918                 }
1919                 if (match.hit)
1920                 {
1921                     #if (DEBUG)
1922                         if (parser_debug_write_to_log)
1923                         {
1924                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AbsoluteLocationPath");
1925                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1926                         }
1927                     #endif
1928                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueexpr.Release()));
1929                 }
1930                 *parentMatch0 = match;
1931             }
1932             #if (DEBUG)
1933             if (parser_debug_write_to_log)
1934             {
1935                 if (match.hit)
1936                 {
1937                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AbsoluteLocationPath");
1938                     if (result.Error())
1939                     {
1940                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1941                     }
1942                 }
1943                 else
1944                 {
1945                     auto result = System.Lex.WriteFailureToLog(lexeru"AbsoluteLocationPath");
1946                     if (result.Error())
1947                     {
1948                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1949                     }
1950                 }
1951             }
1952             #endif
1953             if (!match.hit)
1954             {
1955                 match.value = null;
1956             }
1957             return System.Result<System.Parsing.Match>(match);
1958         }
1959         public static System.Result<System.Parsing.Match> AbbreviatedAbsoluteLocationPath(LexerT& lexer)
1960         {
1961             #if (DEBUG)
1962             long parser_debug_match_pos = 0;
1963             bool parser_debug_write_to_log = lexer.Log() != null;
1964             if (parser_debug_write_to_log)
1965             {
1966                 parser_debug_match_pos = lexer.GetPos();
1967                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"AbbreviatedAbsoluteLocationPath");
1968                 if (result.Error())
1969                 {
1970                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
1971                 }
1972             }
1973             #endif
1974             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434445);
1975             System.UniquePtr<System.XPath.Expr> right;
1976             System.Parsing.Match match(false);
1977             System.Parsing.Match* parentMatch0 = &match;
1978             {
1979                 System.Parsing.Match match(false);
1980                 if (*lexer == SLASH_SLASH)
1981                 {
1982                     auto incResult0 = ++lexer;
1983                     if (incResult0.Error())
1984                     {
1985                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
1986                     }
1987                     match.hit = true;
1988                 }
1989                 *parentMatch0 = match;
1990             }
1991             if (match.hit)
1992             {
1993                 System.Parsing.Match match(false);
1994                 System.Parsing.Match* parentMatch1 = &match;
1995                 {
1996                     System.Parsing.Match match(false);
1997                     System.Parsing.Match* parentMatch2 = &match;
1998                     {
1999                         long pos = lexer.GetPos();
2000                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.RelativeLocationPath(lexer);
2001                         if (matchResult.Error())
2002                         {
2003                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
2004                         }
2005                         System.Parsing.Match match = matchResult.Value();
2006                         right.Reset(cast<System.XPath.Expr*>(match.value));
2007                         if (match.hit)
2008                         {
2009                             #if (DEBUG)
2010                                 if (parser_debug_write_to_log)
2011                                 {
2012                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AbbreviatedAbsoluteLocationPath");
2013                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2014                                 }
2015                             #endif
2016                             return System.Result<System.Parsing.Match>(System.Parsing.Match(trueSystem.XPath.MakeSlashSlashExpr(new System.XPath.Root()right.Release())));
2017                         }
2018                         *parentMatch2 = match;
2019                     }
2020                     *parentMatch1 = match;
2021                 }
2022                 *parentMatch0 = match;
2023             }
2024             #if (DEBUG)
2025             if (parser_debug_write_to_log)
2026             {
2027                 if (match.hit)
2028                 {
2029                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AbbreviatedAbsoluteLocationPath");
2030                     if (result.Error())
2031                     {
2032                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2033                     }
2034                 }
2035                 else
2036                 {
2037                     auto result = System.Lex.WriteFailureToLog(lexeru"AbbreviatedAbsoluteLocationPath");
2038                     if (result.Error())
2039                     {
2040                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2041                     }
2042                 }
2043             }
2044             #endif
2045             if (!match.hit)
2046             {
2047                 match.value = null;
2048             }
2049             return System.Result<System.Parsing.Match>(match);
2050         }
2051         public static System.Result<System.Parsing.Match> RelativeLocationPath(LexerT& lexer)
2052         {
2053             #if (DEBUG)
2054             long parser_debug_match_pos = 0;
2055             bool parser_debug_write_to_log = lexer.Log() != null;
2056             if (parser_debug_write_to_log)
2057             {
2058                 parser_debug_match_pos = lexer.GetPos();
2059                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"RelativeLocationPath");
2060                 if (result.Error())
2061                 {
2062                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2063                 }
2064             }
2065             #endif
2066             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434446);
2067             UniquePtr<System.XPath.Expr> expr = UniquePtr<System.XPath.Expr>();
2068             System.UniquePtr<System.XPath.Expr> left;
2069             System.UniquePtr<System.Parsing.Value<System.XPath.Operator>> op;
2070             System.UniquePtr<System.XPath.Expr> right;
2071             System.Parsing.Match match(false);
2072             System.Parsing.Match* parentMatch0 = &match;
2073             {
2074                 long pos = lexer.GetPos();
2075                 System.Parsing.Match match(false);
2076                 System.Parsing.Match* parentMatch1 = &match;
2077                 {
2078                     System.Parsing.Match match(false);
2079                     System.Parsing.Match* parentMatch2 = &match;
2080                     {
2081                         System.Parsing.Match match(false);
2082                         System.Parsing.Match* parentMatch3 = &match;
2083                         {
2084                             long pos = lexer.GetPos();
2085                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.Step(lexer);
2086                             if (matchResult.Error())
2087                             {
2088                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
2089                             }
2090                             System.Parsing.Match match = matchResult.Value();
2091                             left.Reset(cast<System.XPath.Expr*>(match.value));
2092                             if (match.hit)
2093                             {
2094                                 expr.Reset(left.Release());
2095                             }
2096                             *parentMatch3 = match;
2097                         }
2098                         *parentMatch2 = match;
2099                     }
2100                     if (match.hit)
2101                     {
2102                         System.Parsing.Match match(false);
2103                         System.Parsing.Match* parentMatch4 = &match;
2104                         {
2105                             System.Parsing.Match match(true);
2106                             System.Parsing.Match* parentMatch5 = &match;
2107                             {
2108                                 while (true)
2109                                 {
2110                                     long save = lexer.GetPos();
2111                                     {
2112                                         System.Parsing.Match match(false);
2113                                         System.Parsing.Match* parentMatch6 = &match;
2114                                         {
2115                                             System.Parsing.Match match(false);
2116                                             System.Parsing.Match* parentMatch7 = &match;
2117                                             {
2118                                                 long pos = lexer.GetPos();
2119                                                 System.Parsing.Match match(false);
2120                                                 System.Parsing.Match* parentMatch8 = &match;
2121                                                 {
2122                                                     System.Parsing.Match match(false);
2123                                                     System.Parsing.Match* parentMatch9 = &match;
2124                                                     {
2125                                                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.CombinePathOp(lexer);
2126                                                         if (matchResult.Error())
2127                                                         {
2128                                                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
2129                                                         }
2130                                                         System.Parsing.Match match = matchResult.Value();
2131                                                         op.Reset(cast<System.Parsing.Value<System.XPath.Operator>*>(match.value));
2132                                                         *parentMatch9 = match;
2133                                                     }
2134                                                     if (match.hit)
2135                                                     {
2136                                                         System.Parsing.Match match(false);
2137                                                         System.Parsing.Match* parentMatch10 = &match;
2138                                                         {
2139                                                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.Step(lexer);
2140                                                             if (matchResult.Error())
2141                                                             {
2142                                                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
2143                                                             }
2144                                                             System.Parsing.Match match = matchResult.Value();
2145                                                             right.Reset(cast<System.XPath.Expr*>(match.value));
2146                                                             *parentMatch10 = match;
2147                                                         }
2148                                                         *parentMatch9 = match;
2149                                                     }
2150                                                     *parentMatch8 = match;
2151                                                 }
2152                                                 if (match.hit)
2153                                                 {
2154                                                     switch (op->value)
2155                                                     {
2156                                                         case System.XPath.Operator.slash:
2157                                                         {
2158                                                             expr.Reset(new System.XPath.BinaryExpr(System.XPath.Operator.slashexpr.Release()right.Release()));
2159                                                             break;
2160                                                         }
2161                                                         case System.XPath.Operator.slashSlash:
2162                                                         {
2163                                                             expr.Reset(System.XPath.MakeSlashSlashExpr(expr.Release()right.Release()));
2164                                                             break;
2165                                                         }
2166                                                     }
2167                                                 }
2168                                                 *parentMatch7 = match;
2169                                             }
2170                                             *parentMatch6 = match;
2171                                         }
2172                                         if (match.hit)
2173                                         {
2174                                             *parentMatch5 = match;
2175                                         }
2176                                         else
2177                                         {
2178                                             lexer.SetPos(save);
2179                                             break;
2180                                         }
2181                                     }
2182                                 }
2183                             }
2184                             *parentMatch4 = match;
2185                         }
2186                         *parentMatch2 = match;
2187                     }
2188                     *parentMatch1 = match;
2189                 }
2190                 if (match.hit)
2191                 {
2192                     #if (DEBUG)
2193                         if (parser_debug_write_to_log)
2194                         {
2195                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"RelativeLocationPath");
2196                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2197                         }
2198                     #endif
2199                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueexpr.Release()));
2200                 }
2201                 *parentMatch0 = match;
2202             }
2203             #if (DEBUG)
2204             if (parser_debug_write_to_log)
2205             {
2206                 if (match.hit)
2207                 {
2208                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"RelativeLocationPath");
2209                     if (result.Error())
2210                     {
2211                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2212                     }
2213                 }
2214                 else
2215                 {
2216                     auto result = System.Lex.WriteFailureToLog(lexeru"RelativeLocationPath");
2217                     if (result.Error())
2218                     {
2219                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2220                     }
2221                 }
2222             }
2223             #endif
2224             if (!match.hit)
2225             {
2226                 match.value = null;
2227             }
2228             return System.Result<System.Parsing.Match>(match);
2229         }
2230         public static System.Result<System.Parsing.Match> Step(LexerT& lexer)
2231         {
2232             #if (DEBUG)
2233             long parser_debug_match_pos = 0;
2234             bool parser_debug_write_to_log = lexer.Log() != null;
2235             if (parser_debug_write_to_log)
2236             {
2237                 parser_debug_match_pos = lexer.GetPos();
2238                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"Step");
2239                 if (result.Error())
2240                 {
2241                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2242                 }
2243             }
2244             #endif
2245             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434447);
2246             UniquePtr<System.XPath.LocationStepExpr> expr = UniquePtr<System.XPath.LocationStepExpr>();
2247             System.UniquePtr<System.Parsing.Value<System.Xml.Axis>> axis;
2248             System.UniquePtr<System.XPath.NodeTest> nodeTest;
2249             System.UniquePtr<System.XPath.Expr> predicate;
2250             System.UniquePtr<System.XPath.LocationStepExpr> abbreviatedStep;
2251             System.Parsing.Match match(false);
2252             System.Parsing.Match* parentMatch0 = &match;
2253             {
2254                 long pos = lexer.GetPos();
2255                 System.Parsing.Match match(false);
2256                 System.Parsing.Match* parentMatch1 = &match;
2257                 {
2258                     System.Parsing.Match match(false);
2259                     System.Parsing.Match* parentMatch2 = &match;
2260                     {
2261                         long save = lexer.GetPos();
2262                         System.Parsing.Match match(false);
2263                         System.Parsing.Match* parentMatch3 = &match;
2264                         {
2265                             System.Parsing.Match match(false);
2266                             System.Parsing.Match* parentMatch4 = &match;
2267                             {
2268                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.AxisSpecifier(lexer);
2269                                 if (matchResult.Error())
2270                                 {
2271                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
2272                                 }
2273                                 System.Parsing.Match match = matchResult.Value();
2274                                 axis.Reset(cast<System.Parsing.Value<System.Xml.Axis>*>(match.value));
2275                                 *parentMatch4 = match;
2276                             }
2277                             if (match.hit)
2278                             {
2279                                 System.Parsing.Match match(false);
2280                                 System.Parsing.Match* parentMatch5 = &match;
2281                                 {
2282                                     System.Parsing.Match match(false);
2283                                     System.Parsing.Match* parentMatch6 = &match;
2284                                     {
2285                                         long pos = lexer.GetPos();
2286                                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.NodeTest(lexer);
2287                                         if (matchResult.Error())
2288                                         {
2289                                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
2290                                         }
2291                                         System.Parsing.Match match = matchResult.Value();
2292                                         nodeTest.Reset(cast<System.XPath.NodeTest*>(match.value));
2293                                         if (match.hit)
2294                                         {
2295                                             expr.Reset(new System.XPath.LocationStepExpr(axis->valuenodeTest.Release()));
2296                                         }
2297                                         *parentMatch6 = match;
2298                                     }
2299                                     *parentMatch5 = match;
2300                                 }
2301                                 *parentMatch4 = match;
2302                             }
2303                             *parentMatch3 = match;
2304                         }
2305                         if (match.hit)
2306                         {
2307                             System.Parsing.Match match(false);
2308                             System.Parsing.Match* parentMatch7 = &match;
2309                             {
2310                                 System.Parsing.Match match(true);
2311                                 System.Parsing.Match* parentMatch8 = &match;
2312                                 {
2313                                     while (true)
2314                                     {
2315                                         long save = lexer.GetPos();
2316                                         {
2317                                             System.Parsing.Match match(false);
2318                                             System.Parsing.Match* parentMatch9 = &match;
2319                                             {
2320                                                 System.Parsing.Match match(false);
2321                                                 System.Parsing.Match* parentMatch10 = &match;
2322                                                 {
2323                                                     long pos = lexer.GetPos();
2324                                                     System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.Predicate(lexer);
2325                                                     if (matchResult.Error())
2326                                                     {
2327                                                         return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
2328                                                     }
2329                                                     System.Parsing.Match match = matchResult.Value();
2330                                                     predicate.Reset(cast<System.XPath.Expr*>(match.value));
2331                                                     if (match.hit)
2332                                                     {
2333                                                         expr->AddPredicate(predicate.Release());
2334                                                     }
2335                                                     *parentMatch10 = match;
2336                                                 }
2337                                                 *parentMatch9 = match;
2338                                             }
2339                                             if (match.hit)
2340                                             {
2341                                                 *parentMatch8 = match;
2342                                             }
2343                                             else
2344                                             {
2345                                                 lexer.SetPos(save);
2346                                                 break;
2347                                             }
2348                                         }
2349                                     }
2350                                 }
2351                                 *parentMatch7 = match;
2352                             }
2353                             *parentMatch3 = match;
2354                         }
2355                         *parentMatch2 = match;
2356                         if (!match.hit)
2357                         {
2358                             System.Parsing.Match match(false);
2359                             System.Parsing.Match* parentMatch11 = &match;
2360                             lexer.SetPos(save);
2361                             {
2362                                 System.Parsing.Match match(false);
2363                                 System.Parsing.Match* parentMatch12 = &match;
2364                                 {
2365                                     long pos = lexer.GetPos();
2366                                     System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.AbbreviatedStep(lexer);
2367                                     if (matchResult.Error())
2368                                     {
2369                                         return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
2370                                     }
2371                                     System.Parsing.Match match = matchResult.Value();
2372                                     abbreviatedStep.Reset(cast<System.XPath.LocationStepExpr*>(match.value));
2373                                     if (match.hit)
2374                                     {
2375                                         expr.Reset(abbreviatedStep.Release());
2376                                     }
2377                                     *parentMatch12 = match;
2378                                 }
2379                                 *parentMatch11 = match;
2380                             }
2381                             *parentMatch2 = match;
2382                         }
2383                     }
2384                     *parentMatch1 = match;
2385                 }
2386                 if (match.hit)
2387                 {
2388                     #if (DEBUG)
2389                         if (parser_debug_write_to_log)
2390                         {
2391                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Step");
2392                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2393                         }
2394                     #endif
2395                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueexpr.Release()));
2396                 }
2397                 *parentMatch0 = match;
2398             }
2399             #if (DEBUG)
2400             if (parser_debug_write_to_log)
2401             {
2402                 if (match.hit)
2403                 {
2404                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Step");
2405                     if (result.Error())
2406                     {
2407                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2408                     }
2409                 }
2410                 else
2411                 {
2412                     auto result = System.Lex.WriteFailureToLog(lexeru"Step");
2413                     if (result.Error())
2414                     {
2415                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2416                     }
2417                 }
2418             }
2419             #endif
2420             if (!match.hit)
2421             {
2422                 match.value = null;
2423             }
2424             return System.Result<System.Parsing.Match>(match);
2425         }
2426         public static System.Result<System.Parsing.Match> AxisSpecifier(LexerT& lexer)
2427         {
2428             #if (DEBUG)
2429             long parser_debug_match_pos = 0;
2430             bool parser_debug_write_to_log = lexer.Log() != null;
2431             if (parser_debug_write_to_log)
2432             {
2433                 parser_debug_match_pos = lexer.GetPos();
2434                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"AxisSpecifier");
2435                 if (result.Error())
2436                 {
2437                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2438                 }
2439             }
2440             #endif
2441             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434448);
2442             System.UniquePtr<System.Parsing.Value<System.Xml.Axis>> axis;
2443             System.UniquePtr<System.Parsing.Value<System.Xml.Axis>> abbreviatedAxisSpecifier;
2444             System.Parsing.Match match(false);
2445             System.Parsing.Match* parentMatch0 = &match;
2446             {
2447                 long save = lexer.GetPos();
2448                 System.Parsing.Match match(false);
2449                 System.Parsing.Match* parentMatch1 = &match;
2450                 {
2451                     System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.AxisName(lexer);
2452                     if (matchResult.Error())
2453                     {
2454                         return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
2455                     }
2456                     System.Parsing.Match match = matchResult.Value();
2457                     axis.Reset(cast<System.Parsing.Value<System.Xml.Axis>*>(match.value));
2458                     *parentMatch1 = match;
2459                 }
2460                 if (match.hit)
2461                 {
2462                     System.Parsing.Match match(false);
2463                     System.Parsing.Match* parentMatch2 = &match;
2464                     {
2465                         System.Parsing.Match match(false);
2466                         System.Parsing.Match* parentMatch3 = &match;
2467                         {
2468                             long pos = lexer.GetPos();
2469                             System.Parsing.Match match(false);
2470                             if (*lexer == COLON_COLON)
2471                             {
2472                                 auto incResult0 = ++lexer;
2473                                 if (incResult0.Error())
2474                                 {
2475                                     return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
2476                                 }
2477                                 match.hit = true;
2478                             }
2479                             if (match.hit)
2480                             {
2481                                 #if (DEBUG)
2482                                     if (parser_debug_write_to_log)
2483                                     {
2484                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisSpecifier");
2485                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2486                                     }
2487                                 #endif
2488                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(axis->value)));
2489                             }
2490                             *parentMatch3 = match;
2491                         }
2492                         *parentMatch2 = match;
2493                     }
2494                     *parentMatch1 = match;
2495                 }
2496                 *parentMatch0 = match;
2497                 if (!match.hit)
2498                 {
2499                     System.Parsing.Match match(false);
2500                     System.Parsing.Match* parentMatch4 = &match;
2501                     lexer.SetPos(save);
2502                     {
2503                         System.Parsing.Match match(false);
2504                         System.Parsing.Match* parentMatch5 = &match;
2505                         {
2506                             long pos = lexer.GetPos();
2507                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.AbbreviatedAxisSpecifier(lexer);
2508                             if (matchResult.Error())
2509                             {
2510                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
2511                             }
2512                             System.Parsing.Match match = matchResult.Value();
2513                             abbreviatedAxisSpecifier.Reset(cast<System.Parsing.Value<System.Xml.Axis>*>(match.value));
2514                             if (match.hit)
2515                             {
2516                                 #if (DEBUG)
2517                                     if (parser_debug_write_to_log)
2518                                     {
2519                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisSpecifier");
2520                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2521                                     }
2522                                 #endif
2523                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(abbreviatedAxisSpecifier->value)));
2524                             }
2525                             *parentMatch5 = match;
2526                         }
2527                         *parentMatch4 = match;
2528                     }
2529                     *parentMatch0 = match;
2530                 }
2531             }
2532             #if (DEBUG)
2533             if (parser_debug_write_to_log)
2534             {
2535                 if (match.hit)
2536                 {
2537                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisSpecifier");
2538                     if (result.Error())
2539                     {
2540                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2541                     }
2542                 }
2543                 else
2544                 {
2545                     auto result = System.Lex.WriteFailureToLog(lexeru"AxisSpecifier");
2546                     if (result.Error())
2547                     {
2548                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2549                     }
2550                 }
2551             }
2552             #endif
2553             if (!match.hit)
2554             {
2555                 match.value = null;
2556             }
2557             return System.Result<System.Parsing.Match>(match);
2558         }
2559         public static System.Result<System.Parsing.Match> AxisName(LexerT& lexer)
2560         {
2561             #if (DEBUG)
2562             long parser_debug_match_pos = 0;
2563             bool parser_debug_write_to_log = lexer.Log() != null;
2564             if (parser_debug_write_to_log)
2565             {
2566                 parser_debug_match_pos = lexer.GetPos();
2567                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"AxisName");
2568                 if (result.Error())
2569                 {
2570                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2571                 }
2572             }
2573             #endif
2574             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434449);
2575             System.Parsing.Match match(false);
2576             System.Parsing.Match* parentMatch0 = &match;
2577             {
2578                 long pos = lexer.GetPos();
2579                 bool pass = true;
2580                 System.Parsing.Match match(false);
2581                 if (*lexer == NAME)
2582                 {
2583                     auto incResult0 = ++lexer;
2584                     if (incResult0.Error())
2585                     {
2586                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
2587                     }
2588                     match.hit = true;
2589                 }
2590                 if (match.hit)
2591                 {
2592                     switch (lexer.GetKeywordToken(lexer.GetToken(pos).match))
2593                     {
2594                         case ANCESTOR:
2595                         {
2596                             #if (DEBUG)
2597                                 if (parser_debug_write_to_log)
2598                                 {
2599                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisName");
2600                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2601                                 }
2602                             #endif
2603                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.ancestor)));
2604                         }
2605                         case ANCESTOR_OR_SELF:
2606                         {
2607                             #if (DEBUG)
2608                                 if (parser_debug_write_to_log)
2609                                 {
2610                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisName");
2611                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2612                                 }
2613                             #endif
2614                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.ancestorOrSelf)));
2615                         }
2616                         case ATTRIBUTE:
2617                         {
2618                             #if (DEBUG)
2619                                 if (parser_debug_write_to_log)
2620                                 {
2621                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisName");
2622                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2623                                 }
2624                             #endif
2625                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.attribute)));
2626                         }
2627                         case CHILD:
2628                         {
2629                             #if (DEBUG)
2630                                 if (parser_debug_write_to_log)
2631                                 {
2632                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisName");
2633                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2634                                 }
2635                             #endif
2636                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.child)));
2637                         }
2638                         case DESCENDANT:
2639                         {
2640                             #if (DEBUG)
2641                                 if (parser_debug_write_to_log)
2642                                 {
2643                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisName");
2644                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2645                                 }
2646                             #endif
2647                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.descendant)));
2648                         }
2649                         case DESCENDANT_OR_SELF:
2650                         {
2651                             #if (DEBUG)
2652                                 if (parser_debug_write_to_log)
2653                                 {
2654                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisName");
2655                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2656                                 }
2657                             #endif
2658                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.descendantOrSelf)));
2659                         }
2660                         case FOLLOWING:
2661                         {
2662                             #if (DEBUG)
2663                                 if (parser_debug_write_to_log)
2664                                 {
2665                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisName");
2666                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2667                                 }
2668                             #endif
2669                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.following)));
2670                         }
2671                         case FOLLOWING_SIBLING:
2672                         {
2673                             #if (DEBUG)
2674                                 if (parser_debug_write_to_log)
2675                                 {
2676                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisName");
2677                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2678                                 }
2679                             #endif
2680                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.followingSibling)));
2681                         }
2682                         case NAMESPACE:
2683                         {
2684                             #if (DEBUG)
2685                                 if (parser_debug_write_to_log)
2686                                 {
2687                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisName");
2688                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2689                                 }
2690                             #endif
2691                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.ns)));
2692                         }
2693                         case PARENT:
2694                         {
2695                             #if (DEBUG)
2696                                 if (parser_debug_write_to_log)
2697                                 {
2698                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisName");
2699                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2700                                 }
2701                             #endif
2702                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.parent)));
2703                         }
2704                         case PRECEDING:
2705                         {
2706                             #if (DEBUG)
2707                                 if (parser_debug_write_to_log)
2708                                 {
2709                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisName");
2710                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2711                                 }
2712                             #endif
2713                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.preceding)));
2714                         }
2715                         case PRECEDING_SIBLING:
2716                         {
2717                             #if (DEBUG)
2718                                 if (parser_debug_write_to_log)
2719                                 {
2720                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisName");
2721                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2722                                 }
2723                             #endif
2724                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.precedingSibling)));
2725                         }
2726                         case SELF:
2727                         {
2728                             #if (DEBUG)
2729                                 if (parser_debug_write_to_log)
2730                                 {
2731                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisName");
2732                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2733                                 }
2734                             #endif
2735                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.self)));
2736                         }
2737                         default:
2738                         {
2739                             pass = false;
2740                             break;
2741                         }
2742                     }
2743                 }
2744                 if (match.hit && !pass)
2745                 {
2746                     match = System.Parsing.Match(false);
2747                 }
2748                 *parentMatch0 = match;
2749             }
2750             #if (DEBUG)
2751             if (parser_debug_write_to_log)
2752             {
2753                 if (match.hit)
2754                 {
2755                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AxisName");
2756                     if (result.Error())
2757                     {
2758                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2759                     }
2760                 }
2761                 else
2762                 {
2763                     auto result = System.Lex.WriteFailureToLog(lexeru"AxisName");
2764                     if (result.Error())
2765                     {
2766                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2767                     }
2768                 }
2769             }
2770             #endif
2771             if (!match.hit)
2772             {
2773                 match.value = null;
2774             }
2775             return System.Result<System.Parsing.Match>(match);
2776         }
2777         public static System.Result<System.Parsing.Match> AbbreviatedAxisSpecifier(LexerT& lexer)
2778         {
2779             #if (DEBUG)
2780             long parser_debug_match_pos = 0;
2781             bool parser_debug_write_to_log = lexer.Log() != null;
2782             if (parser_debug_write_to_log)
2783             {
2784                 parser_debug_match_pos = lexer.GetPos();
2785                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"AbbreviatedAxisSpecifier");
2786                 if (result.Error())
2787                 {
2788                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2789                 }
2790             }
2791             #endif
2792             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434450);
2793             System.Parsing.Match match(false);
2794             System.Parsing.Match* parentMatch0 = &match;
2795             {
2796                 long save = lexer.GetPos();
2797                 System.Parsing.Match match(false);
2798                 System.Parsing.Match* parentMatch1 = &match;
2799                 {
2800                     long pos = lexer.GetPos();
2801                     System.Parsing.Match match(false);
2802                     if (*lexer == AT)
2803                     {
2804                         auto incResult0 = ++lexer;
2805                         if (incResult0.Error())
2806                         {
2807                             return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
2808                         }
2809                         match.hit = true;
2810                     }
2811                     if (match.hit)
2812                     {
2813                         #if (DEBUG)
2814                             if (parser_debug_write_to_log)
2815                             {
2816                                 auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AbbreviatedAxisSpecifier");
2817                                 if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2818                             }
2819                         #endif
2820                         return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.attribute)));
2821                     }
2822                     *parentMatch1 = match;
2823                 }
2824                 *parentMatch0 = match;
2825                 if (!match.hit)
2826                 {
2827                     System.Parsing.Match match(false);
2828                     System.Parsing.Match* parentMatch2 = &match;
2829                     lexer.SetPos(save);
2830                     {
2831                         System.Parsing.Match match(false);
2832                         System.Parsing.Match* parentMatch3 = &match;
2833                         {
2834                             long pos = lexer.GetPos();
2835                             System.Parsing.Match match(true);
2836                             if (match.hit)
2837                             {
2838                                 #if (DEBUG)
2839                                     if (parser_debug_write_to_log)
2840                                     {
2841                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AbbreviatedAxisSpecifier");
2842                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2843                                     }
2844                                 #endif
2845                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.Xml.Axis>(System.Xml.Axis.child)));
2846                             }
2847                             *parentMatch3 = match;
2848                         }
2849                         *parentMatch2 = match;
2850                     }
2851                     *parentMatch0 = match;
2852                 }
2853             }
2854             #if (DEBUG)
2855             if (parser_debug_write_to_log)
2856             {
2857                 if (match.hit)
2858                 {
2859                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AbbreviatedAxisSpecifier");
2860                     if (result.Error())
2861                     {
2862                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2863                     }
2864                 }
2865                 else
2866                 {
2867                     auto result = System.Lex.WriteFailureToLog(lexeru"AbbreviatedAxisSpecifier");
2868                     if (result.Error())
2869                     {
2870                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2871                     }
2872                 }
2873             }
2874             #endif
2875             if (!match.hit)
2876             {
2877                 match.value = null;
2878             }
2879             return System.Result<System.Parsing.Match>(match);
2880         }
2881         public static System.Result<System.Parsing.Match> NodeTest(LexerT& lexer)
2882         {
2883             #if (DEBUG)
2884             long parser_debug_match_pos = 0;
2885             bool parser_debug_write_to_log = lexer.Log() != null;
2886             if (parser_debug_write_to_log)
2887             {
2888                 parser_debug_match_pos = lexer.GetPos();
2889                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"NodeTest");
2890                 if (result.Error())
2891                 {
2892                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
2893                 }
2894             }
2895             #endif
2896             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434451);
2897             System.UniquePtr<System.XPath.Literal> pi;
2898             System.UniquePtr<System.XPath.NodeTest> nodeType;
2899             System.UniquePtr<System.XPath.NodeTest> nameTest;
2900             System.Parsing.Match match(false);
2901             System.Parsing.Match* parentMatch0 = &match;
2902             {
2903                 System.Parsing.Match match(false);
2904                 System.Parsing.Match* parentMatch1 = &match;
2905                 {
2906                     long save = lexer.GetPos();
2907                     System.Parsing.Match match(false);
2908                     System.Parsing.Match* parentMatch2 = &match;
2909                     {
2910                         long save = lexer.GetPos();
2911                         System.Parsing.Match match(false);
2912                         System.Parsing.Match* parentMatch3 = &match;
2913                         {
2914                             long pos = lexer.GetPos();
2915                             System.Parsing.Match match(false);
2916                             System.Parsing.Match* parentMatch4 = &match;
2917                             {
2918                                 System.Parsing.Match match(false);
2919                                 System.Parsing.Match* parentMatch5 = &match;
2920                                 {
2921                                     System.Parsing.Match match(false);
2922                                     System.Parsing.Match* parentMatch6 = &match;
2923                                     {
2924                                         System.Parsing.Match match(false);
2925                                         System.Parsing.Match* parentMatch7 = &match;
2926                                         {
2927                                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.ProcessingInstructionKeyword(lexer);
2928                                             if (matchResult.Error())
2929                                             {
2930                                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
2931                                             }
2932                                             System.Parsing.Match match = matchResult.Value();
2933                                             *parentMatch7 = match;
2934                                         }
2935                                         if (match.hit)
2936                                         {
2937                                             System.Parsing.Match match(false);
2938                                             System.Parsing.Match* parentMatch8 = &match;
2939                                             {
2940                                                 System.Parsing.Match match(false);
2941                                                 if (*lexer == LPAREN)
2942                                                 {
2943                                                     auto incResult0 = ++lexer;
2944                                                     if (incResult0.Error())
2945                                                     {
2946                                                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
2947                                                     }
2948                                                     match.hit = true;
2949                                                 }
2950                                                 *parentMatch8 = match;
2951                                             }
2952                                             *parentMatch7 = match;
2953                                         }
2954                                         *parentMatch6 = match;
2955                                     }
2956                                     if (match.hit)
2957                                     {
2958                                         System.Parsing.Match match(false);
2959                                         System.Parsing.Match* parentMatch9 = &match;
2960                                         {
2961                                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.Literal(lexer);
2962                                             if (matchResult.Error())
2963                                             {
2964                                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
2965                                             }
2966                                             System.Parsing.Match match = matchResult.Value();
2967                                             pi.Reset(cast<System.XPath.Literal*>(match.value));
2968                                             *parentMatch9 = match;
2969                                         }
2970                                         *parentMatch6 = match;
2971                                     }
2972                                     *parentMatch5 = match;
2973                                 }
2974                                 if (match.hit)
2975                                 {
2976                                     System.Parsing.Match match(false);
2977                                     System.Parsing.Match* parentMatch10 = &match;
2978                                     {
2979                                         System.Parsing.Match match(false);
2980                                         if (*lexer == RPAREN)
2981                                         {
2982                                             auto incResult1 = ++lexer;
2983                                             if (incResult1.Error())
2984                                             {
2985                                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult1.GetErrorId()));
2986                                             }
2987                                             match.hit = true;
2988                                         }
2989                                         *parentMatch10 = match;
2990                                     }
2991                                     *parentMatch5 = match;
2992                                 }
2993                                 *parentMatch4 = match;
2994                             }
2995                             if (match.hit)
2996                             {
2997                                 #if (DEBUG)
2998                                     if (parser_debug_write_to_log)
2999                                     {
3000                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NodeTest");
3001                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3002                                     }
3003                                 #endif
3004                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.PILiteralNodeTest(pi.Release())));
3005                             }
3006                             *parentMatch3 = match;
3007                         }
3008                         *parentMatch2 = match;
3009                         if (!match.hit)
3010                         {
3011                             System.Parsing.Match match(false);
3012                             System.Parsing.Match* parentMatch11 = &match;
3013                             lexer.SetPos(save);
3014                             {
3015                                 System.Parsing.Match match(false);
3016                                 System.Parsing.Match* parentMatch12 = &match;
3017                                 {
3018                                     long pos = lexer.GetPos();
3019                                     System.Parsing.Match match(false);
3020                                     System.Parsing.Match* parentMatch13 = &match;
3021                                     {
3022                                         System.Parsing.Match match(false);
3023                                         System.Parsing.Match* parentMatch14 = &match;
3024                                         {
3025                                             System.Parsing.Match match(false);
3026                                             System.Parsing.Match* parentMatch15 = &match;
3027                                             {
3028                                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.NodeType(lexer);
3029                                                 if (matchResult.Error())
3030                                                 {
3031                                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
3032                                                 }
3033                                                 System.Parsing.Match match = matchResult.Value();
3034                                                 nodeType.Reset(cast<System.XPath.NodeTest*>(match.value));
3035                                                 *parentMatch15 = match;
3036                                             }
3037                                             if (match.hit)
3038                                             {
3039                                                 System.Parsing.Match match(false);
3040                                                 System.Parsing.Match* parentMatch16 = &match;
3041                                                 {
3042                                                     System.Parsing.Match match(false);
3043                                                     if (*lexer == LPAREN)
3044                                                     {
3045                                                         auto incResult2 = ++lexer;
3046                                                         if (incResult2.Error())
3047                                                         {
3048                                                             return System.Result<System.Parsing.Match>(System.ErrorId(incResult2.GetErrorId()));
3049                                                         }
3050                                                         match.hit = true;
3051                                                     }
3052                                                     *parentMatch16 = match;
3053                                                 }
3054                                                 *parentMatch15 = match;
3055                                             }
3056                                             *parentMatch14 = match;
3057                                         }
3058                                         if (match.hit)
3059                                         {
3060                                             System.Parsing.Match match(false);
3061                                             System.Parsing.Match* parentMatch17 = &match;
3062                                             {
3063                                                 System.Parsing.Match match(false);
3064                                                 if (*lexer == RPAREN)
3065                                                 {
3066                                                     auto incResult3 = ++lexer;
3067                                                     if (incResult3.Error())
3068                                                     {
3069                                                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult3.GetErrorId()));
3070                                                     }
3071                                                     match.hit = true;
3072                                                 }
3073                                                 *parentMatch17 = match;
3074                                             }
3075                                             *parentMatch14 = match;
3076                                         }
3077                                         *parentMatch13 = match;
3078                                     }
3079                                     if (match.hit)
3080                                     {
3081                                         #if (DEBUG)
3082                                             if (parser_debug_write_to_log)
3083                                             {
3084                                                 auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NodeTest");
3085                                                 if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3086                                             }
3087                                         #endif
3088                                         return System.Result<System.Parsing.Match>(System.Parsing.Match(truenodeType.Release()));
3089                                     }
3090                                     *parentMatch12 = match;
3091                                 }
3092                                 *parentMatch11 = match;
3093                             }
3094                             *parentMatch2 = match;
3095                         }
3096                     }
3097                     *parentMatch1 = match;
3098                     if (!match.hit)
3099                     {
3100                         System.Parsing.Match match(false);
3101                         System.Parsing.Match* parentMatch18 = &match;
3102                         lexer.SetPos(save);
3103                         {
3104                             System.Parsing.Match match(false);
3105                             System.Parsing.Match* parentMatch19 = &match;
3106                             {
3107                                 long pos = lexer.GetPos();
3108                                 System.Parsing.Match match(false);
3109                                 System.Parsing.Match* parentMatch20 = &match;
3110                                 {
3111                                     System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.NameTest(lexer);
3112                                     if (matchResult.Error())
3113                                     {
3114                                         return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
3115                                     }
3116                                     System.Parsing.Match match = matchResult.Value();
3117                                     nameTest.Reset(cast<System.XPath.NodeTest*>(match.value));
3118                                     *parentMatch20 = match;
3119                                 }
3120                                 if (match.hit)
3121                                 {
3122                                     #if (DEBUG)
3123                                         if (parser_debug_write_to_log)
3124                                         {
3125                                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NodeTest");
3126                                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3127                                         }
3128                                     #endif
3129                                     return System.Result<System.Parsing.Match>(System.Parsing.Match(truenameTest.Release()));
3130                                 }
3131                                 *parentMatch19 = match;
3132                             }
3133                             *parentMatch18 = match;
3134                         }
3135                         *parentMatch1 = match;
3136                     }
3137                 }
3138                 *parentMatch0 = match;
3139             }
3140             #if (DEBUG)
3141             if (parser_debug_write_to_log)
3142             {
3143                 if (match.hit)
3144                 {
3145                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NodeTest");
3146                     if (result.Error())
3147                     {
3148                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3149                     }
3150                 }
3151                 else
3152                 {
3153                     auto result = System.Lex.WriteFailureToLog(lexeru"NodeTest");
3154                     if (result.Error())
3155                     {
3156                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3157                     }
3158                 }
3159             }
3160             #endif
3161             if (!match.hit)
3162             {
3163                 match.value = null;
3164             }
3165             return System.Result<System.Parsing.Match>(match);
3166         }
3167         public static System.Result<System.Parsing.Match> Literal(LexerT& lexer)
3168         {
3169             #if (DEBUG)
3170             long parser_debug_match_pos = 0;
3171             bool parser_debug_write_to_log = lexer.Log() != null;
3172             if (parser_debug_write_to_log)
3173             {
3174                 parser_debug_match_pos = lexer.GetPos();
3175                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"Literal");
3176                 if (result.Error())
3177                 {
3178                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3179                 }
3180             }
3181             #endif
3182             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434452);
3183             System.Parsing.Match match(false);
3184             System.Parsing.Match* parentMatch0 = &match;
3185             switch (*lexer)
3186             {
3187                 case DQ_STRING:
3188                 {
3189                     System.Parsing.Match match(false);
3190                     System.Parsing.Match* parentMatch1 = &match;
3191                     {
3192                         long pos = lexer.GetPos();
3193                         System.Parsing.Match match(false);
3194                         if (*lexer == DQ_STRING)
3195                         {
3196                             auto incResult0 = ++lexer;
3197                             if (incResult0.Error())
3198                             {
3199                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
3200                             }
3201                             match.hit = true;
3202                         }
3203                         if (match.hit)
3204                         {
3205                             #if (DEBUG)
3206                                 if (parser_debug_write_to_log)
3207                                 {
3208                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Literal");
3209                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3210                                 }
3211                             #endif
3212                             auto dqs = System.XPath.ParseDQString(lexer.FileName()lexer.GetToken(pos));
3213                             if (dqs.Error())
3214                             {
3215                                 return System.Result<System.Parsing.Match>(ErrorId(dqs.GetErrorId()));
3216                             }
3217                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.Literal(dqs.Value())));
3218                         }
3219                         *parentMatch1 = match;
3220                     }
3221                     if (match.hit)
3222                     {
3223                         *parentMatch0 = match;
3224                     }
3225                     break;
3226                 }
3227                 case SQ_STRING:
3228                 {
3229                     System.Parsing.Match match(false);
3230                     System.Parsing.Match* parentMatch2 = &match;
3231                     {
3232                         long pos = lexer.GetPos();
3233                         System.Parsing.Match match(false);
3234                         if (*lexer == SQ_STRING)
3235                         {
3236                             auto incResult1 = ++lexer;
3237                             if (incResult1.Error())
3238                             {
3239                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult1.GetErrorId()));
3240                             }
3241                             match.hit = true;
3242                         }
3243                         if (match.hit)
3244                         {
3245                             #if (DEBUG)
3246                                 if (parser_debug_write_to_log)
3247                                 {
3248                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Literal");
3249                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3250                                 }
3251                             #endif
3252                             auto sqs = System.XPath.ParseSQString(lexer.FileName()lexer.GetToken(pos));
3253                             if (sqs.Error())
3254                             {
3255                                 return System.Result<System.Parsing.Match>(ErrorId(sqs.GetErrorId()));
3256                             }
3257                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.Literal(sqs.Value())));
3258                         }
3259                         *parentMatch2 = match;
3260                     }
3261                     if (match.hit)
3262                     {
3263                         *parentMatch0 = match;
3264                     }
3265                     break;
3266                 }
3267             }
3268             #if (DEBUG)
3269             if (parser_debug_write_to_log)
3270             {
3271                 if (match.hit)
3272                 {
3273                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Literal");
3274                     if (result.Error())
3275                     {
3276                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3277                     }
3278                 }
3279                 else
3280                 {
3281                     auto result = System.Lex.WriteFailureToLog(lexeru"Literal");
3282                     if (result.Error())
3283                     {
3284                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3285                     }
3286                 }
3287             }
3288             #endif
3289             if (!match.hit)
3290             {
3291                 match.value = null;
3292             }
3293             return System.Result<System.Parsing.Match>(match);
3294         }
3295         public static System.Result<System.Parsing.Match> NodeType(LexerT& lexer)
3296         {
3297             #if (DEBUG)
3298             long parser_debug_match_pos = 0;
3299             bool parser_debug_write_to_log = lexer.Log() != null;
3300             if (parser_debug_write_to_log)
3301             {
3302                 parser_debug_match_pos = lexer.GetPos();
3303                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"NodeType");
3304                 if (result.Error())
3305                 {
3306                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3307                 }
3308             }
3309             #endif
3310             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434453);
3311             System.Parsing.Match match(false);
3312             System.Parsing.Match* parentMatch0 = &match;
3313             {
3314                 long pos = lexer.GetPos();
3315                 bool pass = true;
3316                 System.Parsing.Match match(false);
3317                 if (*lexer == NAME)
3318                 {
3319                     auto incResult0 = ++lexer;
3320                     if (incResult0.Error())
3321                     {
3322                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
3323                     }
3324                     match.hit = true;
3325                 }
3326                 if (match.hit)
3327                 {
3328                     switch (lexer.GetKeywordToken(lexer.GetToken(pos).match))
3329                     {
3330                         case COMMENT:
3331                         {
3332                             #if (DEBUG)
3333                                 if (parser_debug_write_to_log)
3334                                 {
3335                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NodeType");
3336                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3337                                 }
3338                             #endif
3339                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.NodeTest(System.XPath.NodeTestKind.commentNodeTest)));
3340                         }
3341                         case TEXT:
3342                         {
3343                             #if (DEBUG)
3344                                 if (parser_debug_write_to_log)
3345                                 {
3346                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NodeType");
3347                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3348                                 }
3349                             #endif
3350                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.NodeTest(System.XPath.NodeTestKind.textNodeTest)));
3351                         }
3352                         case PROCESSING_INSTRUCTION:
3353                         {
3354                             #if (DEBUG)
3355                                 if (parser_debug_write_to_log)
3356                                 {
3357                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NodeType");
3358                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3359                                 }
3360                             #endif
3361                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.NodeTest(System.XPath.NodeTestKind.piNodeTest)));
3362                         }
3363                         case NODE:
3364                         {
3365                             #if (DEBUG)
3366                                 if (parser_debug_write_to_log)
3367                                 {
3368                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NodeType");
3369                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3370                                 }
3371                             #endif
3372                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.NodeTest(System.XPath.NodeTestKind.anyNodeTest)));
3373                         }
3374                         default:
3375                         {
3376                             pass = false;
3377                             break;
3378                         }
3379                     }
3380                 }
3381                 if (match.hit && !pass)
3382                 {
3383                     match = System.Parsing.Match(false);
3384                 }
3385                 *parentMatch0 = match;
3386             }
3387             #if (DEBUG)
3388             if (parser_debug_write_to_log)
3389             {
3390                 if (match.hit)
3391                 {
3392                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NodeType");
3393                     if (result.Error())
3394                     {
3395                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3396                     }
3397                 }
3398                 else
3399                 {
3400                     auto result = System.Lex.WriteFailureToLog(lexeru"NodeType");
3401                     if (result.Error())
3402                     {
3403                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3404                     }
3405                 }
3406             }
3407             #endif
3408             if (!match.hit)
3409             {
3410                 match.value = null;
3411             }
3412             return System.Result<System.Parsing.Match>(match);
3413         }
3414         public static System.Result<System.Parsing.Match> NameTest(LexerT& lexer)
3415         {
3416             #if (DEBUG)
3417             long parser_debug_match_pos = 0;
3418             bool parser_debug_write_to_log = lexer.Log() != null;
3419             if (parser_debug_write_to_log)
3420             {
3421                 parser_debug_match_pos = lexer.GetPos();
3422                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"NameTest");
3423                 if (result.Error())
3424                 {
3425                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3426                 }
3427             }
3428             #endif
3429             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434454);
3430             System.UniquePtr<System.Parsing.Value<string>> ncname;
3431             System.UniquePtr<System.Parsing.Value<string>> qname;
3432             System.Parsing.Match match(false);
3433             System.Parsing.Match* parentMatch0 = &match;
3434             {
3435                 long save = lexer.GetPos();
3436                 System.Parsing.Match match(false);
3437                 System.Parsing.Match* parentMatch1 = &match;
3438                 switch (*lexer)
3439                 {
3440                     case STAR:
3441                     {
3442                         System.Parsing.Match match(false);
3443                         System.Parsing.Match* parentMatch2 = &match;
3444                         {
3445                             long pos = lexer.GetPos();
3446                             System.Parsing.Match match(false);
3447                             if (*lexer == STAR)
3448                             {
3449                                 auto incResult0 = ++lexer;
3450                                 if (incResult0.Error())
3451                                 {
3452                                     return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
3453                                 }
3454                                 match.hit = true;
3455                             }
3456                             if (match.hit)
3457                             {
3458                                 #if (DEBUG)
3459                                     if (parser_debug_write_to_log)
3460                                     {
3461                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NameTest");
3462                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3463                                     }
3464                                 #endif
3465                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.NodeTest(System.XPath.NodeTestKind.principalNodeTest)));
3466                             }
3467                             *parentMatch2 = match;
3468                         }
3469                         if (match.hit)
3470                         {
3471                             *parentMatch1 = match;
3472                         }
3473                         break;
3474                     }
3475                     case NAME:
3476                     {
3477                         System.Parsing.Match match(false);
3478                         System.Parsing.Match* parentMatch3 = &match;
3479                         {
3480                             System.Parsing.Match match(false);
3481                             System.Parsing.Match* parentMatch4 = &match;
3482                             {
3483                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.NCName(lexer);
3484                                 if (matchResult.Error())
3485                                 {
3486                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
3487                                 }
3488                                 System.Parsing.Match match = matchResult.Value();
3489                                 ncname.Reset(cast<System.Parsing.Value<string>*>(match.value));
3490                                 *parentMatch4 = match;
3491                             }
3492                             if (match.hit)
3493                             {
3494                                 System.Parsing.Match match(false);
3495                                 System.Parsing.Match* parentMatch5 = &match;
3496                                 {
3497                                     System.Parsing.Match match(false);
3498                                     if (*lexer == COLON)
3499                                     {
3500                                         auto incResult1 = ++lexer;
3501                                         if (incResult1.Error())
3502                                         {
3503                                             return System.Result<System.Parsing.Match>(System.ErrorId(incResult1.GetErrorId()));
3504                                         }
3505                                         match.hit = true;
3506                                     }
3507                                     *parentMatch5 = match;
3508                                 }
3509                                 *parentMatch4 = match;
3510                             }
3511                             *parentMatch3 = match;
3512                         }
3513                         if (match.hit)
3514                         {
3515                             System.Parsing.Match match(false);
3516                             System.Parsing.Match* parentMatch6 = &match;
3517                             {
3518                                 System.Parsing.Match match(false);
3519                                 System.Parsing.Match* parentMatch7 = &match;
3520                                 {
3521                                     long pos = lexer.GetPos();
3522                                     System.Parsing.Match match(false);
3523                                     if (*lexer == STAR)
3524                                     {
3525                                         auto incResult2 = ++lexer;
3526                                         if (incResult2.Error())
3527                                         {
3528                                             return System.Result<System.Parsing.Match>(System.ErrorId(incResult2.GetErrorId()));
3529                                         }
3530                                         match.hit = true;
3531                                     }
3532                                     if (match.hit)
3533                                     {
3534                                         #if (DEBUG)
3535                                             if (parser_debug_write_to_log)
3536                                             {
3537                                                 auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NameTest");
3538                                                 if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3539                                             }
3540                                         #endif
3541                                         return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.PrefixNodeTest(ncname->value)));
3542                                     }
3543                                     *parentMatch7 = match;
3544                                 }
3545                                 *parentMatch6 = match;
3546                             }
3547                             *parentMatch3 = match;
3548                         }
3549                         if (match.hit)
3550                         {
3551                             *parentMatch1 = match;
3552                         }
3553                         break;
3554                     }
3555                 }
3556                 *parentMatch0 = match;
3557                 if (!match.hit)
3558                 {
3559                     System.Parsing.Match match(false);
3560                     System.Parsing.Match* parentMatch8 = &match;
3561                     lexer.SetPos(save);
3562                     {
3563                         System.Parsing.Match match(false);
3564                         System.Parsing.Match* parentMatch9 = &match;
3565                         {
3566                             long pos = lexer.GetPos();
3567                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.QName(lexer);
3568                             if (matchResult.Error())
3569                             {
3570                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
3571                             }
3572                             System.Parsing.Match match = matchResult.Value();
3573                             qname.Reset(cast<System.Parsing.Value<string>*>(match.value));
3574                             if (match.hit)
3575                             {
3576                                 #if (DEBUG)
3577                                     if (parser_debug_write_to_log)
3578                                     {
3579                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NameTest");
3580                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3581                                     }
3582                                 #endif
3583                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.NameNodeTest(qname->value)));
3584                             }
3585                             *parentMatch9 = match;
3586                         }
3587                         *parentMatch8 = match;
3588                     }
3589                     *parentMatch0 = match;
3590                 }
3591             }
3592             #if (DEBUG)
3593             if (parser_debug_write_to_log)
3594             {
3595                 if (match.hit)
3596                 {
3597                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NameTest");
3598                     if (result.Error())
3599                     {
3600                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3601                     }
3602                 }
3603                 else
3604                 {
3605                     auto result = System.Lex.WriteFailureToLog(lexeru"NameTest");
3606                     if (result.Error())
3607                     {
3608                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3609                     }
3610                 }
3611             }
3612             #endif
3613             if (!match.hit)
3614             {
3615                 match.value = null;
3616             }
3617             return System.Result<System.Parsing.Match>(match);
3618         }
3619         public static System.Result<System.Parsing.Match> NCName(LexerT& lexer)
3620         {
3621             #if (DEBUG)
3622             long parser_debug_match_pos = 0;
3623             bool parser_debug_write_to_log = lexer.Log() != null;
3624             if (parser_debug_write_to_log)
3625             {
3626                 parser_debug_match_pos = lexer.GetPos();
3627                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"NCName");
3628                 if (result.Error())
3629                 {
3630                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3631                 }
3632             }
3633             #endif
3634             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434455);
3635             System.Parsing.Match match(false);
3636             System.Parsing.Match* parentMatch0 = &match;
3637             {
3638                 long pos = lexer.GetPos();
3639                 System.Parsing.Match match(false);
3640                 if (*lexer == NAME)
3641                 {
3642                     auto incResult0 = ++lexer;
3643                     if (incResult0.Error())
3644                     {
3645                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
3646                     }
3647                     match.hit = true;
3648                 }
3649                 if (match.hit)
3650                 {
3651                     #if (DEBUG)
3652                         if (parser_debug_write_to_log)
3653                         {
3654                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NCName");
3655                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3656                         }
3657                     #endif
3658                     auto utf8Result = ToUtf8(lexer.GetToken(pos).ToString());
3659                     if (utf8Result.Error())
3660                     {
3661                         return System.Result<System.Parsing.Match>(ErrorId(utf8Result.GetErrorId()));
3662                     }
3663                     return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<string>(utf8Result.Value())));
3664                 }
3665                 *parentMatch0 = match;
3666             }
3667             #if (DEBUG)
3668             if (parser_debug_write_to_log)
3669             {
3670                 if (match.hit)
3671                 {
3672                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"NCName");
3673                     if (result.Error())
3674                     {
3675                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3676                     }
3677                 }
3678                 else
3679                 {
3680                     auto result = System.Lex.WriteFailureToLog(lexeru"NCName");
3681                     if (result.Error())
3682                     {
3683                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3684                     }
3685                 }
3686             }
3687             #endif
3688             if (!match.hit)
3689             {
3690                 match.value = null;
3691             }
3692             return System.Result<System.Parsing.Match>(match);
3693         }
3694         public static System.Result<System.Parsing.Match> QName(LexerT& lexer)
3695         {
3696             #if (DEBUG)
3697             long parser_debug_match_pos = 0;
3698             bool parser_debug_write_to_log = lexer.Log() != null;
3699             if (parser_debug_write_to_log)
3700             {
3701                 parser_debug_match_pos = lexer.GetPos();
3702                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"QName");
3703                 if (result.Error())
3704                 {
3705                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3706                 }
3707             }
3708             #endif
3709             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434456);
3710             System.UniquePtr<System.Parsing.Value<string>> prefixedName;
3711             System.UniquePtr<System.Parsing.Value<string>> unprefixedName;
3712             System.Parsing.Match match(false);
3713             System.Parsing.Match* parentMatch0 = &match;
3714             {
3715                 long save = lexer.GetPos();
3716                 System.Parsing.Match match(false);
3717                 System.Parsing.Match* parentMatch1 = &match;
3718                 {
3719                     long pos = lexer.GetPos();
3720                     System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.PrefixedName(lexer);
3721                     if (matchResult.Error())
3722                     {
3723                         return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
3724                     }
3725                     System.Parsing.Match match = matchResult.Value();
3726                     prefixedName.Reset(cast<System.Parsing.Value<string>*>(match.value));
3727                     if (match.hit)
3728                     {
3729                         #if (DEBUG)
3730                             if (parser_debug_write_to_log)
3731                             {
3732                                 auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"QName");
3733                                 if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3734                             }
3735                         #endif
3736                         return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<string>(prefixedName->value)));
3737                     }
3738                     *parentMatch1 = match;
3739                 }
3740                 *parentMatch0 = match;
3741                 if (!match.hit)
3742                 {
3743                     System.Parsing.Match match(false);
3744                     System.Parsing.Match* parentMatch2 = &match;
3745                     lexer.SetPos(save);
3746                     {
3747                         System.Parsing.Match match(false);
3748                         System.Parsing.Match* parentMatch3 = &match;
3749                         {
3750                             long pos = lexer.GetPos();
3751                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.UnprefixedName(lexer);
3752                             if (matchResult.Error())
3753                             {
3754                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
3755                             }
3756                             System.Parsing.Match match = matchResult.Value();
3757                             unprefixedName.Reset(cast<System.Parsing.Value<string>*>(match.value));
3758                             if (match.hit)
3759                             {
3760                                 #if (DEBUG)
3761                                     if (parser_debug_write_to_log)
3762                                     {
3763                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"QName");
3764                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3765                                     }
3766                                 #endif
3767                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<string>(unprefixedName->value)));
3768                             }
3769                             *parentMatch3 = match;
3770                         }
3771                         *parentMatch2 = match;
3772                     }
3773                     *parentMatch0 = match;
3774                 }
3775             }
3776             #if (DEBUG)
3777             if (parser_debug_write_to_log)
3778             {
3779                 if (match.hit)
3780                 {
3781                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"QName");
3782                     if (result.Error())
3783                     {
3784                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3785                     }
3786                 }
3787                 else
3788                 {
3789                     auto result = System.Lex.WriteFailureToLog(lexeru"QName");
3790                     if (result.Error())
3791                     {
3792                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3793                     }
3794                 }
3795             }
3796             #endif
3797             if (!match.hit)
3798             {
3799                 match.value = null;
3800             }
3801             return System.Result<System.Parsing.Match>(match);
3802         }
3803         public static System.Result<System.Parsing.Match> PrefixedName(LexerT& lexer)
3804         {
3805             #if (DEBUG)
3806             long parser_debug_match_pos = 0;
3807             bool parser_debug_write_to_log = lexer.Log() != null;
3808             if (parser_debug_write_to_log)
3809             {
3810                 parser_debug_match_pos = lexer.GetPos();
3811                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"PrefixedName");
3812                 if (result.Error())
3813                 {
3814                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3815                 }
3816             }
3817             #endif
3818             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434457);
3819             System.UniquePtr<System.Parsing.Value<string>> prefix;
3820             System.UniquePtr<System.Parsing.Value<string>> localPart;
3821             System.Parsing.Match match(false);
3822             System.Parsing.Match* parentMatch0 = &match;
3823             {
3824                 long pos = lexer.GetPos();
3825                 System.Parsing.Match match(false);
3826                 System.Parsing.Match* parentMatch1 = &match;
3827                 {
3828                     System.Parsing.Match match(false);
3829                     System.Parsing.Match* parentMatch2 = &match;
3830                     {
3831                         System.Parsing.Match match(false);
3832                         System.Parsing.Match* parentMatch3 = &match;
3833                         {
3834                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.Prefix(lexer);
3835                             if (matchResult.Error())
3836                             {
3837                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
3838                             }
3839                             System.Parsing.Match match = matchResult.Value();
3840                             prefix.Reset(cast<System.Parsing.Value<string>*>(match.value));
3841                             *parentMatch3 = match;
3842                         }
3843                         if (match.hit)
3844                         {
3845                             System.Parsing.Match match(false);
3846                             System.Parsing.Match* parentMatch4 = &match;
3847                             {
3848                                 System.Parsing.Match match(false);
3849                                 if (*lexer == COLON)
3850                                 {
3851                                     auto incResult0 = ++lexer;
3852                                     if (incResult0.Error())
3853                                     {
3854                                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
3855                                     }
3856                                     match.hit = true;
3857                                 }
3858                                 *parentMatch4 = match;
3859                             }
3860                             *parentMatch3 = match;
3861                         }
3862                         *parentMatch2 = match;
3863                     }
3864                     if (match.hit)
3865                     {
3866                         System.Parsing.Match match(false);
3867                         System.Parsing.Match* parentMatch5 = &match;
3868                         {
3869                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.LocalPart(lexer);
3870                             if (matchResult.Error())
3871                             {
3872                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
3873                             }
3874                             System.Parsing.Match match = matchResult.Value();
3875                             localPart.Reset(cast<System.Parsing.Value<string>*>(match.value));
3876                             *parentMatch5 = match;
3877                         }
3878                         *parentMatch2 = match;
3879                     }
3880                     *parentMatch1 = match;
3881                 }
3882                 if (match.hit)
3883                 {
3884                     #if (DEBUG)
3885                         if (parser_debug_write_to_log)
3886                         {
3887                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"PrefixedName");
3888                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3889                         }
3890                     #endif
3891                     return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<string>(prefix->value + ":" + localPart->value)));
3892                 }
3893                 *parentMatch0 = match;
3894             }
3895             #if (DEBUG)
3896             if (parser_debug_write_to_log)
3897             {
3898                 if (match.hit)
3899                 {
3900                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"PrefixedName");
3901                     if (result.Error())
3902                     {
3903                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3904                     }
3905                 }
3906                 else
3907                 {
3908                     auto result = System.Lex.WriteFailureToLog(lexeru"PrefixedName");
3909                     if (result.Error())
3910                     {
3911                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3912                     }
3913                 }
3914             }
3915             #endif
3916             if (!match.hit)
3917             {
3918                 match.value = null;
3919             }
3920             return System.Result<System.Parsing.Match>(match);
3921         }
3922         public static System.Result<System.Parsing.Match> Prefix(LexerT& lexer)
3923         {
3924             #if (DEBUG)
3925             long parser_debug_match_pos = 0;
3926             bool parser_debug_write_to_log = lexer.Log() != null;
3927             if (parser_debug_write_to_log)
3928             {
3929                 parser_debug_match_pos = lexer.GetPos();
3930                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"Prefix");
3931                 if (result.Error())
3932                 {
3933                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3934                 }
3935             }
3936             #endif
3937             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434458);
3938             System.UniquePtr<System.Parsing.Value<string>> ncname;
3939             System.Parsing.Match match(false);
3940             System.Parsing.Match* parentMatch0 = &match;
3941             {
3942                 long pos = lexer.GetPos();
3943                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.NCName(lexer);
3944                 if (matchResult.Error())
3945                 {
3946                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
3947                 }
3948                 System.Parsing.Match match = matchResult.Value();
3949                 ncname.Reset(cast<System.Parsing.Value<string>*>(match.value));
3950                 if (match.hit)
3951                 {
3952                     #if (DEBUG)
3953                         if (parser_debug_write_to_log)
3954                         {
3955                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Prefix");
3956                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3957                         }
3958                     #endif
3959                     return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<string>(ncname->value)));
3960                 }
3961                 *parentMatch0 = match;
3962             }
3963             #if (DEBUG)
3964             if (parser_debug_write_to_log)
3965             {
3966                 if (match.hit)
3967                 {
3968                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Prefix");
3969                     if (result.Error())
3970                     {
3971                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3972                     }
3973                 }
3974                 else
3975                 {
3976                     auto result = System.Lex.WriteFailureToLog(lexeru"Prefix");
3977                     if (result.Error())
3978                     {
3979                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
3980                     }
3981                 }
3982             }
3983             #endif
3984             if (!match.hit)
3985             {
3986                 match.value = null;
3987             }
3988             return System.Result<System.Parsing.Match>(match);
3989         }
3990         public static System.Result<System.Parsing.Match> UnprefixedName(LexerT& lexer)
3991         {
3992             #if (DEBUG)
3993             long parser_debug_match_pos = 0;
3994             bool parser_debug_write_to_log = lexer.Log() != null;
3995             if (parser_debug_write_to_log)
3996             {
3997                 parser_debug_match_pos = lexer.GetPos();
3998                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"UnprefixedName");
3999                 if (result.Error())
4000                 {
4001                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4002                 }
4003             }
4004             #endif
4005             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434459);
4006             System.UniquePtr<System.Parsing.Value<string>> localPart;
4007             System.Parsing.Match match(false);
4008             System.Parsing.Match* parentMatch0 = &match;
4009             {
4010                 long pos = lexer.GetPos();
4011                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.LocalPart(lexer);
4012                 if (matchResult.Error())
4013                 {
4014                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
4015                 }
4016                 System.Parsing.Match match = matchResult.Value();
4017                 localPart.Reset(cast<System.Parsing.Value<string>*>(match.value));
4018                 if (match.hit)
4019                 {
4020                     #if (DEBUG)
4021                         if (parser_debug_write_to_log)
4022                         {
4023                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"UnprefixedName");
4024                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4025                         }
4026                     #endif
4027                     return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<string>(localPart->value)));
4028                 }
4029                 *parentMatch0 = match;
4030             }
4031             #if (DEBUG)
4032             if (parser_debug_write_to_log)
4033             {
4034                 if (match.hit)
4035                 {
4036                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"UnprefixedName");
4037                     if (result.Error())
4038                     {
4039                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4040                     }
4041                 }
4042                 else
4043                 {
4044                     auto result = System.Lex.WriteFailureToLog(lexeru"UnprefixedName");
4045                     if (result.Error())
4046                     {
4047                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4048                     }
4049                 }
4050             }
4051             #endif
4052             if (!match.hit)
4053             {
4054                 match.value = null;
4055             }
4056             return System.Result<System.Parsing.Match>(match);
4057         }
4058         public static System.Result<System.Parsing.Match> LocalPart(LexerT& lexer)
4059         {
4060             #if (DEBUG)
4061             long parser_debug_match_pos = 0;
4062             bool parser_debug_write_to_log = lexer.Log() != null;
4063             if (parser_debug_write_to_log)
4064             {
4065                 parser_debug_match_pos = lexer.GetPos();
4066                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"LocalPart");
4067                 if (result.Error())
4068                 {
4069                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4070                 }
4071             }
4072             #endif
4073             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434460);
4074             System.UniquePtr<System.Parsing.Value<string>> ncname;
4075             System.Parsing.Match match(false);
4076             System.Parsing.Match* parentMatch0 = &match;
4077             {
4078                 long pos = lexer.GetPos();
4079                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.NCName(lexer);
4080                 if (matchResult.Error())
4081                 {
4082                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
4083                 }
4084                 System.Parsing.Match match = matchResult.Value();
4085                 ncname.Reset(cast<System.Parsing.Value<string>*>(match.value));
4086                 if (match.hit)
4087                 {
4088                     #if (DEBUG)
4089                         if (parser_debug_write_to_log)
4090                         {
4091                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"LocalPart");
4092                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4093                         }
4094                     #endif
4095                     return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<string>(ncname->value)));
4096                 }
4097                 *parentMatch0 = match;
4098             }
4099             #if (DEBUG)
4100             if (parser_debug_write_to_log)
4101             {
4102                 if (match.hit)
4103                 {
4104                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"LocalPart");
4105                     if (result.Error())
4106                     {
4107                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4108                     }
4109                 }
4110                 else
4111                 {
4112                     auto result = System.Lex.WriteFailureToLog(lexeru"LocalPart");
4113                     if (result.Error())
4114                     {
4115                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4116                     }
4117                 }
4118             }
4119             #endif
4120             if (!match.hit)
4121             {
4122                 match.value = null;
4123             }
4124             return System.Result<System.Parsing.Match>(match);
4125         }
4126         public static System.Result<System.Parsing.Match> Predicate(LexerT& lexer)
4127         {
4128             #if (DEBUG)
4129             long parser_debug_match_pos = 0;
4130             bool parser_debug_write_to_log = lexer.Log() != null;
4131             if (parser_debug_write_to_log)
4132             {
4133                 parser_debug_match_pos = lexer.GetPos();
4134                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"Predicate");
4135                 if (result.Error())
4136                 {
4137                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4138                 }
4139             }
4140             #endif
4141             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434461);
4142             System.UniquePtr<System.XPath.Expr> expr;
4143             System.Parsing.Match match(false);
4144             System.Parsing.Match* parentMatch0 = &match;
4145             {
4146                 long pos = lexer.GetPos();
4147                 System.Parsing.Match match(false);
4148                 System.Parsing.Match* parentMatch1 = &match;
4149                 {
4150                     System.Parsing.Match match(false);
4151                     System.Parsing.Match* parentMatch2 = &match;
4152                     {
4153                         System.Parsing.Match match(false);
4154                         System.Parsing.Match* parentMatch3 = &match;
4155                         {
4156                             System.Parsing.Match match(false);
4157                             if (*lexer == LBRACKET)
4158                             {
4159                                 auto incResult0 = ++lexer;
4160                                 if (incResult0.Error())
4161                                 {
4162                                     return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
4163                                 }
4164                                 match.hit = true;
4165                             }
4166                             *parentMatch3 = match;
4167                         }
4168                         if (match.hit)
4169                         {
4170                             System.Parsing.Match match(false);
4171                             System.Parsing.Match* parentMatch4 = &match;
4172                             {
4173                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.Expr(lexer);
4174                                 if (matchResult.Error())
4175                                 {
4176                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
4177                                 }
4178                                 System.Parsing.Match match = matchResult.Value();
4179                                 expr.Reset(cast<System.XPath.Expr*>(match.value));
4180                                 *parentMatch4 = match;
4181                             }
4182                             *parentMatch3 = match;
4183                         }
4184                         *parentMatch2 = match;
4185                     }
4186                     if (match.hit)
4187                     {
4188                         System.Parsing.Match match(false);
4189                         System.Parsing.Match* parentMatch5 = &match;
4190                         {
4191                             System.Parsing.Match match(false);
4192                             if (*lexer == RBRACKET)
4193                             {
4194                                 auto incResult1 = ++lexer;
4195                                 if (incResult1.Error())
4196                                 {
4197                                     return System.Result<System.Parsing.Match>(System.ErrorId(incResult1.GetErrorId()));
4198                                 }
4199                                 match.hit = true;
4200                             }
4201                             *parentMatch5 = match;
4202                         }
4203                         *parentMatch2 = match;
4204                     }
4205                     *parentMatch1 = match;
4206                 }
4207                 if (match.hit)
4208                 {
4209                     #if (DEBUG)
4210                         if (parser_debug_write_to_log)
4211                         {
4212                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Predicate");
4213                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4214                         }
4215                     #endif
4216                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueexpr.Release()));
4217                 }
4218                 *parentMatch0 = match;
4219             }
4220             #if (DEBUG)
4221             if (parser_debug_write_to_log)
4222             {
4223                 if (match.hit)
4224                 {
4225                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Predicate");
4226                     if (result.Error())
4227                     {
4228                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4229                     }
4230                 }
4231                 else
4232                 {
4233                     auto result = System.Lex.WriteFailureToLog(lexeru"Predicate");
4234                     if (result.Error())
4235                     {
4236                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4237                     }
4238                 }
4239             }
4240             #endif
4241             if (!match.hit)
4242             {
4243                 match.value = null;
4244             }
4245             return System.Result<System.Parsing.Match>(match);
4246         }
4247         public static System.Result<System.Parsing.Match> AbbreviatedStep(LexerT& lexer)
4248         {
4249             #if (DEBUG)
4250             long parser_debug_match_pos = 0;
4251             bool parser_debug_write_to_log = lexer.Log() != null;
4252             if (parser_debug_write_to_log)
4253             {
4254                 parser_debug_match_pos = lexer.GetPos();
4255                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"AbbreviatedStep");
4256                 if (result.Error())
4257                 {
4258                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4259                 }
4260             }
4261             #endif
4262             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434462);
4263             System.Parsing.Match match(false);
4264             System.Parsing.Match* parentMatch0 = &match;
4265             {
4266                 System.Parsing.Match match(false);
4267                 System.Parsing.Match* parentMatch1 = &match;
4268                 switch (*lexer)
4269                 {
4270                     case DOT_DOT:
4271                     {
4272                         System.Parsing.Match match(false);
4273                         System.Parsing.Match* parentMatch2 = &match;
4274                         {
4275                             long pos = lexer.GetPos();
4276                             System.Parsing.Match match(false);
4277                             if (*lexer == DOT_DOT)
4278                             {
4279                                 auto incResult0 = ++lexer;
4280                                 if (incResult0.Error())
4281                                 {
4282                                     return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
4283                                 }
4284                                 match.hit = true;
4285                             }
4286                             if (match.hit)
4287                             {
4288                                 #if (DEBUG)
4289                                     if (parser_debug_write_to_log)
4290                                     {
4291                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AbbreviatedStep");
4292                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4293                                     }
4294                                 #endif
4295                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.LocationStepExpr(System.Xml.Axis.parentnew System.XPath.NodeTest(System.XPath.NodeTestKind.anyNodeTest))));
4296                             }
4297                             *parentMatch2 = match;
4298                         }
4299                         if (match.hit)
4300                         {
4301                             *parentMatch1 = match;
4302                         }
4303                         break;
4304                     }
4305                     case DOT:
4306                     {
4307                         System.Parsing.Match match(false);
4308                         System.Parsing.Match* parentMatch3 = &match;
4309                         {
4310                             long pos = lexer.GetPos();
4311                             System.Parsing.Match match(false);
4312                             if (*lexer == DOT)
4313                             {
4314                                 auto incResult1 = ++lexer;
4315                                 if (incResult1.Error())
4316                                 {
4317                                     return System.Result<System.Parsing.Match>(System.ErrorId(incResult1.GetErrorId()));
4318                                 }
4319                                 match.hit = true;
4320                             }
4321                             if (match.hit)
4322                             {
4323                                 #if (DEBUG)
4324                                     if (parser_debug_write_to_log)
4325                                     {
4326                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AbbreviatedStep");
4327                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4328                                     }
4329                                 #endif
4330                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.LocationStepExpr(System.Xml.Axis.selfnew System.XPath.NodeTest(System.XPath.NodeTestKind.anyNodeTest))));
4331                             }
4332                             *parentMatch3 = match;
4333                         }
4334                         if (match.hit)
4335                         {
4336                             *parentMatch1 = match;
4337                         }
4338                         break;
4339                     }
4340                 }
4341                 *parentMatch0 = match;
4342             }
4343             #if (DEBUG)
4344             if (parser_debug_write_to_log)
4345             {
4346                 if (match.hit)
4347                 {
4348                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AbbreviatedStep");
4349                     if (result.Error())
4350                     {
4351                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4352                     }
4353                 }
4354                 else
4355                 {
4356                     auto result = System.Lex.WriteFailureToLog(lexeru"AbbreviatedStep");
4357                     if (result.Error())
4358                     {
4359                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4360                     }
4361                 }
4362             }
4363             #endif
4364             if (!match.hit)
4365             {
4366                 match.value = null;
4367             }
4368             return System.Result<System.Parsing.Match>(match);
4369         }
4370         public static System.Result<System.Parsing.Match> FunctionCall(LexerT& lexer)
4371         {
4372             #if (DEBUG)
4373             long parser_debug_match_pos = 0;
4374             bool parser_debug_write_to_log = lexer.Log() != null;
4375             if (parser_debug_write_to_log)
4376             {
4377                 parser_debug_match_pos = lexer.GetPos();
4378                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"FunctionCall");
4379                 if (result.Error())
4380                 {
4381                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4382                 }
4383             }
4384             #endif
4385             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434463);
4386             UniquePtr<System.XPath.FunctionCall> functionCall = UniquePtr<System.XPath.FunctionCall>();
4387             System.UniquePtr<System.Parsing.Value<string>> functionName;
4388             System.UniquePtr<System.XPath.Expr> arg;
4389             System.Parsing.Match match(false);
4390             System.Parsing.Match* parentMatch0 = &match;
4391             {
4392                 long pos = lexer.GetPos();
4393                 System.Parsing.Match match(false);
4394                 System.Parsing.Match* parentMatch1 = &match;
4395                 {
4396                     System.Parsing.Match match(false);
4397                     System.Parsing.Match* parentMatch2 = &match;
4398                     {
4399                         System.Parsing.Match match(false);
4400                         System.Parsing.Match* parentMatch3 = &match;
4401                         {
4402                             System.Parsing.Match match(false);
4403                             System.Parsing.Match* parentMatch4 = &match;
4404                             {
4405                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.FunctionName(lexer);
4406                                 if (matchResult.Error())
4407                                 {
4408                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
4409                                 }
4410                                 System.Parsing.Match match = matchResult.Value();
4411                                 functionName.Reset(cast<System.Parsing.Value<string>*>(match.value));
4412                                 *parentMatch4 = match;
4413                             }
4414                             if (match.hit)
4415                             {
4416                                 System.Parsing.Match match(false);
4417                                 System.Parsing.Match* parentMatch5 = &match;
4418                                 {
4419                                     System.Parsing.Match match(false);
4420                                     System.Parsing.Match* parentMatch6 = &match;
4421                                     {
4422                                         long pos = lexer.GetPos();
4423                                         System.Parsing.Match match(false);
4424                                         if (*lexer == LPAREN)
4425                                         {
4426                                             auto incResult0 = ++lexer;
4427                                             if (incResult0.Error())
4428                                             {
4429                                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
4430                                             }
4431                                             match.hit = true;
4432                                         }
4433                                         if (match.hit)
4434                                         {
4435                                             functionCall.Reset(new System.XPath.FunctionCall(functionName->value));
4436                                         }
4437                                         *parentMatch6 = match;
4438                                     }
4439                                     *parentMatch5 = match;
4440                                 }
4441                                 *parentMatch4 = match;
4442                             }
4443                             *parentMatch3 = match;
4444                         }
4445                         if (match.hit)
4446                         {
4447                             System.Parsing.Match match(false);
4448                             System.Parsing.Match* parentMatch7 = &match;
4449                             {
4450                                 System.Parsing.Match match(true);
4451                                 long save = lexer.GetPos();
4452                                 System.Parsing.Match* parentMatch8 = &match;
4453                                 {
4454                                     System.Parsing.Match match(false);
4455                                     System.Parsing.Match* parentMatch9 = &match;
4456                                     {
4457                                         System.Parsing.Match match(false);
4458                                         System.Parsing.Match* parentMatch10 = &match;
4459                                         {
4460                                             System.Parsing.Match match(false);
4461                                             System.Parsing.Match* parentMatch11 = &match;
4462                                             {
4463                                                 long pos = lexer.GetPos();
4464                                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.Argument(lexer);
4465                                                 if (matchResult.Error())
4466                                                 {
4467                                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
4468                                                 }
4469                                                 System.Parsing.Match match = matchResult.Value();
4470                                                 arg.Reset(cast<System.XPath.Expr*>(match.value));
4471                                                 if (match.hit)
4472                                                 {
4473                                                     functionCall->AddArgument(arg.Release());
4474                                                 }
4475                                                 *parentMatch11 = match;
4476                                             }
4477                                             *parentMatch10 = match;
4478                                         }
4479                                         if (match.hit)
4480                                         {
4481                                             System.Parsing.Match match(false);
4482                                             System.Parsing.Match* parentMatch12 = &match;
4483                                             {
4484                                                 System.Parsing.Match match(true);
4485                                                 System.Parsing.Match* parentMatch13 = &match;
4486                                                 {
4487                                                     while (true)
4488                                                     {
4489                                                         long save = lexer.GetPos();
4490                                                         {
4491                                                             System.Parsing.Match match(false);
4492                                                             System.Parsing.Match* parentMatch14 = &match;
4493                                                             {
4494                                                                 System.Parsing.Match match(false);
4495                                                                 if (*lexer == COMMA)
4496                                                                 {
4497                                                                     auto incResult1 = ++lexer;
4498                                                                     if (incResult1.Error())
4499                                                                     {
4500                                                                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult1.GetErrorId()));
4501                                                                     }
4502                                                                     match.hit = true;
4503                                                                 }
4504                                                                 *parentMatch14 = match;
4505                                                             }
4506                                                             if (match.hit)
4507                                                             {
4508                                                                 System.Parsing.Match match(false);
4509                                                                 System.Parsing.Match* parentMatch15 = &match;
4510                                                                 {
4511                                                                     System.Parsing.Match match(false);
4512                                                                     System.Parsing.Match* parentMatch16 = &match;
4513                                                                     {
4514                                                                         long pos = lexer.GetPos();
4515                                                                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.Argument(lexer);
4516                                                                         if (matchResult.Error())
4517                                                                         {
4518                                                                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
4519                                                                         }
4520                                                                         System.Parsing.Match match = matchResult.Value();
4521                                                                         arg.Reset(cast<System.XPath.Expr*>(match.value));
4522                                                                         if (match.hit)
4523                                                                         {
4524                                                                             functionCall->AddArgument(arg.Release());
4525                                                                         }
4526                                                                         *parentMatch16 = match;
4527                                                                     }
4528                                                                     *parentMatch15 = match;
4529                                                                 }
4530                                                                 *parentMatch14 = match;
4531                                                             }
4532                                                             if (match.hit)
4533                                                             {
4534                                                                 *parentMatch13 = match;
4535                                                             }
4536                                                             else
4537                                                             {
4538                                                                 lexer.SetPos(save);
4539                                                                 break;
4540                                                             }
4541                                                         }
4542                                                     }
4543                                                 }
4544                                                 *parentMatch12 = match;
4545                                             }
4546                                             *parentMatch10 = match;
4547                                         }
4548                                         *parentMatch9 = match;
4549                                     }
4550                                     if (match.hit)
4551                                     {
4552                                         *parentMatch8 = match;
4553                                     }
4554                                     else
4555                                     {
4556                                         lexer.SetPos(save);
4557                                     }
4558                                 }
4559                                 *parentMatch7 = match;
4560                             }
4561                             *parentMatch3 = match;
4562                         }
4563                         *parentMatch2 = match;
4564                     }
4565                     if (match.hit)
4566                     {
4567                         System.Parsing.Match match(false);
4568                         System.Parsing.Match* parentMatch17 = &match;
4569                         {
4570                             System.Parsing.Match match(false);
4571                             if (*lexer == RPAREN)
4572                             {
4573                                 auto incResult2 = ++lexer;
4574                                 if (incResult2.Error())
4575                                 {
4576                                     return System.Result<System.Parsing.Match>(System.ErrorId(incResult2.GetErrorId()));
4577                                 }
4578                                 match.hit = true;
4579                             }
4580                             *parentMatch17 = match;
4581                         }
4582                         *parentMatch2 = match;
4583                     }
4584                     *parentMatch1 = match;
4585                 }
4586                 if (match.hit)
4587                 {
4588                     #if (DEBUG)
4589                         if (parser_debug_write_to_log)
4590                         {
4591                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"FunctionCall");
4592                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4593                         }
4594                     #endif
4595                     return System.Result<System.Parsing.Match>(System.Parsing.Match(truefunctionCall.Release()));
4596                 }
4597                 *parentMatch0 = match;
4598             }
4599             #if (DEBUG)
4600             if (parser_debug_write_to_log)
4601             {
4602                 if (match.hit)
4603                 {
4604                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"FunctionCall");
4605                     if (result.Error())
4606                     {
4607                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4608                     }
4609                 }
4610                 else
4611                 {
4612                     auto result = System.Lex.WriteFailureToLog(lexeru"FunctionCall");
4613                     if (result.Error())
4614                     {
4615                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4616                     }
4617                 }
4618             }
4619             #endif
4620             if (!match.hit)
4621             {
4622                 match.value = null;
4623             }
4624             return System.Result<System.Parsing.Match>(match);
4625         }
4626         public static System.Result<System.Parsing.Match> FunctionName(LexerT& lexer)
4627         {
4628             #if (DEBUG)
4629             long parser_debug_match_pos = 0;
4630             bool parser_debug_write_to_log = lexer.Log() != null;
4631             if (parser_debug_write_to_log)
4632             {
4633                 parser_debug_match_pos = lexer.GetPos();
4634                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"FunctionName");
4635                 if (result.Error())
4636                 {
4637                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4638                 }
4639             }
4640             #endif
4641             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434464);
4642             System.UniquePtr<System.Parsing.Value<string>> qname;
4643             System.UniquePtr<System.XPath.NodeTest> nodeType;
4644             System.Parsing.Match match(false);
4645             System.Parsing.Match* parentMatch0 = &match;
4646             {
4647                 long pos = lexer.GetPos();
4648                 System.Parsing.Match match(false);
4649                 System.Parsing.Match* parentMatch1 = &match;
4650                 {
4651                     System.Parsing.Match match(false);
4652                     System.Parsing.Match* parentMatch2 = &match;
4653                     long save = lexer.GetPos();
4654                     {
4655                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.QName(lexer);
4656                         if (matchResult.Error())
4657                         {
4658                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
4659                         }
4660                         System.Parsing.Match match = matchResult.Value();
4661                         qname.Reset(cast<System.Parsing.Value<string>*>(match.value));
4662                         *parentMatch2 = match;
4663                     }
4664                     if (match.hit)
4665                     {
4666                         System.Parsing.Match match(false);
4667                         System.Parsing.Match* parentMatch3 = &match;
4668                         {
4669                             long tmp = lexer.GetPos();
4670                             lexer.SetPos(save);
4671                             save = tmp;
4672                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.NodeType(lexer);
4673                             if (matchResult.Error())
4674                             {
4675                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
4676                             }
4677                             System.Parsing.Match match = matchResult.Value();
4678                             nodeType.Reset(cast<System.XPath.NodeTest*>(match.value));
4679                             *parentMatch3 = match;
4680                         }
4681                         if (!match.hit)
4682                         {
4683                             lexer.SetPos(save);
4684                         }
4685                         *parentMatch2 = System.Parsing.Match(!match.hitmatch.value);
4686                     }
4687                     *parentMatch1 = match;
4688                 }
4689                 if (match.hit)
4690                 {
4691                     #if (DEBUG)
4692                         if (parser_debug_write_to_log)
4693                         {
4694                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"FunctionName");
4695                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4696                         }
4697                     #endif
4698                     return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<string>(qname->value)));
4699                 }
4700                 *parentMatch0 = match;
4701             }
4702             #if (DEBUG)
4703             if (parser_debug_write_to_log)
4704             {
4705                 if (match.hit)
4706                 {
4707                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"FunctionName");
4708                     if (result.Error())
4709                     {
4710                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4711                     }
4712                 }
4713                 else
4714                 {
4715                     auto result = System.Lex.WriteFailureToLog(lexeru"FunctionName");
4716                     if (result.Error())
4717                     {
4718                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4719                     }
4720                 }
4721             }
4722             #endif
4723             if (!match.hit)
4724             {
4725                 match.value = null;
4726             }
4727             return System.Result<System.Parsing.Match>(match);
4728         }
4729         public static System.Result<System.Parsing.Match> Argument(LexerT& lexer)
4730         {
4731             #if (DEBUG)
4732             long parser_debug_match_pos = 0;
4733             bool parser_debug_write_to_log = lexer.Log() != null;
4734             if (parser_debug_write_to_log)
4735             {
4736                 parser_debug_match_pos = lexer.GetPos();
4737                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"Argument");
4738                 if (result.Error())
4739                 {
4740                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4741                 }
4742             }
4743             #endif
4744             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434465);
4745             System.UniquePtr<System.XPath.Expr> expr;
4746             System.Parsing.Match match(false);
4747             System.Parsing.Match* parentMatch0 = &match;
4748             {
4749                 long pos = lexer.GetPos();
4750                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.Expr(lexer);
4751                 if (matchResult.Error())
4752                 {
4753                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
4754                 }
4755                 System.Parsing.Match match = matchResult.Value();
4756                 expr.Reset(cast<System.XPath.Expr*>(match.value));
4757                 if (match.hit)
4758                 {
4759                     #if (DEBUG)
4760                         if (parser_debug_write_to_log)
4761                         {
4762                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Argument");
4763                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4764                         }
4765                     #endif
4766                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueexpr.Release()));
4767                 }
4768                 *parentMatch0 = match;
4769             }
4770             #if (DEBUG)
4771             if (parser_debug_write_to_log)
4772             {
4773                 if (match.hit)
4774                 {
4775                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Argument");
4776                     if (result.Error())
4777                     {
4778                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4779                     }
4780                 }
4781                 else
4782                 {
4783                     auto result = System.Lex.WriteFailureToLog(lexeru"Argument");
4784                     if (result.Error())
4785                     {
4786                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4787                     }
4788                 }
4789             }
4790             #endif
4791             if (!match.hit)
4792             {
4793                 match.value = null;
4794             }
4795             return System.Result<System.Parsing.Match>(match);
4796         }
4797         public static System.Result<System.Parsing.Match> FilterExpr(LexerT& lexer)
4798         {
4799             #if (DEBUG)
4800             long parser_debug_match_pos = 0;
4801             bool parser_debug_write_to_log = lexer.Log() != null;
4802             if (parser_debug_write_to_log)
4803             {
4804                 parser_debug_match_pos = lexer.GetPos();
4805                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"FilterExpr");
4806                 if (result.Error())
4807                 {
4808                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4809                 }
4810             }
4811             #endif
4812             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434466);
4813             UniquePtr<System.XPath.Expr> expr = UniquePtr<System.XPath.Expr>();
4814             System.UniquePtr<System.XPath.Expr> primaryExpr;
4815             System.UniquePtr<System.XPath.Expr> predicate;
4816             System.Parsing.Match match(false);
4817             System.Parsing.Match* parentMatch0 = &match;
4818             {
4819                 long pos = lexer.GetPos();
4820                 System.Parsing.Match match(false);
4821                 System.Parsing.Match* parentMatch1 = &match;
4822                 {
4823                     System.Parsing.Match match(false);
4824                     System.Parsing.Match* parentMatch2 = &match;
4825                     {
4826                         System.Parsing.Match match(false);
4827                         System.Parsing.Match* parentMatch3 = &match;
4828                         {
4829                             long pos = lexer.GetPos();
4830                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.PrimaryExpr(lexer);
4831                             if (matchResult.Error())
4832                             {
4833                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
4834                             }
4835                             System.Parsing.Match match = matchResult.Value();
4836                             primaryExpr.Reset(cast<System.XPath.Expr*>(match.value));
4837                             if (match.hit)
4838                             {
4839                                 expr.Reset(primaryExpr.Release());
4840                             }
4841                             *parentMatch3 = match;
4842                         }
4843                         *parentMatch2 = match;
4844                     }
4845                     if (match.hit)
4846                     {
4847                         System.Parsing.Match match(false);
4848                         System.Parsing.Match* parentMatch4 = &match;
4849                         {
4850                             System.Parsing.Match match(true);
4851                             System.Parsing.Match* parentMatch5 = &match;
4852                             {
4853                                 while (true)
4854                                 {
4855                                     long save = lexer.GetPos();
4856                                     {
4857                                         System.Parsing.Match match(false);
4858                                         System.Parsing.Match* parentMatch6 = &match;
4859                                         {
4860                                             System.Parsing.Match match(false);
4861                                             System.Parsing.Match* parentMatch7 = &match;
4862                                             {
4863                                                 long pos = lexer.GetPos();
4864                                                 System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.Predicate(lexer);
4865                                                 if (matchResult.Error())
4866                                                 {
4867                                                     return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
4868                                                 }
4869                                                 System.Parsing.Match match = matchResult.Value();
4870                                                 predicate.Reset(cast<System.XPath.Expr*>(match.value));
4871                                                 if (match.hit)
4872                                                 {
4873                                                     expr.Reset(new System.XPath.FilterExpr(expr.Release()predicate.Release()));
4874                                                 }
4875                                                 *parentMatch7 = match;
4876                                             }
4877                                             *parentMatch6 = match;
4878                                         }
4879                                         if (match.hit)
4880                                         {
4881                                             *parentMatch5 = match;
4882                                         }
4883                                         else
4884                                         {
4885                                             lexer.SetPos(save);
4886                                             break;
4887                                         }
4888                                     }
4889                                 }
4890                             }
4891                             *parentMatch4 = match;
4892                         }
4893                         *parentMatch2 = match;
4894                     }
4895                     *parentMatch1 = match;
4896                 }
4897                 if (match.hit)
4898                 {
4899                     #if (DEBUG)
4900                         if (parser_debug_write_to_log)
4901                         {
4902                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"FilterExpr");
4903                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4904                         }
4905                     #endif
4906                     return System.Result<System.Parsing.Match>(System.Parsing.Match(trueexpr.Release()));
4907                 }
4908                 *parentMatch0 = match;
4909             }
4910             #if (DEBUG)
4911             if (parser_debug_write_to_log)
4912             {
4913                 if (match.hit)
4914                 {
4915                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"FilterExpr");
4916                     if (result.Error())
4917                     {
4918                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4919                     }
4920                 }
4921                 else
4922                 {
4923                     auto result = System.Lex.WriteFailureToLog(lexeru"FilterExpr");
4924                     if (result.Error())
4925                     {
4926                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4927                     }
4928                 }
4929             }
4930             #endif
4931             if (!match.hit)
4932             {
4933                 match.value = null;
4934             }
4935             return System.Result<System.Parsing.Match>(match);
4936         }
4937         public static System.Result<System.Parsing.Match> PrimaryExpr(LexerT& lexer)
4938         {
4939             #if (DEBUG)
4940             long parser_debug_match_pos = 0;
4941             bool parser_debug_write_to_log = lexer.Log() != null;
4942             if (parser_debug_write_to_log)
4943             {
4944                 parser_debug_match_pos = lexer.GetPos();
4945                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"PrimaryExpr");
4946                 if (result.Error())
4947                 {
4948                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4949                 }
4950             }
4951             #endif
4952             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434467);
4953             System.UniquePtr<System.XPath.Expr> functionCall;
4954             System.UniquePtr<System.XPath.Expr> variableReference;
4955             System.UniquePtr<System.XPath.Expr> expr;
4956             System.UniquePtr<System.XPath.Literal> literal;
4957             System.UniquePtr<System.XPath.Expr> number;
4958             System.Parsing.Match match(false);
4959             System.Parsing.Match* parentMatch0 = &match;
4960             switch (*lexer)
4961             {
4962                 case NAME:
4963                 {
4964                     System.Parsing.Match match(false);
4965                     System.Parsing.Match* parentMatch1 = &match;
4966                     {
4967                         long pos = lexer.GetPos();
4968                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.FunctionCall(lexer);
4969                         if (matchResult.Error())
4970                         {
4971                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
4972                         }
4973                         System.Parsing.Match match = matchResult.Value();
4974                         functionCall.Reset(cast<System.XPath.Expr*>(match.value));
4975                         if (match.hit)
4976                         {
4977                             #if (DEBUG)
4978                                 if (parser_debug_write_to_log)
4979                                 {
4980                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"PrimaryExpr");
4981                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
4982                                 }
4983                             #endif
4984                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truefunctionCall.Release()));
4985                         }
4986                         *parentMatch1 = match;
4987                     }
4988                     if (match.hit)
4989                     {
4990                         *parentMatch0 = match;
4991                     }
4992                     break;
4993                 }
4994                 case DOLLAR:
4995                 {
4996                     System.Parsing.Match match(false);
4997                     System.Parsing.Match* parentMatch2 = &match;
4998                     {
4999                         long pos = lexer.GetPos();
5000                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.VariableReference(lexer);
5001                         if (matchResult.Error())
5002                         {
5003                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
5004                         }
5005                         System.Parsing.Match match = matchResult.Value();
5006                         variableReference.Reset(cast<System.XPath.Expr*>(match.value));
5007                         if (match.hit)
5008                         {
5009                             #if (DEBUG)
5010                                 if (parser_debug_write_to_log)
5011                                 {
5012                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"PrimaryExpr");
5013                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5014                                 }
5015                             #endif
5016                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truevariableReference.Release()));
5017                         }
5018                         *parentMatch2 = match;
5019                     }
5020                     if (match.hit)
5021                     {
5022                         *parentMatch0 = match;
5023                     }
5024                     break;
5025                 }
5026                 case LPAREN:
5027                 {
5028                     System.Parsing.Match match(false);
5029                     System.Parsing.Match* parentMatch3 = &match;
5030                     {
5031                         long pos = lexer.GetPos();
5032                         System.Parsing.Match match(false);
5033                         System.Parsing.Match* parentMatch4 = &match;
5034                         {
5035                             System.Parsing.Match match(false);
5036                             System.Parsing.Match* parentMatch5 = &match;
5037                             {
5038                                 System.Parsing.Match match(false);
5039                                 System.Parsing.Match* parentMatch6 = &match;
5040                                 {
5041                                     System.Parsing.Match match(false);
5042                                     if (*lexer == LPAREN)
5043                                     {
5044                                         auto incResult0 = ++lexer;
5045                                         if (incResult0.Error())
5046                                         {
5047                                             return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
5048                                         }
5049                                         match.hit = true;
5050                                     }
5051                                     *parentMatch6 = match;
5052                                 }
5053                                 if (match.hit)
5054                                 {
5055                                     System.Parsing.Match match(false);
5056                                     System.Parsing.Match* parentMatch7 = &match;
5057                                     {
5058                                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.Expr(lexer);
5059                                         if (matchResult.Error())
5060                                         {
5061                                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
5062                                         }
5063                                         System.Parsing.Match match = matchResult.Value();
5064                                         expr.Reset(cast<System.XPath.Expr*>(match.value));
5065                                         *parentMatch7 = match;
5066                                     }
5067                                     *parentMatch6 = match;
5068                                 }
5069                                 *parentMatch5 = match;
5070                             }
5071                             if (match.hit)
5072                             {
5073                                 System.Parsing.Match match(false);
5074                                 System.Parsing.Match* parentMatch8 = &match;
5075                                 {
5076                                     System.Parsing.Match match(false);
5077                                     if (*lexer == RPAREN)
5078                                     {
5079                                         auto incResult1 = ++lexer;
5080                                         if (incResult1.Error())
5081                                         {
5082                                             return System.Result<System.Parsing.Match>(System.ErrorId(incResult1.GetErrorId()));
5083                                         }
5084                                         match.hit = true;
5085                                     }
5086                                     *parentMatch8 = match;
5087                                 }
5088                                 *parentMatch5 = match;
5089                             }
5090                             *parentMatch4 = match;
5091                         }
5092                         if (match.hit)
5093                         {
5094                             #if (DEBUG)
5095                                 if (parser_debug_write_to_log)
5096                                 {
5097                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"PrimaryExpr");
5098                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5099                                 }
5100                             #endif
5101                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.UnaryExpr(System.XPath.Operator.parensexpr.Release())));
5102                         }
5103                         *parentMatch3 = match;
5104                     }
5105                     if (match.hit)
5106                     {
5107                         *parentMatch0 = match;
5108                     }
5109                     break;
5110                 }
5111                 case DQ_STRING:
5112                 case SQ_STRING:
5113                 {
5114                     System.Parsing.Match match(false);
5115                     System.Parsing.Match* parentMatch9 = &match;
5116                     {
5117                         long pos = lexer.GetPos();
5118                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.Literal(lexer);
5119                         if (matchResult.Error())
5120                         {
5121                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
5122                         }
5123                         System.Parsing.Match match = matchResult.Value();
5124                         literal.Reset(cast<System.XPath.Literal*>(match.value));
5125                         if (match.hit)
5126                         {
5127                             #if (DEBUG)
5128                                 if (parser_debug_write_to_log)
5129                                 {
5130                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"PrimaryExpr");
5131                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5132                                 }
5133                             #endif
5134                             return System.Result<System.Parsing.Match>(System.Parsing.Match(trueliteral.Release()));
5135                         }
5136                         *parentMatch9 = match;
5137                     }
5138                     if (match.hit)
5139                     {
5140                         *parentMatch0 = match;
5141                     }
5142                     break;
5143                 }
5144                 case NUMBER:
5145                 {
5146                     System.Parsing.Match match(false);
5147                     System.Parsing.Match* parentMatch10 = &match;
5148                     {
5149                         long pos = lexer.GetPos();
5150                         System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.Number(lexer);
5151                         if (matchResult.Error())
5152                         {
5153                             return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
5154                         }
5155                         System.Parsing.Match match = matchResult.Value();
5156                         number.Reset(cast<System.XPath.Expr*>(match.value));
5157                         if (match.hit)
5158                         {
5159                             #if (DEBUG)
5160                                 if (parser_debug_write_to_log)
5161                                 {
5162                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"PrimaryExpr");
5163                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5164                                 }
5165                             #endif
5166                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenumber.Release()));
5167                         }
5168                         *parentMatch10 = match;
5169                     }
5170                     if (match.hit)
5171                     {
5172                         *parentMatch0 = match;
5173                     }
5174                     break;
5175                 }
5176             }
5177             #if (DEBUG)
5178             if (parser_debug_write_to_log)
5179             {
5180                 if (match.hit)
5181                 {
5182                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"PrimaryExpr");
5183                     if (result.Error())
5184                     {
5185                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5186                     }
5187                 }
5188                 else
5189                 {
5190                     auto result = System.Lex.WriteFailureToLog(lexeru"PrimaryExpr");
5191                     if (result.Error())
5192                     {
5193                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5194                     }
5195                 }
5196             }
5197             #endif
5198             if (!match.hit)
5199             {
5200                 match.value = null;
5201             }
5202             return System.Result<System.Parsing.Match>(match);
5203         }
5204         public static System.Result<System.Parsing.Match> VariableReference(LexerT& lexer)
5205         {
5206             #if (DEBUG)
5207             long parser_debug_match_pos = 0;
5208             bool parser_debug_write_to_log = lexer.Log() != null;
5209             if (parser_debug_write_to_log)
5210             {
5211                 parser_debug_match_pos = lexer.GetPos();
5212                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"VariableReference");
5213                 if (result.Error())
5214                 {
5215                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5216                 }
5217             }
5218             #endif
5219             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434468);
5220             System.UniquePtr<System.Parsing.Value<string>> qname;
5221             System.Parsing.Match match(false);
5222             System.Parsing.Match* parentMatch0 = &match;
5223             {
5224                 long pos = lexer.GetPos();
5225                 System.Parsing.Match match(false);
5226                 System.Parsing.Match* parentMatch1 = &match;
5227                 {
5228                     System.Parsing.Match match(false);
5229                     System.Parsing.Match* parentMatch2 = &match;
5230                     {
5231                         System.Parsing.Match match(false);
5232                         if (*lexer == DOLLAR)
5233                         {
5234                             auto incResult0 = ++lexer;
5235                             if (incResult0.Error())
5236                             {
5237                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
5238                             }
5239                             match.hit = true;
5240                         }
5241                         *parentMatch2 = match;
5242                     }
5243                     if (match.hit)
5244                     {
5245                         System.Parsing.Match match(false);
5246                         System.Parsing.Match* parentMatch3 = &match;
5247                         {
5248                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.QName(lexer);
5249                             if (matchResult.Error())
5250                             {
5251                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
5252                             }
5253                             System.Parsing.Match match = matchResult.Value();
5254                             qname.Reset(cast<System.Parsing.Value<string>*>(match.value));
5255                             *parentMatch3 = match;
5256                         }
5257                         *parentMatch2 = match;
5258                     }
5259                     *parentMatch1 = match;
5260                 }
5261                 if (match.hit)
5262                 {
5263                     #if (DEBUG)
5264                         if (parser_debug_write_to_log)
5265                         {
5266                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"VariableReference");
5267                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5268                         }
5269                     #endif
5270                     return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.VariableReference(qname->value)));
5271                 }
5272                 *parentMatch0 = match;
5273             }
5274             #if (DEBUG)
5275             if (parser_debug_write_to_log)
5276             {
5277                 if (match.hit)
5278                 {
5279                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"VariableReference");
5280                     if (result.Error())
5281                     {
5282                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5283                     }
5284                 }
5285                 else
5286                 {
5287                     auto result = System.Lex.WriteFailureToLog(lexeru"VariableReference");
5288                     if (result.Error())
5289                     {
5290                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5291                     }
5292                 }
5293             }
5294             #endif
5295             if (!match.hit)
5296             {
5297                 match.value = null;
5298             }
5299             return System.Result<System.Parsing.Match>(match);
5300         }
5301         public static System.Result<System.Parsing.Match> Number(LexerT& lexer)
5302         {
5303             #if (DEBUG)
5304             long parser_debug_match_pos = 0;
5305             bool parser_debug_write_to_log = lexer.Log() != null;
5306             if (parser_debug_write_to_log)
5307             {
5308                 parser_debug_match_pos = lexer.GetPos();
5309                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"Number");
5310                 if (result.Error())
5311                 {
5312                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5313                 }
5314             }
5315             #endif
5316             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434469);
5317             System.Parsing.Match match(false);
5318             System.Parsing.Match* parentMatch0 = &match;
5319             {
5320                 long pos = lexer.GetPos();
5321                 System.Parsing.Match match(false);
5322                 if (*lexer == NUMBER)
5323                 {
5324                     auto incResult0 = ++lexer;
5325                     if (incResult0.Error())
5326                     {
5327                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
5328                     }
5329                     match.hit = true;
5330                 }
5331                 if (match.hit)
5332                 {
5333                     #if (DEBUG)
5334                         if (parser_debug_write_to_log)
5335                         {
5336                             auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Number");
5337                             if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5338                         }
5339                     #endif
5340                     auto number = lexer.GetDouble(pos);
5341                     if (number.Error())
5342                     {
5343                         return System.Result<System.Parsing.Match>(ErrorId(number.GetErrorId()));
5344                     }
5345                     return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.XPath.NumberExpr(number.Value())));
5346                 }
5347                 *parentMatch0 = match;
5348             }
5349             #if (DEBUG)
5350             if (parser_debug_write_to_log)
5351             {
5352                 if (match.hit)
5353                 {
5354                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"Number");
5355                     if (result.Error())
5356                     {
5357                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5358                     }
5359                 }
5360                 else
5361                 {
5362                     auto result = System.Lex.WriteFailureToLog(lexeru"Number");
5363                     if (result.Error())
5364                     {
5365                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5366                     }
5367                 }
5368             }
5369             #endif
5370             if (!match.hit)
5371             {
5372                 match.value = null;
5373             }
5374             return System.Result<System.Parsing.Match>(match);
5375         }
5376         public static System.Result<System.Parsing.Match> EqualityOp(LexerT& lexer)
5377         {
5378             #if (DEBUG)
5379             long parser_debug_match_pos = 0;
5380             bool parser_debug_write_to_log = lexer.Log() != null;
5381             if (parser_debug_write_to_log)
5382             {
5383                 parser_debug_match_pos = lexer.GetPos();
5384                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"EqualityOp");
5385                 if (result.Error())
5386                 {
5387                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5388                 }
5389             }
5390             #endif
5391             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434470);
5392             System.Parsing.Match match(false);
5393             System.Parsing.Match* parentMatch0 = &match;
5394             switch (*lexer)
5395             {
5396                 case EQ:
5397                 {
5398                     System.Parsing.Match match(false);
5399                     System.Parsing.Match* parentMatch1 = &match;
5400                     {
5401                         long pos = lexer.GetPos();
5402                         System.Parsing.Match match(false);
5403                         if (*lexer == EQ)
5404                         {
5405                             auto incResult0 = ++lexer;
5406                             if (incResult0.Error())
5407                             {
5408                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
5409                             }
5410                             match.hit = true;
5411                         }
5412                         if (match.hit)
5413                         {
5414                             #if (DEBUG)
5415                                 if (parser_debug_write_to_log)
5416                                 {
5417                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"EqualityOp");
5418                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5419                                 }
5420                             #endif
5421                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.XPath.Operator>(System.XPath.Operator.equal)));
5422                         }
5423                         *parentMatch1 = match;
5424                     }
5425                     if (match.hit)
5426                     {
5427                         *parentMatch0 = match;
5428                     }
5429                     break;
5430                 }
5431                 case NEQ:
5432                 {
5433                     System.Parsing.Match match(false);
5434                     System.Parsing.Match* parentMatch2 = &match;
5435                     {
5436                         long pos = lexer.GetPos();
5437                         System.Parsing.Match match(false);
5438                         if (*lexer == NEQ)
5439                         {
5440                             auto incResult1 = ++lexer;
5441                             if (incResult1.Error())
5442                             {
5443                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult1.GetErrorId()));
5444                             }
5445                             match.hit = true;
5446                         }
5447                         if (match.hit)
5448                         {
5449                             #if (DEBUG)
5450                                 if (parser_debug_write_to_log)
5451                                 {
5452                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"EqualityOp");
5453                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5454                                 }
5455                             #endif
5456                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.XPath.Operator>(System.XPath.Operator.notEqual)));
5457                         }
5458                         *parentMatch2 = match;
5459                     }
5460                     if (match.hit)
5461                     {
5462                         *parentMatch0 = match;
5463                     }
5464                     break;
5465                 }
5466             }
5467             #if (DEBUG)
5468             if (parser_debug_write_to_log)
5469             {
5470                 if (match.hit)
5471                 {
5472                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"EqualityOp");
5473                     if (result.Error())
5474                     {
5475                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5476                     }
5477                 }
5478                 else
5479                 {
5480                     auto result = System.Lex.WriteFailureToLog(lexeru"EqualityOp");
5481                     if (result.Error())
5482                     {
5483                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5484                     }
5485                 }
5486             }
5487             #endif
5488             if (!match.hit)
5489             {
5490                 match.value = null;
5491             }
5492             return System.Result<System.Parsing.Match>(match);
5493         }
5494         public static System.Result<System.Parsing.Match> RelationalOp(LexerT& lexer)
5495         {
5496             #if (DEBUG)
5497             long parser_debug_match_pos = 0;
5498             bool parser_debug_write_to_log = lexer.Log() != null;
5499             if (parser_debug_write_to_log)
5500             {
5501                 parser_debug_match_pos = lexer.GetPos();
5502                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"RelationalOp");
5503                 if (result.Error())
5504                 {
5505                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5506                 }
5507             }
5508             #endif
5509             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434471);
5510             System.Parsing.Match match(false);
5511             System.Parsing.Match* parentMatch0 = &match;
5512             switch (*lexer)
5513             {
5514                 case LESS:
5515                 {
5516                     System.Parsing.Match match(false);
5517                     System.Parsing.Match* parentMatch1 = &match;
5518                     {
5519                         long pos = lexer.GetPos();
5520                         System.Parsing.Match match(false);
5521                         if (*lexer == LESS)
5522                         {
5523                             auto incResult0 = ++lexer;
5524                             if (incResult0.Error())
5525                             {
5526                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
5527                             }
5528                             match.hit = true;
5529                         }
5530                         if (match.hit)
5531                         {
5532                             #if (DEBUG)
5533                                 if (parser_debug_write_to_log)
5534                                 {
5535                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"RelationalOp");
5536                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5537                                 }
5538                             #endif
5539                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.XPath.Operator>(System.XPath.Operator.less)));
5540                         }
5541                         *parentMatch1 = match;
5542                     }
5543                     if (match.hit)
5544                     {
5545                         *parentMatch0 = match;
5546                     }
5547                     break;
5548                 }
5549                 case GREATER:
5550                 {
5551                     System.Parsing.Match match(false);
5552                     System.Parsing.Match* parentMatch2 = &match;
5553                     {
5554                         long pos = lexer.GetPos();
5555                         System.Parsing.Match match(false);
5556                         if (*lexer == GREATER)
5557                         {
5558                             auto incResult1 = ++lexer;
5559                             if (incResult1.Error())
5560                             {
5561                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult1.GetErrorId()));
5562                             }
5563                             match.hit = true;
5564                         }
5565                         if (match.hit)
5566                         {
5567                             #if (DEBUG)
5568                                 if (parser_debug_write_to_log)
5569                                 {
5570                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"RelationalOp");
5571                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5572                                 }
5573                             #endif
5574                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.XPath.Operator>(System.XPath.Operator.greater)));
5575                         }
5576                         *parentMatch2 = match;
5577                     }
5578                     if (match.hit)
5579                     {
5580                         *parentMatch0 = match;
5581                     }
5582                     break;
5583                 }
5584                 case LEQ:
5585                 {
5586                     System.Parsing.Match match(false);
5587                     System.Parsing.Match* parentMatch3 = &match;
5588                     {
5589                         long pos = lexer.GetPos();
5590                         System.Parsing.Match match(false);
5591                         if (*lexer == LEQ)
5592                         {
5593                             auto incResult2 = ++lexer;
5594                             if (incResult2.Error())
5595                             {
5596                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult2.GetErrorId()));
5597                             }
5598                             match.hit = true;
5599                         }
5600                         if (match.hit)
5601                         {
5602                             #if (DEBUG)
5603                                 if (parser_debug_write_to_log)
5604                                 {
5605                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"RelationalOp");
5606                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5607                                 }
5608                             #endif
5609                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.XPath.Operator>(System.XPath.Operator.lessOrEqual)));
5610                         }
5611                         *parentMatch3 = match;
5612                     }
5613                     if (match.hit)
5614                     {
5615                         *parentMatch0 = match;
5616                     }
5617                     break;
5618                 }
5619                 case GEQ:
5620                 {
5621                     System.Parsing.Match match(false);
5622                     System.Parsing.Match* parentMatch4 = &match;
5623                     {
5624                         long pos = lexer.GetPos();
5625                         System.Parsing.Match match(false);
5626                         if (*lexer == GEQ)
5627                         {
5628                             auto incResult3 = ++lexer;
5629                             if (incResult3.Error())
5630                             {
5631                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult3.GetErrorId()));
5632                             }
5633                             match.hit = true;
5634                         }
5635                         if (match.hit)
5636                         {
5637                             #if (DEBUG)
5638                                 if (parser_debug_write_to_log)
5639                                 {
5640                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"RelationalOp");
5641                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5642                                 }
5643                             #endif
5644                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.XPath.Operator>(System.XPath.Operator.greaterOrEqual)));
5645                         }
5646                         *parentMatch4 = match;
5647                     }
5648                     if (match.hit)
5649                     {
5650                         *parentMatch0 = match;
5651                     }
5652                     break;
5653                 }
5654             }
5655             #if (DEBUG)
5656             if (parser_debug_write_to_log)
5657             {
5658                 if (match.hit)
5659                 {
5660                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"RelationalOp");
5661                     if (result.Error())
5662                     {
5663                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5664                     }
5665                 }
5666                 else
5667                 {
5668                     auto result = System.Lex.WriteFailureToLog(lexeru"RelationalOp");
5669                     if (result.Error())
5670                     {
5671                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5672                     }
5673                 }
5674             }
5675             #endif
5676             if (!match.hit)
5677             {
5678                 match.value = null;
5679             }
5680             return System.Result<System.Parsing.Match>(match);
5681         }
5682         public static System.Result<System.Parsing.Match> AdditiveOp(LexerT& lexer)
5683         {
5684             #if (DEBUG)
5685             long parser_debug_match_pos = 0;
5686             bool parser_debug_write_to_log = lexer.Log() != null;
5687             if (parser_debug_write_to_log)
5688             {
5689                 parser_debug_match_pos = lexer.GetPos();
5690                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"AdditiveOp");
5691                 if (result.Error())
5692                 {
5693                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5694                 }
5695             }
5696             #endif
5697             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434472);
5698             System.Parsing.Match match(false);
5699             System.Parsing.Match* parentMatch0 = &match;
5700             switch (*lexer)
5701             {
5702                 case PLUS:
5703                 {
5704                     System.Parsing.Match match(false);
5705                     System.Parsing.Match* parentMatch1 = &match;
5706                     {
5707                         long pos = lexer.GetPos();
5708                         System.Parsing.Match match(false);
5709                         if (*lexer == PLUS)
5710                         {
5711                             auto incResult0 = ++lexer;
5712                             if (incResult0.Error())
5713                             {
5714                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
5715                             }
5716                             match.hit = true;
5717                         }
5718                         if (match.hit)
5719                         {
5720                             #if (DEBUG)
5721                                 if (parser_debug_write_to_log)
5722                                 {
5723                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AdditiveOp");
5724                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5725                                 }
5726                             #endif
5727                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.XPath.Operator>(System.XPath.Operator.plus)));
5728                         }
5729                         *parentMatch1 = match;
5730                     }
5731                     if (match.hit)
5732                     {
5733                         *parentMatch0 = match;
5734                     }
5735                     break;
5736                 }
5737                 case MINUS:
5738                 {
5739                     System.Parsing.Match match(false);
5740                     System.Parsing.Match* parentMatch2 = &match;
5741                     {
5742                         long pos = lexer.GetPos();
5743                         System.Parsing.Match match(false);
5744                         if (*lexer == MINUS)
5745                         {
5746                             auto incResult1 = ++lexer;
5747                             if (incResult1.Error())
5748                             {
5749                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult1.GetErrorId()));
5750                             }
5751                             match.hit = true;
5752                         }
5753                         if (match.hit)
5754                         {
5755                             #if (DEBUG)
5756                                 if (parser_debug_write_to_log)
5757                                 {
5758                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AdditiveOp");
5759                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5760                                 }
5761                             #endif
5762                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.XPath.Operator>(System.XPath.Operator.minus)));
5763                         }
5764                         *parentMatch2 = match;
5765                     }
5766                     if (match.hit)
5767                     {
5768                         *parentMatch0 = match;
5769                     }
5770                     break;
5771                 }
5772             }
5773             #if (DEBUG)
5774             if (parser_debug_write_to_log)
5775             {
5776                 if (match.hit)
5777                 {
5778                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AdditiveOp");
5779                     if (result.Error())
5780                     {
5781                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5782                     }
5783                 }
5784                 else
5785                 {
5786                     auto result = System.Lex.WriteFailureToLog(lexeru"AdditiveOp");
5787                     if (result.Error())
5788                     {
5789                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5790                     }
5791                 }
5792             }
5793             #endif
5794             if (!match.hit)
5795             {
5796                 match.value = null;
5797             }
5798             return System.Result<System.Parsing.Match>(match);
5799         }
5800         public static System.Result<System.Parsing.Match> MultiplicativeOp(LexerT& lexer)
5801         {
5802             #if (DEBUG)
5803             long parser_debug_match_pos = 0;
5804             bool parser_debug_write_to_log = lexer.Log() != null;
5805             if (parser_debug_write_to_log)
5806             {
5807                 parser_debug_match_pos = lexer.GetPos();
5808                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"MultiplicativeOp");
5809                 if (result.Error())
5810                 {
5811                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5812                 }
5813             }
5814             #endif
5815             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434473);
5816             System.Parsing.Match match(false);
5817             System.Parsing.Match* parentMatch0 = &match;
5818             {
5819                 long save = lexer.GetPos();
5820                 System.Parsing.Match match(false);
5821                 System.Parsing.Match* parentMatch1 = &match;
5822                 switch (*lexer)
5823                 {
5824                     case STAR:
5825                     {
5826                         System.Parsing.Match match(false);
5827                         System.Parsing.Match* parentMatch2 = &match;
5828                         {
5829                             long pos = lexer.GetPos();
5830                             System.Parsing.Match match(false);
5831                             if (*lexer == STAR)
5832                             {
5833                                 auto incResult0 = ++lexer;
5834                                 if (incResult0.Error())
5835                                 {
5836                                     return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
5837                                 }
5838                                 match.hit = true;
5839                             }
5840                             if (match.hit)
5841                             {
5842                                 #if (DEBUG)
5843                                     if (parser_debug_write_to_log)
5844                                     {
5845                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"MultiplicativeOp");
5846                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5847                                     }
5848                                 #endif
5849                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.XPath.Operator>(System.XPath.Operator.mul)));
5850                             }
5851                             *parentMatch2 = match;
5852                         }
5853                         if (match.hit)
5854                         {
5855                             *parentMatch1 = match;
5856                         }
5857                         break;
5858                     }
5859                     case NAME:
5860                     {
5861                         System.Parsing.Match match(false);
5862                         System.Parsing.Match* parentMatch3 = &match;
5863                         {
5864                             long pos = lexer.GetPos();
5865                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.DivKeyword(lexer);
5866                             if (matchResult.Error())
5867                             {
5868                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
5869                             }
5870                             System.Parsing.Match match = matchResult.Value();
5871                             if (match.hit)
5872                             {
5873                                 #if (DEBUG)
5874                                     if (parser_debug_write_to_log)
5875                                     {
5876                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"MultiplicativeOp");
5877                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5878                                     }
5879                                 #endif
5880                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.XPath.Operator>(System.XPath.Operator.div)));
5881                             }
5882                             *parentMatch3 = match;
5883                         }
5884                         if (match.hit)
5885                         {
5886                             *parentMatch1 = match;
5887                         }
5888                         break;
5889                     }
5890                 }
5891                 *parentMatch0 = match;
5892                 if (!match.hit)
5893                 {
5894                     System.Parsing.Match match(false);
5895                     System.Parsing.Match* parentMatch4 = &match;
5896                     lexer.SetPos(save);
5897                     {
5898                         System.Parsing.Match match(false);
5899                         System.Parsing.Match* parentMatch5 = &match;
5900                         {
5901                             long pos = lexer.GetPos();
5902                             System.Result<System.Parsing.Match> matchResult = System.XPath.XPathParser<LexerT>.ModKeyword(lexer);
5903                             if (matchResult.Error())
5904                             {
5905                                 return System.Result<System.Parsing.Match>(System.ErrorId(matchResult.GetErrorId()));
5906                             }
5907                             System.Parsing.Match match = matchResult.Value();
5908                             if (match.hit)
5909                             {
5910                                 #if (DEBUG)
5911                                     if (parser_debug_write_to_log)
5912                                     {
5913                                         auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"MultiplicativeOp");
5914                                         if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5915                                     }
5916                                 #endif
5917                                 return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.XPath.Operator>(System.XPath.Operator.mod)));
5918                             }
5919                             *parentMatch5 = match;
5920                         }
5921                         *parentMatch4 = match;
5922                     }
5923                     *parentMatch0 = match;
5924                 }
5925             }
5926             #if (DEBUG)
5927             if (parser_debug_write_to_log)
5928             {
5929                 if (match.hit)
5930                 {
5931                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"MultiplicativeOp");
5932                     if (result.Error())
5933                     {
5934                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5935                     }
5936                 }
5937                 else
5938                 {
5939                     auto result = System.Lex.WriteFailureToLog(lexeru"MultiplicativeOp");
5940                     if (result.Error())
5941                     {
5942                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5943                     }
5944                 }
5945             }
5946             #endif
5947             if (!match.hit)
5948             {
5949                 match.value = null;
5950             }
5951             return System.Result<System.Parsing.Match>(match);
5952         }
5953         public static System.Result<System.Parsing.Match> CombinePathOp(LexerT& lexer)
5954         {
5955             #if (DEBUG)
5956             long parser_debug_match_pos = 0;
5957             bool parser_debug_write_to_log = lexer.Log() != null;
5958             if (parser_debug_write_to_log)
5959             {
5960                 parser_debug_match_pos = lexer.GetPos();
5961                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"CombinePathOp");
5962                 if (result.Error())
5963                 {
5964                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5965                 }
5966             }
5967             #endif
5968             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434474);
5969             System.Parsing.Match match(false);
5970             System.Parsing.Match* parentMatch0 = &match;
5971             switch (*lexer)
5972             {
5973                 case SLASH:
5974                 {
5975                     System.Parsing.Match match(false);
5976                     System.Parsing.Match* parentMatch1 = &match;
5977                     {
5978                         long pos = lexer.GetPos();
5979                         System.Parsing.Match match(false);
5980                         if (*lexer == SLASH)
5981                         {
5982                             auto incResult0 = ++lexer;
5983                             if (incResult0.Error())
5984                             {
5985                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
5986                             }
5987                             match.hit = true;
5988                         }
5989                         if (match.hit)
5990                         {
5991                             #if (DEBUG)
5992                                 if (parser_debug_write_to_log)
5993                                 {
5994                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"CombinePathOp");
5995                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
5996                                 }
5997                             #endif
5998                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.XPath.Operator>(System.XPath.Operator.slash)));
5999                         }
6000                         *parentMatch1 = match;
6001                     }
6002                     if (match.hit)
6003                     {
6004                         *parentMatch0 = match;
6005                     }
6006                     break;
6007                 }
6008                 case SLASH_SLASH:
6009                 {
6010                     System.Parsing.Match match(false);
6011                     System.Parsing.Match* parentMatch2 = &match;
6012                     {
6013                         long pos = lexer.GetPos();
6014                         System.Parsing.Match match(false);
6015                         if (*lexer == SLASH_SLASH)
6016                         {
6017                             auto incResult1 = ++lexer;
6018                             if (incResult1.Error())
6019                             {
6020                                 return System.Result<System.Parsing.Match>(System.ErrorId(incResult1.GetErrorId()));
6021                             }
6022                             match.hit = true;
6023                         }
6024                         if (match.hit)
6025                         {
6026                             #if (DEBUG)
6027                                 if (parser_debug_write_to_log)
6028                                 {
6029                                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"CombinePathOp");
6030                                     if (result.Error()) return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6031                                 }
6032                             #endif
6033                             return System.Result<System.Parsing.Match>(System.Parsing.Match(truenew System.Parsing.Value<System.XPath.Operator>(System.XPath.Operator.slashSlash)));
6034                         }
6035                         *parentMatch2 = match;
6036                     }
6037                     if (match.hit)
6038                     {
6039                         *parentMatch0 = match;
6040                     }
6041                     break;
6042                 }
6043             }
6044             #if (DEBUG)
6045             if (parser_debug_write_to_log)
6046             {
6047                 if (match.hit)
6048                 {
6049                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"CombinePathOp");
6050                     if (result.Error())
6051                     {
6052                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6053                     }
6054                 }
6055                 else
6056                 {
6057                     auto result = System.Lex.WriteFailureToLog(lexeru"CombinePathOp");
6058                     if (result.Error())
6059                     {
6060                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6061                     }
6062                 }
6063             }
6064             #endif
6065             if (!match.hit)
6066             {
6067                 match.value = null;
6068             }
6069             return System.Result<System.Parsing.Match>(match);
6070         }
6071         public static System.Result<System.Parsing.Match> OrKeyword(LexerT& lexer)
6072         {
6073             #if (DEBUG)
6074             long parser_debug_match_pos = 0;
6075             bool parser_debug_write_to_log = lexer.Log() != null;
6076             if (parser_debug_write_to_log)
6077             {
6078                 parser_debug_match_pos = lexer.GetPos();
6079                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"OrKeyword");
6080                 if (result.Error())
6081                 {
6082                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6083                 }
6084             }
6085             #endif
6086             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434475);
6087             System.Parsing.Match match(false);
6088             System.Parsing.Match* parentMatch0 = &match;
6089             {
6090                 long pos = lexer.GetPos();
6091                 bool pass = true;
6092                 System.Parsing.Match match(false);
6093                 if (*lexer == NAME)
6094                 {
6095                     auto incResult0 = ++lexer;
6096                     if (incResult0.Error())
6097                     {
6098                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
6099                     }
6100                     match.hit = true;
6101                 }
6102                 if (match.hit)
6103                 {
6104                     pass = lexer.GetKeywordToken(lexer.GetToken(pos).match) == OR;
6105                 }
6106                 if (match.hit && !pass)
6107                 {
6108                     match = System.Parsing.Match(false);
6109                 }
6110                 *parentMatch0 = match;
6111             }
6112             #if (DEBUG)
6113             if (parser_debug_write_to_log)
6114             {
6115                 if (match.hit)
6116                 {
6117                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"OrKeyword");
6118                     if (result.Error())
6119                     {
6120                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6121                     }
6122                 }
6123                 else
6124                 {
6125                     auto result = System.Lex.WriteFailureToLog(lexeru"OrKeyword");
6126                     if (result.Error())
6127                     {
6128                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6129                     }
6130                 }
6131             }
6132             #endif
6133             if (!match.hit)
6134             {
6135                 match.value = null;
6136             }
6137             return System.Result<System.Parsing.Match>(match);
6138         }
6139         public static System.Result<System.Parsing.Match> AndKeyword(LexerT& lexer)
6140         {
6141             #if (DEBUG)
6142             long parser_debug_match_pos = 0;
6143             bool parser_debug_write_to_log = lexer.Log() != null;
6144             if (parser_debug_write_to_log)
6145             {
6146                 parser_debug_match_pos = lexer.GetPos();
6147                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"AndKeyword");
6148                 if (result.Error())
6149                 {
6150                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6151                 }
6152             }
6153             #endif
6154             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434476);
6155             System.Parsing.Match match(false);
6156             System.Parsing.Match* parentMatch0 = &match;
6157             {
6158                 long pos = lexer.GetPos();
6159                 bool pass = true;
6160                 System.Parsing.Match match(false);
6161                 if (*lexer == NAME)
6162                 {
6163                     auto incResult0 = ++lexer;
6164                     if (incResult0.Error())
6165                     {
6166                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
6167                     }
6168                     match.hit = true;
6169                 }
6170                 if (match.hit)
6171                 {
6172                     pass = lexer.GetKeywordToken(lexer.GetToken(pos).match) == AND;
6173                 }
6174                 if (match.hit && !pass)
6175                 {
6176                     match = System.Parsing.Match(false);
6177                 }
6178                 *parentMatch0 = match;
6179             }
6180             #if (DEBUG)
6181             if (parser_debug_write_to_log)
6182             {
6183                 if (match.hit)
6184                 {
6185                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"AndKeyword");
6186                     if (result.Error())
6187                     {
6188                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6189                     }
6190                 }
6191                 else
6192                 {
6193                     auto result = System.Lex.WriteFailureToLog(lexeru"AndKeyword");
6194                     if (result.Error())
6195                     {
6196                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6197                     }
6198                 }
6199             }
6200             #endif
6201             if (!match.hit)
6202             {
6203                 match.value = null;
6204             }
6205             return System.Result<System.Parsing.Match>(match);
6206         }
6207         public static System.Result<System.Parsing.Match> DivKeyword(LexerT& lexer)
6208         {
6209             #if (DEBUG)
6210             long parser_debug_match_pos = 0;
6211             bool parser_debug_write_to_log = lexer.Log() != null;
6212             if (parser_debug_write_to_log)
6213             {
6214                 parser_debug_match_pos = lexer.GetPos();
6215                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"DivKeyword");
6216                 if (result.Error())
6217                 {
6218                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6219                 }
6220             }
6221             #endif
6222             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434477);
6223             System.Parsing.Match match(false);
6224             System.Parsing.Match* parentMatch0 = &match;
6225             {
6226                 long pos = lexer.GetPos();
6227                 bool pass = true;
6228                 System.Parsing.Match match(false);
6229                 if (*lexer == NAME)
6230                 {
6231                     auto incResult0 = ++lexer;
6232                     if (incResult0.Error())
6233                     {
6234                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
6235                     }
6236                     match.hit = true;
6237                 }
6238                 if (match.hit)
6239                 {
6240                     pass = lexer.GetKeywordToken(lexer.GetToken(pos).match) == DIV;
6241                 }
6242                 if (match.hit && !pass)
6243                 {
6244                     match = System.Parsing.Match(false);
6245                 }
6246                 *parentMatch0 = match;
6247             }
6248             #if (DEBUG)
6249             if (parser_debug_write_to_log)
6250             {
6251                 if (match.hit)
6252                 {
6253                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"DivKeyword");
6254                     if (result.Error())
6255                     {
6256                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6257                     }
6258                 }
6259                 else
6260                 {
6261                     auto result = System.Lex.WriteFailureToLog(lexeru"DivKeyword");
6262                     if (result.Error())
6263                     {
6264                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6265                     }
6266                 }
6267             }
6268             #endif
6269             if (!match.hit)
6270             {
6271                 match.value = null;
6272             }
6273             return System.Result<System.Parsing.Match>(match);
6274         }
6275         public static System.Result<System.Parsing.Match> ModKeyword(LexerT& lexer)
6276         {
6277             #if (DEBUG)
6278             long parser_debug_match_pos = 0;
6279             bool parser_debug_write_to_log = lexer.Log() != null;
6280             if (parser_debug_write_to_log)
6281             {
6282                 parser_debug_match_pos = lexer.GetPos();
6283                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"ModKeyword");
6284                 if (result.Error())
6285                 {
6286                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6287                 }
6288             }
6289             #endif
6290             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434478);
6291             System.Parsing.Match match(false);
6292             System.Parsing.Match* parentMatch0 = &match;
6293             {
6294                 long pos = lexer.GetPos();
6295                 bool pass = true;
6296                 System.Parsing.Match match(false);
6297                 if (*lexer == NAME)
6298                 {
6299                     auto incResult0 = ++lexer;
6300                     if (incResult0.Error())
6301                     {
6302                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
6303                     }
6304                     match.hit = true;
6305                 }
6306                 if (match.hit)
6307                 {
6308                     pass = lexer.GetKeywordToken(lexer.GetToken(pos).match) == MOD;
6309                 }
6310                 if (match.hit && !pass)
6311                 {
6312                     match = System.Parsing.Match(false);
6313                 }
6314                 *parentMatch0 = match;
6315             }
6316             #if (DEBUG)
6317             if (parser_debug_write_to_log)
6318             {
6319                 if (match.hit)
6320                 {
6321                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"ModKeyword");
6322                     if (result.Error())
6323                     {
6324                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6325                     }
6326                 }
6327                 else
6328                 {
6329                     auto result = System.Lex.WriteFailureToLog(lexeru"ModKeyword");
6330                     if (result.Error())
6331                     {
6332                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6333                     }
6334                 }
6335             }
6336             #endif
6337             if (!match.hit)
6338             {
6339                 match.value = null;
6340             }
6341             return System.Result<System.Parsing.Match>(match);
6342         }
6343         public static System.Result<System.Parsing.Match> ProcessingInstructionKeyword(LexerT& lexer)
6344         {
6345             #if (DEBUG)
6346             long parser_debug_match_pos = 0;
6347             bool parser_debug_write_to_log = lexer.Log() != null;
6348             if (parser_debug_write_to_log)
6349             {
6350                 parser_debug_match_pos = lexer.GetPos();
6351                 auto result = System.Lex.WriteBeginRuleToLog(lexeru"ProcessingInstructionKeyword");
6352                 if (result.Error())
6353                 {
6354                     return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6355                 }
6356             }
6357             #endif
6358             System.Lex.RuleGuard<LexerT> ruleGuard(lexer4805966042268434479);
6359             System.Parsing.Match match(false);
6360             System.Parsing.Match* parentMatch0 = &match;
6361             {
6362                 long pos = lexer.GetPos();
6363                 bool pass = true;
6364                 System.Parsing.Match match(false);
6365                 if (*lexer == NAME)
6366                 {
6367                     auto incResult0 = ++lexer;
6368                     if (incResult0.Error())
6369                     {
6370                         return System.Result<System.Parsing.Match>(System.ErrorId(incResult0.GetErrorId()));
6371                     }
6372                     match.hit = true;
6373                 }
6374                 if (match.hit)
6375                 {
6376                     pass = lexer.GetKeywordToken(lexer.GetToken(pos).match) == PROCESSING_INSTRUCTION;
6377                 }
6378                 if (match.hit && !pass)
6379                 {
6380                     match = System.Parsing.Match(false);
6381                 }
6382                 *parentMatch0 = match;
6383             }
6384             #if (DEBUG)
6385             if (parser_debug_write_to_log)
6386             {
6387                 if (match.hit)
6388                 {
6389                     auto result = System.Lex.WriteSuccessToLog(lexerparser_debug_match_posu"ProcessingInstructionKeyword");
6390                     if (result.Error())
6391                     {
6392                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6393                     }
6394                 }
6395                 else
6396                 {
6397                     auto result = System.Lex.WriteFailureToLog(lexeru"ProcessingInstructionKeyword");
6398                     if (result.Error())
6399                     {
6400                         return System.Result<System.Parsing.Match>(System.ErrorId(result.GetErrorId()));
6401                     }
6402                 }
6403             }
6404             #endif
6405             if (!match.hit)
6406             {
6407                 match.value = null;
6408             }
6409             return System.Result<System.Parsing.Match>(match);
6410         }
6411     }
6412 }
6413 
6414 new class System.XPath.XPathParser<System.XPath.XPathLexer>;