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