forked from microsoft/cppgraphqlgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Grammar.h
1222 lines (971 loc) · 29.1 KB
/
Grammar.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//
// This grammar is based on the October 2021 Edition of the GraphQL spec:
// https://spec.graphql.org/October2021/
#pragma once
#ifndef GRAPHQLGRAMMAR_H
#define GRAPHQLGRAMMAR_H
#include "graphqlservice/internal/SyntaxTree.h"
#include <functional>
namespace graphql::peg {
using namespace tao::graphqlpeg;
template <typename Rule>
inline void for_each_child(const ast_node& n, std::function<void(const ast_node&)>&& func)
{
for (const auto& child : n.children)
{
if (child->is_type<Rule>())
{
func(*child);
}
}
}
template <typename Rule>
inline void on_first_child_if(const ast_node& n, std::function<bool(const ast_node&)>&& func)
{
for (const auto& child : n.children)
{
if (child->is_type<Rule>() && func(*child))
{
return;
}
}
}
template <typename Rule>
inline void on_first_child(const ast_node& n, std::function<void(const ast_node&)>&& func)
{
for (const auto& child : n.children)
{
if (child->is_type<Rule>())
{
func(*child);
return;
}
}
}
// https://spec.graphql.org/October2021/#sec-Source-Text
struct source_character : sor<one<0x0009, 0x000A, 0x000D>, utf8::range<0x0020, 0xFFFF>>
{
};
// https://spec.graphql.org/October2021/#sec-Comments
struct comment : seq<one<'#'>, until<eolf>>
{
};
// https://spec.graphql.org/October2021/#sec-Source-Text.Ignored-Tokens
struct ignored : sor<utf8::bom, space, one<','>, comment>
{
};
// https://spec.graphql.org/October2021/#sec-Names
struct name : identifier
{
};
struct variable_name_content : name
{
};
// https://spec.graphql.org/October2021/#Variable
struct variable_name : if_must<one<'$'>, variable_name_content>
{
};
// https://spec.graphql.org/October2021/#sec-Null-Value
struct null_keyword : TAO_PEGTL_KEYWORD("null")
{
};
struct quote_token : one<'"'>
{
};
struct backslash_token : one<'\\'>
{
};
struct escaped_unicode_codepoint : rep<4, xdigit>
{
};
struct escaped_unicode_content : list<escaped_unicode_codepoint, seq<backslash_token, one<'u'>>>
{
};
// https://spec.graphql.org/October2021/#EscapedUnicode
struct escaped_unicode : if_must<one<'u'>, escaped_unicode_content>
{
};
// https://spec.graphql.org/October2021/#EscapedCharacter
struct escaped_char : one<'"', '\\', '/', 'b', 'f', 'n', 'r', 't'>
{
};
struct string_escape_sequence_content : sor<escaped_unicode, escaped_char>
{
};
struct string_escape_sequence : if_must<backslash_token, string_escape_sequence_content>
{
};
struct string_quote_character
: plus<not_at<backslash_token>, not_at<quote_token>, not_at<ascii::eol>, source_character>
{
};
struct string_quote_content
: seq<star<sor<string_escape_sequence, string_quote_character>>, must<quote_token>>
{
};
// https://spec.graphql.org/October2021/#StringCharacter
struct string_quote : if_must<quote_token, string_quote_content>
{
};
struct block_quote_token : rep<3, quote_token>
{
};
struct block_escape_sequence : seq<backslash_token, block_quote_token>
{
};
struct block_quote_character
: plus<not_at<ascii::eol>, not_at<block_quote_token>, not_at<block_escape_sequence>,
source_character>
{
};
struct block_quote_empty_line : star<not_at<eol>, space>
{
};
struct block_quote_line_content : plus<sor<block_escape_sequence, block_quote_character>>
{
};
struct block_quote_line : seq<block_quote_empty_line, block_quote_line_content>
{
};
struct block_quote_content_lines : opt<list<sor<block_quote_line, block_quote_empty_line>, eol>>
{
};
struct block_quote_content : seq<block_quote_content_lines, must<block_quote_token>>
{
};
// https://spec.graphql.org/October2021/#BlockStringCharacter
struct block_quote : if_must<block_quote_token, block_quote_content>
{
};
// https://spec.graphql.org/October2021/#StringValue
struct string_value : sor<block_quote, string_quote>
{
};
// https://spec.graphql.org/October2021/#NonZeroDigit
struct nonzero_digit : range<'1', '9'>
{
};
struct zero_digit : one<'0'>
{
};
// https://spec.graphql.org/October2021/#NegativeSign
struct negative_sign : one<'-'>
{
};
// https://spec.graphql.org/October2021/#IntegerPart
struct integer_part : seq<opt<negative_sign>, sor<zero_digit, seq<nonzero_digit, star<digit>>>>
{
};
// https://spec.graphql.org/October2021/#IntValue
struct integer_value : integer_part
{
};
struct fractional_part_content : plus<digit>
{
};
// https://spec.graphql.org/October2021/#FractionalPart
struct fractional_part : if_must<one<'.'>, fractional_part_content>
{
};
// https://spec.graphql.org/October2021/#ExponentIndicator
struct exponent_indicator : one<'e', 'E'>
{
};
// https://spec.graphql.org/October2021/#Sign
struct sign : one<'+', '-'>
{
};
struct exponent_part_content : seq<opt<sign>, plus<digit>>
{
};
// https://spec.graphql.org/October2021/#ExponentPart
struct exponent_part : if_must<exponent_indicator, exponent_part_content>
{
};
// https://spec.graphql.org/October2021/#FloatValue
struct float_value : seq<integer_part, sor<seq<fractional_part, opt<exponent_part>>, exponent_part>>
{
};
struct true_keyword : TAO_PEGTL_KEYWORD("true")
{
};
struct false_keyword : TAO_PEGTL_KEYWORD("false")
{
};
// https://spec.graphql.org/October2021/#BooleanValue
struct bool_value : sor<true_keyword, false_keyword>
{
};
// https://spec.graphql.org/October2021/#EnumValue
struct enum_value : seq<not_at<true_keyword, false_keyword, null_keyword>, name>
{
};
// https://spec.graphql.org/October2021/#OperationType
struct operation_type
: sor<TAO_PEGTL_KEYWORD("query"), TAO_PEGTL_KEYWORD("mutation"),
TAO_PEGTL_KEYWORD("subscription")>
{
};
struct alias_name : name
{
};
// https://spec.graphql.org/October2021/#Alias
struct alias : seq<alias_name, star<ignored>, one<':'>>
{
};
struct argument_name : name
{
};
struct input_value;
struct argument_content : seq<star<ignored>, one<':'>, star<ignored>, input_value>
{
};
// https://spec.graphql.org/October2021/#Argument
struct argument : if_must<argument_name, argument_content>
{
};
struct arguments_content
: seq<star<ignored>, list<argument, plus<ignored>>, star<ignored>, must<one<')'>>>
{
};
// https://spec.graphql.org/October2021/#Arguments
struct arguments : if_must<one<'('>, arguments_content>
{
};
struct list_entry;
struct list_value_content
: seq<star<ignored>, opt<list<list_entry, plus<ignored>>>, star<ignored>, must<one<']'>>>
{
};
// https://spec.graphql.org/October2021/#ListValue
struct list_value : if_must<one<'['>, list_value_content>
{
};
struct object_field_name : name
{
};
struct object_field_content : seq<star<ignored>, one<':'>, star<ignored>, input_value>
{
};
// https://spec.graphql.org/October2021/#ObjectField
struct object_field : if_must<object_field_name, object_field_content>
{
};
struct object_value_content
: seq<star<ignored>, opt<list<object_field, plus<ignored>>>, star<ignored>, must<one<'}'>>>
{
};
// https://spec.graphql.org/October2021/#ObjectValue
struct object_value : if_must<one<'{'>, object_value_content>
{
};
struct variable_value : variable_name
{
};
struct input_value_content
: sor<list_value, object_value, variable_value, float_value, integer_value, string_value,
bool_value, null_keyword, enum_value>
{
};
// https://spec.graphql.org/October2021/#Value
struct input_value : must<input_value_content>
{
};
struct list_entry : input_value_content
{
};
struct default_value_content : seq<star<ignored>, input_value>
{
};
// https://spec.graphql.org/October2021/#DefaultValue
struct default_value : if_must<one<'='>, default_value_content>
{
};
// https://spec.graphql.org/October2021/#NamedType
struct named_type : name
{
};
struct list_type;
struct nonnull_type;
struct list_type_content
: seq<star<ignored>, sor<nonnull_type, list_type, named_type>, star<ignored>, must<one<']'>>>
{
};
// https://spec.graphql.org/October2021/#ListType
struct list_type : if_must<one<'['>, list_type_content>
{
};
// https://spec.graphql.org/October2021/#NonNullType
struct nonnull_type : seq<sor<list_type, named_type>, star<ignored>, one<'!'>>
{
};
struct type_name_content : sor<nonnull_type, list_type, named_type>
{
};
// https://spec.graphql.org/October2021/#Type
struct type_name : must<type_name_content>
{
};
struct variable_content
: seq<star<ignored>, one<':'>, star<ignored>, type_name, opt<star<ignored>, default_value>>
{
};
// https://spec.graphql.org/October2021/#VariableDefinition
struct variable : if_must<variable_name, variable_content>
{
};
struct variable_definitions_content
: seq<star<ignored>, list<variable, plus<ignored>>, star<ignored>, must<one<')'>>>
{
};
// https://spec.graphql.org/October2021/#VariableDefinitions
struct variable_definitions : if_must<one<'('>, variable_definitions_content>
{
};
struct directive_name : name
{
};
struct directive_content : seq<directive_name, opt<star<ignored>, arguments>>
{
};
// https://spec.graphql.org/October2021/#Directive
struct directive : if_must<one<'@'>, directive_content>
{
};
// https://spec.graphql.org/October2021/#Directives
struct directives : list<directive, plus<ignored>>
{
};
struct selection_set;
struct field_name : name
{
};
struct field_start : seq<opt<alias, star<ignored>>, field_name>
{
};
struct field_arguments : opt<star<ignored>, arguments>
{
};
struct field_directives : seq<star<ignored>, directives>
{
};
struct field_selection_set : seq<star<ignored>, selection_set>
{
};
struct field_content : seq<field_arguments, opt<field_directives>, opt<field_selection_set>>
{
};
// https://spec.graphql.org/October2021/#Field
struct field : if_must<field_start, field_content>
{
};
struct on_keyword : TAO_PEGTL_KEYWORD("on")
{
};
// https://spec.graphql.org/October2021/#FragmentName
struct fragment_name : seq<not_at<on_keyword>, name>
{
};
struct fragment_token : ellipsis
{
};
// https://spec.graphql.org/October2021/#FragmentSpread
struct fragment_spread : seq<star<ignored>, fragment_name, opt<star<ignored>, directives>>
{
};
struct type_condition_content : seq<plus<ignored>, named_type>
{
};
// https://spec.graphql.org/October2021/#TypeCondition
struct type_condition : if_must<on_keyword, type_condition_content>
{
};
// https://spec.graphql.org/October2021/#InlineFragment
struct inline_fragment
: seq<opt<star<ignored>, type_condition>, opt<star<ignored>, directives>, star<ignored>,
selection_set>
{
};
struct fragement_spread_or_inline_fragment_content : sor<fragment_spread, inline_fragment>
{
};
struct fragement_spread_or_inline_fragment
: if_must<fragment_token, fragement_spread_or_inline_fragment_content>
{
};
// https://spec.graphql.org/October2021/#Selection
struct selection : sor<field, fragement_spread_or_inline_fragment>
{
};
struct selection_set_content
: seq<star<ignored>, list<selection, plus<ignored>>, star<ignored>, must<one<'}'>>>
{
};
// https://spec.graphql.org/October2021/#SelectionSet
struct selection_set : if_must<one<'{'>, selection_set_content>
{
};
struct operation_name : name
{
};
struct operation_definition_operation_type_content
: seq<opt<plus<ignored>, operation_name>, opt<star<ignored>, variable_definitions>,
opt<star<ignored>, directives>, star<ignored>, selection_set>
{
};
// https://spec.graphql.org/October2021/#OperationDefinition
struct operation_definition
: sor<if_must<operation_type, operation_definition_operation_type_content>, selection_set>
{
};
struct fragment_definition_content
: seq<plus<ignored>, fragment_name, plus<ignored>, type_condition,
opt<star<ignored>, directives>, star<ignored>, selection_set>
{
};
// https://spec.graphql.org/October2021/#FragmentDefinition
struct fragment_definition : if_must<TAO_PEGTL_KEYWORD("fragment"), fragment_definition_content>
{
};
// https://spec.graphql.org/October2021/#ExecutableDefinition
struct executable_definition : sor<fragment_definition, operation_definition>
{
};
// https://spec.graphql.org/October2021/#Description
struct description : string_value
{
};
struct schema_keyword : TAO_PEGTL_KEYWORD("schema")
{
};
struct root_operation_definition_content : seq<star<ignored>, one<':'>, star<ignored>, named_type>
{
};
// https://spec.graphql.org/October2021/#RootOperationTypeDefinition
struct root_operation_definition : if_must<operation_type, root_operation_definition_content>
{
};
struct schema_definition_start : seq<opt<description, star<ignored>>, schema_keyword>
{
};
struct schema_definition_content
: seq<opt<star<ignored>, directives>, star<ignored>, one<'{'>, star<ignored>,
list<root_operation_definition, plus<ignored>>, star<ignored>, must<one<'}'>>>
{
};
// https://spec.graphql.org/October2021/#SchemaDefinition
struct schema_definition : if_must<schema_definition_start, schema_definition_content>
{
};
struct scalar_keyword : TAO_PEGTL_KEYWORD("scalar")
{
};
struct scalar_name : name
{
};
struct scalar_type_definition_start : seq<opt<description, star<ignored>>, scalar_keyword>
{
};
struct scalar_type_definition_content
: seq<plus<ignored>, scalar_name, opt<star<ignored>, directives>>
{
};
// https://spec.graphql.org/October2021/#ScalarTypeDefinition
struct scalar_type_definition
: if_must<scalar_type_definition_start, scalar_type_definition_content>
{
};
struct type_keyword : TAO_PEGTL_KEYWORD("type")
{
};
struct input_field_definition;
struct arguments_definition_start : one<'('>
{
};
struct arguments_definition_content
: seq<star<ignored>, list<input_field_definition, plus<ignored>>, star<ignored>, must<one<')'>>>
{
};
// https://spec.graphql.org/October2021/#ArgumentsDefinition
struct arguments_definition : if_must<arguments_definition_start, arguments_definition_content>
{
};
struct field_definition_start : seq<opt<description, star<ignored>>, field_name>
{
};
struct field_definition_content
: seq<opt<star<ignored>, arguments_definition>, star<ignored>, one<':'>, star<ignored>,
type_name, opt<star<ignored>, directives>>
{
};
// https://spec.graphql.org/October2021/#FieldDefinition
struct field_definition : if_must<field_definition_start, field_definition_content>
{
};
struct fields_definition_content
: seq<star<ignored>, list<field_definition, plus<ignored>>, star<ignored>, must<one<'}'>>>
{
};
// https://spec.graphql.org/October2021/#FieldsDefinition
struct fields_definition : if_must<one<'{'>, fields_definition_content>
{
};
struct interface_type : named_type
{
};
struct implements_interfaces_content
: seq<opt<star<ignored>, one<'&'>>, star<ignored>,
list<interface_type, seq<star<ignored>, one<'&'>, star<ignored>>>>
{
};
// https://spec.graphql.org/October2021/#ImplementsInterfaces
struct implements_interfaces
: if_must<TAO_PEGTL_KEYWORD("implements"), implements_interfaces_content>
{
};
struct object_name : name
{
};
struct object_type_definition_start : seq<opt<description, star<ignored>>, type_keyword>
{
};
struct object_type_definition_object_name : seq<plus<ignored>, object_name>
{
};
struct object_type_definition_implements_interfaces : opt<plus<ignored>, implements_interfaces>
{
};
struct object_type_definition_directives : seq<star<ignored>, directives>
{
};
struct object_type_definition_fields_definition : seq<star<ignored>, fields_definition>
{
};
struct object_type_definition_content
: seq<object_type_definition_object_name,
sor<seq<object_type_definition_implements_interfaces,
opt<object_type_definition_directives>, object_type_definition_fields_definition>,
seq<object_type_definition_implements_interfaces, object_type_definition_directives>,
object_type_definition_implements_interfaces>>
{
};
// https://spec.graphql.org/October2021/#ObjectTypeDefinition
struct object_type_definition
: if_must<object_type_definition_start, object_type_definition_content>
{
};
struct interface_keyword : TAO_PEGTL_KEYWORD("interface")
{
};
struct interface_name : name
{
};
struct interface_type_definition_start : seq<opt<description, star<ignored>>, interface_keyword>
{
};
struct interface_type_definition_interface_name : seq<plus<ignored>, interface_name>
{
};
struct interface_type_definition_implements_interfaces : opt<plus<ignored>, implements_interfaces>
{
};
struct interface_type_definition_directives : seq<star<ignored>, directives>
{
};
struct interface_type_definition_fields_definition : seq<star<ignored>, fields_definition>
{
};
struct interface_type_definition_content
: seq<interface_type_definition_interface_name,
sor<seq<interface_type_definition_implements_interfaces,
opt<interface_type_definition_directives>,
interface_type_definition_fields_definition>,
seq<interface_type_definition_implements_interfaces,
interface_type_definition_directives,
interface_type_definition_fields_definition>,
interface_type_definition_implements_interfaces>>
{
};
// https://spec.graphql.org/October2021/#InterfaceTypeDefinition
struct interface_type_definition
: if_must<interface_type_definition_start, interface_type_definition_content>
{
};
struct union_keyword : TAO_PEGTL_KEYWORD("union")
{
};
struct union_name : name
{
};
struct union_type : named_type
{
};
struct union_member_types_start : one<'='>
{
};
struct union_member_types_content
: seq<opt<star<ignored>, one<'|'>>, star<ignored>,
list<union_type, seq<star<ignored>, one<'|'>, star<ignored>>>>
{
};
// https://spec.graphql.org/October2021/#UnionMemberTypes
struct union_member_types : if_must<union_member_types_start, union_member_types_content>
{
};
struct union_type_definition_start : seq<opt<description, star<ignored>>, union_keyword>
{
};
struct union_type_definition_directives : opt<star<ignored>, directives>
{
};
struct union_type_definition_content
: seq<plus<ignored>, union_name,
sor<seq<union_type_definition_directives, seq<star<ignored>, union_member_types>>,
union_type_definition_directives>>
{
};
// https://spec.graphql.org/October2021/#UnionTypeDefinition
struct union_type_definition : if_must<union_type_definition_start, union_type_definition_content>
{
};
struct enum_keyword : TAO_PEGTL_KEYWORD("enum")
{
};
struct enum_name : name
{
};
struct enum_value_definition_start : seq<opt<description, star<ignored>>, enum_value>
{
};
struct enum_value_definition_content : opt<star<ignored>, directives>
{
};
// https://spec.graphql.org/October2021/#EnumValueDefinition
struct enum_value_definition : if_must<enum_value_definition_start, enum_value_definition_content>
{
};
struct enum_values_definition_start : one<'{'>
{
};
struct enum_values_definition_content
: seq<star<ignored>, list<enum_value_definition, plus<ignored>>, star<ignored>, must<one<'}'>>>
{
};
// https://spec.graphql.org/October2021/#EnumValuesDefinition
struct enum_values_definition
: if_must<enum_values_definition_start, enum_values_definition_content>
{
};
struct enum_type_definition_start : seq<opt<description, star<ignored>>, enum_keyword>
{
};
struct enum_type_definition_name : seq<plus<ignored>, enum_name>
{
};
struct enum_type_definition_directives : opt<star<ignored>, directives>
{
};
struct enum_type_definition_enum_values_definition : seq<star<ignored>, enum_values_definition>
{
};
struct enum_type_definition_content
: seq<enum_type_definition_name,
sor<seq<enum_type_definition_directives, enum_type_definition_enum_values_definition>,
enum_type_definition_directives>>
{
};
// https://spec.graphql.org/October2021/#EnumTypeDefinition
struct enum_type_definition : if_must<enum_type_definition_start, enum_type_definition_content>
{
};
struct input_keyword : TAO_PEGTL_KEYWORD("input")
{
};
struct input_field_definition_start : seq<opt<description, star<ignored>>, argument_name>
{
};
struct input_field_definition_type_name : seq<star<ignored>, one<':'>, star<ignored>, type_name>
{
};
struct input_field_definition_default_value : opt<star<ignored>, default_value>
{
};
struct input_field_definition_directives : seq<star<ignored>, directives>
{
};
struct input_field_definition_content
: seq<input_field_definition_type_name,
sor<seq<input_field_definition_default_value, input_field_definition_directives>,
input_field_definition_default_value>>
{
};
// https://spec.graphql.org/October2021/#InputValueDefinition
struct input_field_definition
: if_must<input_field_definition_start, input_field_definition_content>
{
};
struct input_fields_definition_start : one<'{'>
{
};
struct input_fields_definition_content
: seq<star<ignored>, list<input_field_definition, plus<ignored>>, star<ignored>, must<one<'}'>>>
{
};
// https://spec.graphql.org/October2021/#InputFieldsDefinition
struct input_fields_definition
: if_must<input_fields_definition_start, input_fields_definition_content>
{
};
struct input_object_type_definition_start : seq<opt<description, star<ignored>>, input_keyword>
{
};
struct input_object_type_definition_object_name : seq<plus<ignored>, object_name>
{
};
struct input_object_type_definition_directives : opt<star<ignored>, directives>
{
};
struct input_object_type_definition_fields_definition : seq<star<ignored>, input_fields_definition>
{
};
struct input_object_type_definition_content
: seq<input_object_type_definition_object_name,
sor<seq<input_object_type_definition_directives,
input_object_type_definition_fields_definition>,
input_object_type_definition_directives>>
{
};
// https://spec.graphql.org/October2021/#InputObjectTypeDefinition
struct input_object_type_definition
: if_must<input_object_type_definition_start, input_object_type_definition_content>
{
};
// https://spec.graphql.org/October2021/#TypeDefinition
struct type_definition
: sor<scalar_type_definition, object_type_definition, interface_type_definition,
union_type_definition, enum_type_definition, input_object_type_definition>
{
};
// https://spec.graphql.org/October2021/#ExecutableDirectiveLocation
struct executable_directive_location
: sor<TAO_PEGTL_KEYWORD("QUERY"), TAO_PEGTL_KEYWORD("MUTATION"),
TAO_PEGTL_KEYWORD("SUBSCRIPTION"), TAO_PEGTL_KEYWORD("FIELD"),
TAO_PEGTL_KEYWORD("FRAGMENT_DEFINITION"), TAO_PEGTL_KEYWORD("FRAGMENT_SPREAD"),
TAO_PEGTL_KEYWORD("INLINE_FRAGMENT")>
{
};
// https://spec.graphql.org/October2021/#TypeSystemDirectiveLocation
struct type_system_directive_location
: sor<TAO_PEGTL_KEYWORD("SCHEMA"), TAO_PEGTL_KEYWORD("SCALAR"), TAO_PEGTL_KEYWORD("OBJECT"),
TAO_PEGTL_KEYWORD("FIELD_DEFINITION"), TAO_PEGTL_KEYWORD("ARGUMENT_DEFINITION"),
TAO_PEGTL_KEYWORD("INTERFACE"), TAO_PEGTL_KEYWORD("UNION"), TAO_PEGTL_KEYWORD("ENUM"),
TAO_PEGTL_KEYWORD("ENUM_VALUE"), TAO_PEGTL_KEYWORD("INPUT_OBJECT"),
TAO_PEGTL_KEYWORD("INPUT_FIELD_DEFINITION")>
{
};
// https://spec.graphql.org/October2021/#DirectiveLocation
struct directive_location : sor<executable_directive_location, type_system_directive_location>
{
};
// https://spec.graphql.org/October2021/#DirectiveLocations
struct directive_locations
: seq<opt<one<'|'>, star<ignored>>,
list<directive_location, seq<star<ignored>, one<'|'>, star<ignored>>>>
{
};
struct directive_definition_start
: seq<opt<description, star<ignored>>, TAO_PEGTL_KEYWORD("directive")>
{
};
struct repeatable_keyword : TAO_PEGTL_KEYWORD("repeatable")
{
};
struct directive_definition_content
: seq<star<ignored>, one<'@'>, directive_name, opt<star<ignored>, arguments_definition>,
opt<plus<ignored>, repeatable_keyword>, plus<ignored>, on_keyword, plus<ignored>,
directive_locations>
{
};
// https://spec.graphql.org/October2021/#DirectiveDefinition
struct directive_definition : if_must<directive_definition_start, directive_definition_content>