1use crate::{
5 cst::{support, CstChildren, CstNode},
6 SyntaxKind::{self, *},
7 SyntaxNode, SyntaxToken, S,
8};
9#[derive(Debug, Clone, PartialEq, Eq, Hash)]
10pub struct Name {
11 pub(crate) syntax: SyntaxNode,
12}
13impl Name {
14 pub fn ident_token(&self) -> Option<SyntaxToken> {
15 support::token(&self.syntax, S![ident])
16 }
17}
18#[derive(Debug, Clone, PartialEq, Eq, Hash)]
19pub struct Document {
20 pub(crate) syntax: SyntaxNode,
21}
22impl Document {
23 pub fn definitions(&self) -> CstChildren<Definition> {
24 support::children(&self.syntax)
25 }
26}
27#[derive(Debug, Clone, PartialEq, Eq, Hash)]
28pub struct OperationDefinition {
29 pub(crate) syntax: SyntaxNode,
30}
31impl OperationDefinition {
32 pub fn description(&self) -> Option<Description> {
33 support::child(&self.syntax)
34 }
35 pub fn operation_type(&self) -> Option<OperationType> {
36 support::child(&self.syntax)
37 }
38 pub fn name(&self) -> Option<Name> {
39 support::child(&self.syntax)
40 }
41 pub fn variable_definitions(&self) -> Option<VariableDefinitions> {
42 support::child(&self.syntax)
43 }
44 pub fn directives(&self) -> Option<Directives> {
45 support::child(&self.syntax)
46 }
47 pub fn selection_set(&self) -> Option<SelectionSet> {
48 support::child(&self.syntax)
49 }
50}
51#[derive(Debug, Clone, PartialEq, Eq, Hash)]
52pub struct FragmentDefinition {
53 pub(crate) syntax: SyntaxNode,
54}
55impl FragmentDefinition {
56 pub fn description(&self) -> Option<Description> {
57 support::child(&self.syntax)
58 }
59 pub fn fragment_token(&self) -> Option<SyntaxToken> {
60 support::token(&self.syntax, S![fragment])
61 }
62 pub fn fragment_name(&self) -> Option<FragmentName> {
63 support::child(&self.syntax)
64 }
65 pub fn variable_definitions(&self) -> Option<VariableDefinitions> {
66 support::child(&self.syntax)
67 }
68 pub fn type_condition(&self) -> Option<TypeCondition> {
69 support::child(&self.syntax)
70 }
71 pub fn directives(&self) -> Option<Directives> {
72 support::child(&self.syntax)
73 }
74 pub fn selection_set(&self) -> Option<SelectionSet> {
75 support::child(&self.syntax)
76 }
77}
78#[derive(Debug, Clone, PartialEq, Eq, Hash)]
79pub struct DirectiveDefinition {
80 pub(crate) syntax: SyntaxNode,
81}
82impl DirectiveDefinition {
83 pub fn description(&self) -> Option<Description> {
84 support::child(&self.syntax)
85 }
86 pub fn directive_token(&self) -> Option<SyntaxToken> {
87 support::token(&self.syntax, S![directive])
88 }
89 pub fn at_token(&self) -> Option<SyntaxToken> {
90 support::token(&self.syntax, S![@])
91 }
92 pub fn name(&self) -> Option<Name> {
93 support::child(&self.syntax)
94 }
95 pub fn arguments_definition(&self) -> Option<ArgumentsDefinition> {
96 support::child(&self.syntax)
97 }
98 pub fn repeatable_token(&self) -> Option<SyntaxToken> {
99 support::token(&self.syntax, S![repeatable])
100 }
101 pub fn on_token(&self) -> Option<SyntaxToken> {
102 support::token(&self.syntax, S![on])
103 }
104 pub fn directive_locations(&self) -> Option<DirectiveLocations> {
105 support::child(&self.syntax)
106 }
107}
108#[derive(Debug, Clone, PartialEq, Eq, Hash)]
109pub struct SchemaDefinition {
110 pub(crate) syntax: SyntaxNode,
111}
112impl SchemaDefinition {
113 pub fn description(&self) -> Option<Description> {
114 support::child(&self.syntax)
115 }
116 pub fn schema_token(&self) -> Option<SyntaxToken> {
117 support::token(&self.syntax, S![schema])
118 }
119 pub fn directives(&self) -> Option<Directives> {
120 support::child(&self.syntax)
121 }
122 pub fn l_curly_token(&self) -> Option<SyntaxToken> {
123 support::token(&self.syntax, S!['{'])
124 }
125 pub fn root_operation_type_definitions(&self) -> CstChildren<RootOperationTypeDefinition> {
126 support::children(&self.syntax)
127 }
128 pub fn r_curly_token(&self) -> Option<SyntaxToken> {
129 support::token(&self.syntax, S!['}'])
130 }
131}
132#[derive(Debug, Clone, PartialEq, Eq, Hash)]
133pub struct ScalarTypeDefinition {
134 pub(crate) syntax: SyntaxNode,
135}
136impl ScalarTypeDefinition {
137 pub fn description(&self) -> Option<Description> {
138 support::child(&self.syntax)
139 }
140 pub fn scalar_token(&self) -> Option<SyntaxToken> {
141 support::token(&self.syntax, S![scalar])
142 }
143 pub fn name(&self) -> Option<Name> {
144 support::child(&self.syntax)
145 }
146 pub fn directives(&self) -> Option<Directives> {
147 support::child(&self.syntax)
148 }
149}
150#[derive(Debug, Clone, PartialEq, Eq, Hash)]
151pub struct ObjectTypeDefinition {
152 pub(crate) syntax: SyntaxNode,
153}
154impl ObjectTypeDefinition {
155 pub fn description(&self) -> Option<Description> {
156 support::child(&self.syntax)
157 }
158 pub fn type_token(&self) -> Option<SyntaxToken> {
159 support::token(&self.syntax, S![type])
160 }
161 pub fn name(&self) -> Option<Name> {
162 support::child(&self.syntax)
163 }
164 pub fn implements_interfaces(&self) -> Option<ImplementsInterfaces> {
165 support::child(&self.syntax)
166 }
167 pub fn directives(&self) -> Option<Directives> {
168 support::child(&self.syntax)
169 }
170 pub fn fields_definition(&self) -> Option<FieldsDefinition> {
171 support::child(&self.syntax)
172 }
173}
174#[derive(Debug, Clone, PartialEq, Eq, Hash)]
175pub struct InterfaceTypeDefinition {
176 pub(crate) syntax: SyntaxNode,
177}
178impl InterfaceTypeDefinition {
179 pub fn description(&self) -> Option<Description> {
180 support::child(&self.syntax)
181 }
182 pub fn interface_token(&self) -> Option<SyntaxToken> {
183 support::token(&self.syntax, S![interface])
184 }
185 pub fn name(&self) -> Option<Name> {
186 support::child(&self.syntax)
187 }
188 pub fn implements_interfaces(&self) -> Option<ImplementsInterfaces> {
189 support::child(&self.syntax)
190 }
191 pub fn directives(&self) -> Option<Directives> {
192 support::child(&self.syntax)
193 }
194 pub fn fields_definition(&self) -> Option<FieldsDefinition> {
195 support::child(&self.syntax)
196 }
197}
198#[derive(Debug, Clone, PartialEq, Eq, Hash)]
199pub struct UnionTypeDefinition {
200 pub(crate) syntax: SyntaxNode,
201}
202impl UnionTypeDefinition {
203 pub fn description(&self) -> Option<Description> {
204 support::child(&self.syntax)
205 }
206 pub fn union_token(&self) -> Option<SyntaxToken> {
207 support::token(&self.syntax, S![union])
208 }
209 pub fn name(&self) -> Option<Name> {
210 support::child(&self.syntax)
211 }
212 pub fn directives(&self) -> Option<Directives> {
213 support::child(&self.syntax)
214 }
215 pub fn union_member_types(&self) -> Option<UnionMemberTypes> {
216 support::child(&self.syntax)
217 }
218}
219#[derive(Debug, Clone, PartialEq, Eq, Hash)]
220pub struct EnumTypeDefinition {
221 pub(crate) syntax: SyntaxNode,
222}
223impl EnumTypeDefinition {
224 pub fn description(&self) -> Option<Description> {
225 support::child(&self.syntax)
226 }
227 pub fn enum_token(&self) -> Option<SyntaxToken> {
228 support::token(&self.syntax, S![enum])
229 }
230 pub fn name(&self) -> Option<Name> {
231 support::child(&self.syntax)
232 }
233 pub fn directives(&self) -> Option<Directives> {
234 support::child(&self.syntax)
235 }
236 pub fn enum_values_definition(&self) -> Option<EnumValuesDefinition> {
237 support::child(&self.syntax)
238 }
239}
240#[derive(Debug, Clone, PartialEq, Eq, Hash)]
241pub struct InputObjectTypeDefinition {
242 pub(crate) syntax: SyntaxNode,
243}
244impl InputObjectTypeDefinition {
245 pub fn description(&self) -> Option<Description> {
246 support::child(&self.syntax)
247 }
248 pub fn input_token(&self) -> Option<SyntaxToken> {
249 support::token(&self.syntax, S![input])
250 }
251 pub fn name(&self) -> Option<Name> {
252 support::child(&self.syntax)
253 }
254 pub fn directives(&self) -> Option<Directives> {
255 support::child(&self.syntax)
256 }
257 pub fn input_fields_definition(&self) -> Option<InputFieldsDefinition> {
258 support::child(&self.syntax)
259 }
260}
261#[derive(Debug, Clone, PartialEq, Eq, Hash)]
262pub struct SchemaExtension {
263 pub(crate) syntax: SyntaxNode,
264}
265impl SchemaExtension {
266 pub fn extend_token(&self) -> Option<SyntaxToken> {
267 support::token(&self.syntax, S![extend])
268 }
269 pub fn schema_token(&self) -> Option<SyntaxToken> {
270 support::token(&self.syntax, S![schema])
271 }
272 pub fn directives(&self) -> Option<Directives> {
273 support::child(&self.syntax)
274 }
275 pub fn l_curly_token(&self) -> Option<SyntaxToken> {
276 support::token(&self.syntax, S!['{'])
277 }
278 pub fn root_operation_type_definitions(&self) -> CstChildren<RootOperationTypeDefinition> {
279 support::children(&self.syntax)
280 }
281 pub fn r_curly_token(&self) -> Option<SyntaxToken> {
282 support::token(&self.syntax, S!['}'])
283 }
284}
285#[derive(Debug, Clone, PartialEq, Eq, Hash)]
286pub struct ScalarTypeExtension {
287 pub(crate) syntax: SyntaxNode,
288}
289impl ScalarTypeExtension {
290 pub fn extend_token(&self) -> Option<SyntaxToken> {
291 support::token(&self.syntax, S![extend])
292 }
293 pub fn scalar_token(&self) -> Option<SyntaxToken> {
294 support::token(&self.syntax, S![scalar])
295 }
296 pub fn name(&self) -> Option<Name> {
297 support::child(&self.syntax)
298 }
299 pub fn directives(&self) -> Option<Directives> {
300 support::child(&self.syntax)
301 }
302}
303#[derive(Debug, Clone, PartialEq, Eq, Hash)]
304pub struct ObjectTypeExtension {
305 pub(crate) syntax: SyntaxNode,
306}
307impl ObjectTypeExtension {
308 pub fn extend_token(&self) -> Option<SyntaxToken> {
309 support::token(&self.syntax, S![extend])
310 }
311 pub fn type_token(&self) -> Option<SyntaxToken> {
312 support::token(&self.syntax, S![type])
313 }
314 pub fn name(&self) -> Option<Name> {
315 support::child(&self.syntax)
316 }
317 pub fn implements_interfaces(&self) -> Option<ImplementsInterfaces> {
318 support::child(&self.syntax)
319 }
320 pub fn directives(&self) -> Option<Directives> {
321 support::child(&self.syntax)
322 }
323 pub fn fields_definition(&self) -> Option<FieldsDefinition> {
324 support::child(&self.syntax)
325 }
326}
327#[derive(Debug, Clone, PartialEq, Eq, Hash)]
328pub struct InterfaceTypeExtension {
329 pub(crate) syntax: SyntaxNode,
330}
331impl InterfaceTypeExtension {
332 pub fn extend_token(&self) -> Option<SyntaxToken> {
333 support::token(&self.syntax, S![extend])
334 }
335 pub fn interface_token(&self) -> Option<SyntaxToken> {
336 support::token(&self.syntax, S![interface])
337 }
338 pub fn name(&self) -> Option<Name> {
339 support::child(&self.syntax)
340 }
341 pub fn implements_interfaces(&self) -> Option<ImplementsInterfaces> {
342 support::child(&self.syntax)
343 }
344 pub fn directives(&self) -> Option<Directives> {
345 support::child(&self.syntax)
346 }
347 pub fn fields_definition(&self) -> Option<FieldsDefinition> {
348 support::child(&self.syntax)
349 }
350}
351#[derive(Debug, Clone, PartialEq, Eq, Hash)]
352pub struct UnionTypeExtension {
353 pub(crate) syntax: SyntaxNode,
354}
355impl UnionTypeExtension {
356 pub fn extend_token(&self) -> Option<SyntaxToken> {
357 support::token(&self.syntax, S![extend])
358 }
359 pub fn union_token(&self) -> Option<SyntaxToken> {
360 support::token(&self.syntax, S![union])
361 }
362 pub fn name(&self) -> Option<Name> {
363 support::child(&self.syntax)
364 }
365 pub fn directives(&self) -> Option<Directives> {
366 support::child(&self.syntax)
367 }
368 pub fn union_member_types(&self) -> Option<UnionMemberTypes> {
369 support::child(&self.syntax)
370 }
371}
372#[derive(Debug, Clone, PartialEq, Eq, Hash)]
373pub struct EnumTypeExtension {
374 pub(crate) syntax: SyntaxNode,
375}
376impl EnumTypeExtension {
377 pub fn extend_token(&self) -> Option<SyntaxToken> {
378 support::token(&self.syntax, S![extend])
379 }
380 pub fn enum_token(&self) -> Option<SyntaxToken> {
381 support::token(&self.syntax, S![enum])
382 }
383 pub fn name(&self) -> Option<Name> {
384 support::child(&self.syntax)
385 }
386 pub fn directives(&self) -> Option<Directives> {
387 support::child(&self.syntax)
388 }
389 pub fn enum_values_definition(&self) -> Option<EnumValuesDefinition> {
390 support::child(&self.syntax)
391 }
392}
393#[derive(Debug, Clone, PartialEq, Eq, Hash)]
394pub struct InputObjectTypeExtension {
395 pub(crate) syntax: SyntaxNode,
396}
397impl InputObjectTypeExtension {
398 pub fn extend_token(&self) -> Option<SyntaxToken> {
399 support::token(&self.syntax, S![extend])
400 }
401 pub fn input_token(&self) -> Option<SyntaxToken> {
402 support::token(&self.syntax, S![input])
403 }
404 pub fn name(&self) -> Option<Name> {
405 support::child(&self.syntax)
406 }
407 pub fn directives(&self) -> Option<Directives> {
408 support::child(&self.syntax)
409 }
410 pub fn input_fields_definition(&self) -> Option<InputFieldsDefinition> {
411 support::child(&self.syntax)
412 }
413}
414#[derive(Debug, Clone, PartialEq, Eq, Hash)]
415pub struct Description {
416 pub(crate) syntax: SyntaxNode,
417}
418impl Description {
419 pub fn string_value(&self) -> Option<StringValue> {
420 support::child(&self.syntax)
421 }
422}
423#[derive(Debug, Clone, PartialEq, Eq, Hash)]
424pub struct OperationType {
425 pub(crate) syntax: SyntaxNode,
426}
427impl OperationType {
428 pub fn query_token(&self) -> Option<SyntaxToken> {
429 support::token(&self.syntax, S![query])
430 }
431 pub fn mutation_token(&self) -> Option<SyntaxToken> {
432 support::token(&self.syntax, S![mutation])
433 }
434 pub fn subscription_token(&self) -> Option<SyntaxToken> {
435 support::token(&self.syntax, S![subscription])
436 }
437}
438#[derive(Debug, Clone, PartialEq, Eq, Hash)]
439pub struct VariableDefinitions {
440 pub(crate) syntax: SyntaxNode,
441}
442impl VariableDefinitions {
443 pub fn l_paren_token(&self) -> Option<SyntaxToken> {
444 support::token(&self.syntax, S!['('])
445 }
446 pub fn variable_definitions(&self) -> CstChildren<VariableDefinition> {
447 support::children(&self.syntax)
448 }
449 pub fn r_paren_token(&self) -> Option<SyntaxToken> {
450 support::token(&self.syntax, S![')'])
451 }
452}
453#[derive(Debug, Clone, PartialEq, Eq, Hash)]
454pub struct Directives {
455 pub(crate) syntax: SyntaxNode,
456}
457impl Directives {
458 pub fn directives(&self) -> CstChildren<Directive> {
459 support::children(&self.syntax)
460 }
461}
462#[derive(Debug, Clone, PartialEq, Eq, Hash)]
463pub struct SelectionSet {
464 pub(crate) syntax: SyntaxNode,
465}
466impl SelectionSet {
467 pub fn l_curly_token(&self) -> Option<SyntaxToken> {
468 support::token(&self.syntax, S!['{'])
469 }
470 pub fn selections(&self) -> CstChildren<Selection> {
471 support::children(&self.syntax)
472 }
473 pub fn r_curly_token(&self) -> Option<SyntaxToken> {
474 support::token(&self.syntax, S!['}'])
475 }
476}
477#[derive(Debug, Clone, PartialEq, Eq, Hash)]
478pub struct Field {
479 pub(crate) syntax: SyntaxNode,
480}
481impl Field {
482 pub fn alias(&self) -> Option<Alias> {
483 support::child(&self.syntax)
484 }
485 pub fn name(&self) -> Option<Name> {
486 support::child(&self.syntax)
487 }
488 pub fn arguments(&self) -> Option<Arguments> {
489 support::child(&self.syntax)
490 }
491 pub fn directives(&self) -> Option<Directives> {
492 support::child(&self.syntax)
493 }
494 pub fn selection_set(&self) -> Option<SelectionSet> {
495 support::child(&self.syntax)
496 }
497}
498#[derive(Debug, Clone, PartialEq, Eq, Hash)]
499pub struct FragmentSpread {
500 pub(crate) syntax: SyntaxNode,
501}
502impl FragmentSpread {
503 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> {
504 support::token(&self.syntax, S![...])
505 }
506 pub fn fragment_name(&self) -> Option<FragmentName> {
507 support::child(&self.syntax)
508 }
509 pub fn directives(&self) -> Option<Directives> {
510 support::child(&self.syntax)
511 }
512}
513#[derive(Debug, Clone, PartialEq, Eq, Hash)]
514pub struct InlineFragment {
515 pub(crate) syntax: SyntaxNode,
516}
517impl InlineFragment {
518 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> {
519 support::token(&self.syntax, S![...])
520 }
521 pub fn type_condition(&self) -> Option<TypeCondition> {
522 support::child(&self.syntax)
523 }
524 pub fn directives(&self) -> Option<Directives> {
525 support::child(&self.syntax)
526 }
527 pub fn selection_set(&self) -> Option<SelectionSet> {
528 support::child(&self.syntax)
529 }
530}
531#[derive(Debug, Clone, PartialEq, Eq, Hash)]
532pub struct Alias {
533 pub(crate) syntax: SyntaxNode,
534}
535impl Alias {
536 pub fn name(&self) -> Option<Name> {
537 support::child(&self.syntax)
538 }
539 pub fn colon_token(&self) -> Option<SyntaxToken> {
540 support::token(&self.syntax, S![:])
541 }
542}
543#[derive(Debug, Clone, PartialEq, Eq, Hash)]
544pub struct Arguments {
545 pub(crate) syntax: SyntaxNode,
546}
547impl Arguments {
548 pub fn l_paren_token(&self) -> Option<SyntaxToken> {
549 support::token(&self.syntax, S!['('])
550 }
551 pub fn arguments(&self) -> CstChildren<Argument> {
552 support::children(&self.syntax)
553 }
554 pub fn r_paren_token(&self) -> Option<SyntaxToken> {
555 support::token(&self.syntax, S![')'])
556 }
557}
558#[derive(Debug, Clone, PartialEq, Eq, Hash)]
559pub struct Argument {
560 pub(crate) syntax: SyntaxNode,
561}
562impl Argument {
563 pub fn name(&self) -> Option<Name> {
564 support::child(&self.syntax)
565 }
566 pub fn colon_token(&self) -> Option<SyntaxToken> {
567 support::token(&self.syntax, S![:])
568 }
569 pub fn value(&self) -> Option<Value> {
570 support::child(&self.syntax)
571 }
572}
573#[derive(Debug, Clone, PartialEq, Eq, Hash)]
574pub struct FragmentName {
575 pub(crate) syntax: SyntaxNode,
576}
577impl FragmentName {
578 pub fn name(&self) -> Option<Name> {
579 support::child(&self.syntax)
580 }
581}
582#[derive(Debug, Clone, PartialEq, Eq, Hash)]
583pub struct TypeCondition {
584 pub(crate) syntax: SyntaxNode,
585}
586impl TypeCondition {
587 pub fn on_token(&self) -> Option<SyntaxToken> {
588 support::token(&self.syntax, S![on])
589 }
590 pub fn named_type(&self) -> Option<NamedType> {
591 support::child(&self.syntax)
592 }
593}
594#[derive(Debug, Clone, PartialEq, Eq, Hash)]
595pub struct NamedType {
596 pub(crate) syntax: SyntaxNode,
597}
598impl NamedType {
599 pub fn name(&self) -> Option<Name> {
600 support::child(&self.syntax)
601 }
602}
603#[derive(Debug, Clone, PartialEq, Eq, Hash)]
604pub struct Variable {
605 pub(crate) syntax: SyntaxNode,
606}
607impl Variable {
608 pub fn dollar_token(&self) -> Option<SyntaxToken> {
609 support::token(&self.syntax, S![$])
610 }
611 pub fn name(&self) -> Option<Name> {
612 support::child(&self.syntax)
613 }
614}
615#[derive(Debug, Clone, PartialEq, Eq, Hash)]
616pub struct StringValue {
617 pub(crate) syntax: SyntaxNode,
618}
619impl StringValue {}
620#[derive(Debug, Clone, PartialEq, Eq, Hash)]
621pub struct FloatValue {
622 pub(crate) syntax: SyntaxNode,
623}
624impl FloatValue {
625 pub fn float_token(&self) -> Option<SyntaxToken> {
626 support::token(&self.syntax, S![float])
627 }
628}
629#[derive(Debug, Clone, PartialEq, Eq, Hash)]
630pub struct IntValue {
631 pub(crate) syntax: SyntaxNode,
632}
633impl IntValue {
634 pub fn int_token(&self) -> Option<SyntaxToken> {
635 support::token(&self.syntax, S![int])
636 }
637}
638#[derive(Debug, Clone, PartialEq, Eq, Hash)]
639pub struct BooleanValue {
640 pub(crate) syntax: SyntaxNode,
641}
642impl BooleanValue {
643 pub fn true_token(&self) -> Option<SyntaxToken> {
644 support::token(&self.syntax, S![true])
645 }
646 pub fn false_token(&self) -> Option<SyntaxToken> {
647 support::token(&self.syntax, S![false])
648 }
649}
650#[derive(Debug, Clone, PartialEq, Eq, Hash)]
651pub struct NullValue {
652 pub(crate) syntax: SyntaxNode,
653}
654impl NullValue {
655 pub fn null_token(&self) -> Option<SyntaxToken> {
656 support::token(&self.syntax, S![null])
657 }
658}
659#[derive(Debug, Clone, PartialEq, Eq, Hash)]
660pub struct EnumValue {
661 pub(crate) syntax: SyntaxNode,
662}
663impl EnumValue {
664 pub fn name(&self) -> Option<Name> {
665 support::child(&self.syntax)
666 }
667}
668#[derive(Debug, Clone, PartialEq, Eq, Hash)]
669pub struct ListValue {
670 pub(crate) syntax: SyntaxNode,
671}
672impl ListValue {
673 pub fn l_brack_token(&self) -> Option<SyntaxToken> {
674 support::token(&self.syntax, S!['['])
675 }
676 pub fn r_brack_token(&self) -> Option<SyntaxToken> {
677 support::token(&self.syntax, S![']'])
678 }
679 pub fn values(&self) -> CstChildren<Value> {
680 support::children(&self.syntax)
681 }
682}
683#[derive(Debug, Clone, PartialEq, Eq, Hash)]
684pub struct ObjectValue {
685 pub(crate) syntax: SyntaxNode,
686}
687impl ObjectValue {
688 pub fn l_curly_token(&self) -> Option<SyntaxToken> {
689 support::token(&self.syntax, S!['{'])
690 }
691 pub fn r_curly_token(&self) -> Option<SyntaxToken> {
692 support::token(&self.syntax, S!['}'])
693 }
694 pub fn object_fields(&self) -> CstChildren<ObjectField> {
695 support::children(&self.syntax)
696 }
697}
698#[derive(Debug, Clone, PartialEq, Eq, Hash)]
699pub struct ObjectField {
700 pub(crate) syntax: SyntaxNode,
701}
702impl ObjectField {
703 pub fn name(&self) -> Option<Name> {
704 support::child(&self.syntax)
705 }
706 pub fn colon_token(&self) -> Option<SyntaxToken> {
707 support::token(&self.syntax, S![:])
708 }
709 pub fn value(&self) -> Option<Value> {
710 support::child(&self.syntax)
711 }
712}
713#[derive(Debug, Clone, PartialEq, Eq, Hash)]
714pub struct VariableDefinition {
715 pub(crate) syntax: SyntaxNode,
716}
717impl VariableDefinition {
718 pub fn description(&self) -> Option<Description> {
719 support::child(&self.syntax)
720 }
721 pub fn variable(&self) -> Option<Variable> {
722 support::child(&self.syntax)
723 }
724 pub fn colon_token(&self) -> Option<SyntaxToken> {
725 support::token(&self.syntax, S![:])
726 }
727 pub fn ty(&self) -> Option<Type> {
728 support::child(&self.syntax)
729 }
730 pub fn default_value(&self) -> Option<DefaultValue> {
731 support::child(&self.syntax)
732 }
733 pub fn directives(&self) -> Option<Directives> {
734 support::child(&self.syntax)
735 }
736}
737#[derive(Debug, Clone, PartialEq, Eq, Hash)]
738pub struct DefaultValue {
739 pub(crate) syntax: SyntaxNode,
740}
741impl DefaultValue {
742 pub fn eq_token(&self) -> Option<SyntaxToken> {
743 support::token(&self.syntax, S![=])
744 }
745 pub fn value(&self) -> Option<Value> {
746 support::child(&self.syntax)
747 }
748}
749#[derive(Debug, Clone, PartialEq, Eq, Hash)]
750pub struct ListType {
751 pub(crate) syntax: SyntaxNode,
752}
753impl ListType {
754 pub fn l_brack_token(&self) -> Option<SyntaxToken> {
755 support::token(&self.syntax, S!['['])
756 }
757 pub fn ty(&self) -> Option<Type> {
758 support::child(&self.syntax)
759 }
760 pub fn r_brack_token(&self) -> Option<SyntaxToken> {
761 support::token(&self.syntax, S![']'])
762 }
763}
764#[derive(Debug, Clone, PartialEq, Eq, Hash)]
765pub struct NonNullType {
766 pub(crate) syntax: SyntaxNode,
767}
768impl NonNullType {
769 pub fn named_type(&self) -> Option<NamedType> {
770 support::child(&self.syntax)
771 }
772 pub fn excl_token(&self) -> Option<SyntaxToken> {
773 support::token(&self.syntax, S![!])
774 }
775 pub fn list_type(&self) -> Option<ListType> {
776 support::child(&self.syntax)
777 }
778}
779#[derive(Debug, Clone, PartialEq, Eq, Hash)]
780pub struct Directive {
781 pub(crate) syntax: SyntaxNode,
782}
783impl Directive {
784 pub fn at_token(&self) -> Option<SyntaxToken> {
785 support::token(&self.syntax, S![@])
786 }
787 pub fn name(&self) -> Option<Name> {
788 support::child(&self.syntax)
789 }
790 pub fn arguments(&self) -> Option<Arguments> {
791 support::child(&self.syntax)
792 }
793}
794#[derive(Debug, Clone, PartialEq, Eq, Hash)]
795pub struct RootOperationTypeDefinition {
796 pub(crate) syntax: SyntaxNode,
797}
798impl RootOperationTypeDefinition {
799 pub fn operation_type(&self) -> Option<OperationType> {
800 support::child(&self.syntax)
801 }
802 pub fn colon_token(&self) -> Option<SyntaxToken> {
803 support::token(&self.syntax, S![:])
804 }
805 pub fn named_type(&self) -> Option<NamedType> {
806 support::child(&self.syntax)
807 }
808}
809#[derive(Debug, Clone, PartialEq, Eq, Hash)]
810pub struct ImplementsInterfaces {
811 pub(crate) syntax: SyntaxNode,
812}
813impl ImplementsInterfaces {
814 pub fn implements_token(&self) -> Option<SyntaxToken> {
815 support::token(&self.syntax, S![implements])
816 }
817 pub fn amp_token(&self) -> Option<SyntaxToken> {
818 support::token(&self.syntax, S![&])
819 }
820 pub fn named_types(&self) -> CstChildren<NamedType> {
821 support::children(&self.syntax)
822 }
823}
824#[derive(Debug, Clone, PartialEq, Eq, Hash)]
825pub struct FieldsDefinition {
826 pub(crate) syntax: SyntaxNode,
827}
828impl FieldsDefinition {
829 pub fn l_curly_token(&self) -> Option<SyntaxToken> {
830 support::token(&self.syntax, S!['{'])
831 }
832 pub fn field_definitions(&self) -> CstChildren<FieldDefinition> {
833 support::children(&self.syntax)
834 }
835 pub fn r_curly_token(&self) -> Option<SyntaxToken> {
836 support::token(&self.syntax, S!['}'])
837 }
838}
839#[derive(Debug, Clone, PartialEq, Eq, Hash)]
840pub struct FieldDefinition {
841 pub(crate) syntax: SyntaxNode,
842}
843impl FieldDefinition {
844 pub fn description(&self) -> Option<Description> {
845 support::child(&self.syntax)
846 }
847 pub fn name(&self) -> Option<Name> {
848 support::child(&self.syntax)
849 }
850 pub fn arguments_definition(&self) -> Option<ArgumentsDefinition> {
851 support::child(&self.syntax)
852 }
853 pub fn colon_token(&self) -> Option<SyntaxToken> {
854 support::token(&self.syntax, S![:])
855 }
856 pub fn ty(&self) -> Option<Type> {
857 support::child(&self.syntax)
858 }
859 pub fn directives(&self) -> Option<Directives> {
860 support::child(&self.syntax)
861 }
862}
863#[derive(Debug, Clone, PartialEq, Eq, Hash)]
864pub struct ArgumentsDefinition {
865 pub(crate) syntax: SyntaxNode,
866}
867impl ArgumentsDefinition {
868 pub fn l_paren_token(&self) -> Option<SyntaxToken> {
869 support::token(&self.syntax, S!['('])
870 }
871 pub fn input_value_definitions(&self) -> CstChildren<InputValueDefinition> {
872 support::children(&self.syntax)
873 }
874 pub fn r_paren_token(&self) -> Option<SyntaxToken> {
875 support::token(&self.syntax, S![')'])
876 }
877}
878#[derive(Debug, Clone, PartialEq, Eq, Hash)]
879pub struct InputValueDefinition {
880 pub(crate) syntax: SyntaxNode,
881}
882impl InputValueDefinition {
883 pub fn description(&self) -> Option<Description> {
884 support::child(&self.syntax)
885 }
886 pub fn name(&self) -> Option<Name> {
887 support::child(&self.syntax)
888 }
889 pub fn colon_token(&self) -> Option<SyntaxToken> {
890 support::token(&self.syntax, S![:])
891 }
892 pub fn ty(&self) -> Option<Type> {
893 support::child(&self.syntax)
894 }
895 pub fn default_value(&self) -> Option<DefaultValue> {
896 support::child(&self.syntax)
897 }
898 pub fn directives(&self) -> Option<Directives> {
899 support::child(&self.syntax)
900 }
901}
902#[derive(Debug, Clone, PartialEq, Eq, Hash)]
903pub struct UnionMemberTypes {
904 pub(crate) syntax: SyntaxNode,
905}
906impl UnionMemberTypes {
907 pub fn eq_token(&self) -> Option<SyntaxToken> {
908 support::token(&self.syntax, S![=])
909 }
910 pub fn pipe_token(&self) -> Option<SyntaxToken> {
911 support::token(&self.syntax, S![|])
912 }
913 pub fn named_types(&self) -> CstChildren<NamedType> {
914 support::children(&self.syntax)
915 }
916}
917#[derive(Debug, Clone, PartialEq, Eq, Hash)]
918pub struct EnumValuesDefinition {
919 pub(crate) syntax: SyntaxNode,
920}
921impl EnumValuesDefinition {
922 pub fn l_curly_token(&self) -> Option<SyntaxToken> {
923 support::token(&self.syntax, S!['{'])
924 }
925 pub fn enum_value_definitions(&self) -> CstChildren<EnumValueDefinition> {
926 support::children(&self.syntax)
927 }
928 pub fn r_curly_token(&self) -> Option<SyntaxToken> {
929 support::token(&self.syntax, S!['}'])
930 }
931}
932#[derive(Debug, Clone, PartialEq, Eq, Hash)]
933pub struct EnumValueDefinition {
934 pub(crate) syntax: SyntaxNode,
935}
936impl EnumValueDefinition {
937 pub fn description(&self) -> Option<Description> {
938 support::child(&self.syntax)
939 }
940 pub fn enum_value(&self) -> Option<EnumValue> {
941 support::child(&self.syntax)
942 }
943 pub fn directives(&self) -> Option<Directives> {
944 support::child(&self.syntax)
945 }
946}
947#[derive(Debug, Clone, PartialEq, Eq, Hash)]
948pub struct InputFieldsDefinition {
949 pub(crate) syntax: SyntaxNode,
950}
951impl InputFieldsDefinition {
952 pub fn l_curly_token(&self) -> Option<SyntaxToken> {
953 support::token(&self.syntax, S!['{'])
954 }
955 pub fn input_value_definitions(&self) -> CstChildren<InputValueDefinition> {
956 support::children(&self.syntax)
957 }
958 pub fn r_curly_token(&self) -> Option<SyntaxToken> {
959 support::token(&self.syntax, S!['}'])
960 }
961}
962#[derive(Debug, Clone, PartialEq, Eq, Hash)]
963pub struct DirectiveLocations {
964 pub(crate) syntax: SyntaxNode,
965}
966impl DirectiveLocations {
967 pub fn directive_locations(&self) -> CstChildren<DirectiveLocation> {
968 support::children(&self.syntax)
969 }
970}
971#[derive(Debug, Clone, PartialEq, Eq, Hash)]
972pub struct DirectiveLocation {
973 pub(crate) syntax: SyntaxNode,
974}
975impl DirectiveLocation {
976 pub fn query_token(&self) -> Option<SyntaxToken> {
977 support::token(&self.syntax, S![QUERY])
978 }
979 pub fn mutation_token(&self) -> Option<SyntaxToken> {
980 support::token(&self.syntax, S![MUTATION])
981 }
982 pub fn subscription_token(&self) -> Option<SyntaxToken> {
983 support::token(&self.syntax, S![SUBSCRIPTION])
984 }
985 pub fn field_token(&self) -> Option<SyntaxToken> {
986 support::token(&self.syntax, S![FIELD])
987 }
988 pub fn fragment_definition_token(&self) -> Option<SyntaxToken> {
989 support::token(&self.syntax, S![FRAGMENT_DEFINITION])
990 }
991 pub fn fragment_spread_token(&self) -> Option<SyntaxToken> {
992 support::token(&self.syntax, S![FRAGMENT_SPREAD])
993 }
994 pub fn inline_fragment_token(&self) -> Option<SyntaxToken> {
995 support::token(&self.syntax, S![INLINE_FRAGMENT])
996 }
997 pub fn variable_definition_token(&self) -> Option<SyntaxToken> {
998 support::token(&self.syntax, S![VARIABLE_DEFINITION])
999 }
1000 pub fn schema_token(&self) -> Option<SyntaxToken> {
1001 support::token(&self.syntax, S![SCHEMA])
1002 }
1003 pub fn scalar_token(&self) -> Option<SyntaxToken> {
1004 support::token(&self.syntax, S![SCALAR])
1005 }
1006 pub fn object_token(&self) -> Option<SyntaxToken> {
1007 support::token(&self.syntax, S![OBJECT])
1008 }
1009 pub fn field_definition_token(&self) -> Option<SyntaxToken> {
1010 support::token(&self.syntax, S![FIELD_DEFINITION])
1011 }
1012 pub fn argument_definition_token(&self) -> Option<SyntaxToken> {
1013 support::token(&self.syntax, S![ARGUMENT_DEFINITION])
1014 }
1015 pub fn interface_token(&self) -> Option<SyntaxToken> {
1016 support::token(&self.syntax, S![INTERFACE])
1017 }
1018 pub fn union_token(&self) -> Option<SyntaxToken> {
1019 support::token(&self.syntax, S![UNION])
1020 }
1021 pub fn enum_token(&self) -> Option<SyntaxToken> {
1022 support::token(&self.syntax, S![ENUM])
1023 }
1024 pub fn enum_value_token(&self) -> Option<SyntaxToken> {
1025 support::token(&self.syntax, S![ENUM_VALUE])
1026 }
1027 pub fn input_object_token(&self) -> Option<SyntaxToken> {
1028 support::token(&self.syntax, S![INPUT_OBJECT])
1029 }
1030 pub fn input_field_definition_token(&self) -> Option<SyntaxToken> {
1031 support::token(&self.syntax, S![INPUT_FIELD_DEFINITION])
1032 }
1033}
1034#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1035pub enum Definition {
1036 OperationDefinition(OperationDefinition),
1037 FragmentDefinition(FragmentDefinition),
1038 DirectiveDefinition(DirectiveDefinition),
1039 SchemaDefinition(SchemaDefinition),
1040 ScalarTypeDefinition(ScalarTypeDefinition),
1041 ObjectTypeDefinition(ObjectTypeDefinition),
1042 InterfaceTypeDefinition(InterfaceTypeDefinition),
1043 UnionTypeDefinition(UnionTypeDefinition),
1044 EnumTypeDefinition(EnumTypeDefinition),
1045 InputObjectTypeDefinition(InputObjectTypeDefinition),
1046 SchemaExtension(SchemaExtension),
1047 ScalarTypeExtension(ScalarTypeExtension),
1048 ObjectTypeExtension(ObjectTypeExtension),
1049 InterfaceTypeExtension(InterfaceTypeExtension),
1050 UnionTypeExtension(UnionTypeExtension),
1051 EnumTypeExtension(EnumTypeExtension),
1052 InputObjectTypeExtension(InputObjectTypeExtension),
1053}
1054#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1055pub enum Selection {
1056 Field(Field),
1057 FragmentSpread(FragmentSpread),
1058 InlineFragment(InlineFragment),
1059}
1060#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1061pub enum Value {
1062 Variable(Variable),
1063 StringValue(StringValue),
1064 FloatValue(FloatValue),
1065 IntValue(IntValue),
1066 BooleanValue(BooleanValue),
1067 NullValue(NullValue),
1068 EnumValue(EnumValue),
1069 ListValue(ListValue),
1070 ObjectValue(ObjectValue),
1071}
1072#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1073pub enum Type {
1074 NamedType(NamedType),
1075 ListType(ListType),
1076 NonNullType(NonNullType),
1077}
1078impl CstNode for Name {
1079 fn can_cast(kind: SyntaxKind) -> bool {
1080 kind == NAME
1081 }
1082 fn cast(syntax: SyntaxNode) -> Option<Self> {
1083 if Self::can_cast(syntax.kind()) {
1084 Some(Self { syntax })
1085 } else {
1086 None
1087 }
1088 }
1089 fn syntax(&self) -> &SyntaxNode {
1090 &self.syntax
1091 }
1092}
1093impl CstNode for Document {
1094 fn can_cast(kind: SyntaxKind) -> bool {
1095 kind == DOCUMENT
1096 }
1097 fn cast(syntax: SyntaxNode) -> Option<Self> {
1098 if Self::can_cast(syntax.kind()) {
1099 Some(Self { syntax })
1100 } else {
1101 None
1102 }
1103 }
1104 fn syntax(&self) -> &SyntaxNode {
1105 &self.syntax
1106 }
1107}
1108impl CstNode for OperationDefinition {
1109 fn can_cast(kind: SyntaxKind) -> bool {
1110 kind == OPERATION_DEFINITION
1111 }
1112 fn cast(syntax: SyntaxNode) -> Option<Self> {
1113 if Self::can_cast(syntax.kind()) {
1114 Some(Self { syntax })
1115 } else {
1116 None
1117 }
1118 }
1119 fn syntax(&self) -> &SyntaxNode {
1120 &self.syntax
1121 }
1122}
1123impl CstNode for FragmentDefinition {
1124 fn can_cast(kind: SyntaxKind) -> bool {
1125 kind == FRAGMENT_DEFINITION
1126 }
1127 fn cast(syntax: SyntaxNode) -> Option<Self> {
1128 if Self::can_cast(syntax.kind()) {
1129 Some(Self { syntax })
1130 } else {
1131 None
1132 }
1133 }
1134 fn syntax(&self) -> &SyntaxNode {
1135 &self.syntax
1136 }
1137}
1138impl CstNode for DirectiveDefinition {
1139 fn can_cast(kind: SyntaxKind) -> bool {
1140 kind == DIRECTIVE_DEFINITION
1141 }
1142 fn cast(syntax: SyntaxNode) -> Option<Self> {
1143 if Self::can_cast(syntax.kind()) {
1144 Some(Self { syntax })
1145 } else {
1146 None
1147 }
1148 }
1149 fn syntax(&self) -> &SyntaxNode {
1150 &self.syntax
1151 }
1152}
1153impl CstNode for SchemaDefinition {
1154 fn can_cast(kind: SyntaxKind) -> bool {
1155 kind == SCHEMA_DEFINITION
1156 }
1157 fn cast(syntax: SyntaxNode) -> Option<Self> {
1158 if Self::can_cast(syntax.kind()) {
1159 Some(Self { syntax })
1160 } else {
1161 None
1162 }
1163 }
1164 fn syntax(&self) -> &SyntaxNode {
1165 &self.syntax
1166 }
1167}
1168impl CstNode for ScalarTypeDefinition {
1169 fn can_cast(kind: SyntaxKind) -> bool {
1170 kind == SCALAR_TYPE_DEFINITION
1171 }
1172 fn cast(syntax: SyntaxNode) -> Option<Self> {
1173 if Self::can_cast(syntax.kind()) {
1174 Some(Self { syntax })
1175 } else {
1176 None
1177 }
1178 }
1179 fn syntax(&self) -> &SyntaxNode {
1180 &self.syntax
1181 }
1182}
1183impl CstNode for ObjectTypeDefinition {
1184 fn can_cast(kind: SyntaxKind) -> bool {
1185 kind == OBJECT_TYPE_DEFINITION
1186 }
1187 fn cast(syntax: SyntaxNode) -> Option<Self> {
1188 if Self::can_cast(syntax.kind()) {
1189 Some(Self { syntax })
1190 } else {
1191 None
1192 }
1193 }
1194 fn syntax(&self) -> &SyntaxNode {
1195 &self.syntax
1196 }
1197}
1198impl CstNode for InterfaceTypeDefinition {
1199 fn can_cast(kind: SyntaxKind) -> bool {
1200 kind == INTERFACE_TYPE_DEFINITION
1201 }
1202 fn cast(syntax: SyntaxNode) -> Option<Self> {
1203 if Self::can_cast(syntax.kind()) {
1204 Some(Self { syntax })
1205 } else {
1206 None
1207 }
1208 }
1209 fn syntax(&self) -> &SyntaxNode {
1210 &self.syntax
1211 }
1212}
1213impl CstNode for UnionTypeDefinition {
1214 fn can_cast(kind: SyntaxKind) -> bool {
1215 kind == UNION_TYPE_DEFINITION
1216 }
1217 fn cast(syntax: SyntaxNode) -> Option<Self> {
1218 if Self::can_cast(syntax.kind()) {
1219 Some(Self { syntax })
1220 } else {
1221 None
1222 }
1223 }
1224 fn syntax(&self) -> &SyntaxNode {
1225 &self.syntax
1226 }
1227}
1228impl CstNode for EnumTypeDefinition {
1229 fn can_cast(kind: SyntaxKind) -> bool {
1230 kind == ENUM_TYPE_DEFINITION
1231 }
1232 fn cast(syntax: SyntaxNode) -> Option<Self> {
1233 if Self::can_cast(syntax.kind()) {
1234 Some(Self { syntax })
1235 } else {
1236 None
1237 }
1238 }
1239 fn syntax(&self) -> &SyntaxNode {
1240 &self.syntax
1241 }
1242}
1243impl CstNode for InputObjectTypeDefinition {
1244 fn can_cast(kind: SyntaxKind) -> bool {
1245 kind == INPUT_OBJECT_TYPE_DEFINITION
1246 }
1247 fn cast(syntax: SyntaxNode) -> Option<Self> {
1248 if Self::can_cast(syntax.kind()) {
1249 Some(Self { syntax })
1250 } else {
1251 None
1252 }
1253 }
1254 fn syntax(&self) -> &SyntaxNode {
1255 &self.syntax
1256 }
1257}
1258impl CstNode for SchemaExtension {
1259 fn can_cast(kind: SyntaxKind) -> bool {
1260 kind == SCHEMA_EXTENSION
1261 }
1262 fn cast(syntax: SyntaxNode) -> Option<Self> {
1263 if Self::can_cast(syntax.kind()) {
1264 Some(Self { syntax })
1265 } else {
1266 None
1267 }
1268 }
1269 fn syntax(&self) -> &SyntaxNode {
1270 &self.syntax
1271 }
1272}
1273impl CstNode for ScalarTypeExtension {
1274 fn can_cast(kind: SyntaxKind) -> bool {
1275 kind == SCALAR_TYPE_EXTENSION
1276 }
1277 fn cast(syntax: SyntaxNode) -> Option<Self> {
1278 if Self::can_cast(syntax.kind()) {
1279 Some(Self { syntax })
1280 } else {
1281 None
1282 }
1283 }
1284 fn syntax(&self) -> &SyntaxNode {
1285 &self.syntax
1286 }
1287}
1288impl CstNode for ObjectTypeExtension {
1289 fn can_cast(kind: SyntaxKind) -> bool {
1290 kind == OBJECT_TYPE_EXTENSION
1291 }
1292 fn cast(syntax: SyntaxNode) -> Option<Self> {
1293 if Self::can_cast(syntax.kind()) {
1294 Some(Self { syntax })
1295 } else {
1296 None
1297 }
1298 }
1299 fn syntax(&self) -> &SyntaxNode {
1300 &self.syntax
1301 }
1302}
1303impl CstNode for InterfaceTypeExtension {
1304 fn can_cast(kind: SyntaxKind) -> bool {
1305 kind == INTERFACE_TYPE_EXTENSION
1306 }
1307 fn cast(syntax: SyntaxNode) -> Option<Self> {
1308 if Self::can_cast(syntax.kind()) {
1309 Some(Self { syntax })
1310 } else {
1311 None
1312 }
1313 }
1314 fn syntax(&self) -> &SyntaxNode {
1315 &self.syntax
1316 }
1317}
1318impl CstNode for UnionTypeExtension {
1319 fn can_cast(kind: SyntaxKind) -> bool {
1320 kind == UNION_TYPE_EXTENSION
1321 }
1322 fn cast(syntax: SyntaxNode) -> Option<Self> {
1323 if Self::can_cast(syntax.kind()) {
1324 Some(Self { syntax })
1325 } else {
1326 None
1327 }
1328 }
1329 fn syntax(&self) -> &SyntaxNode {
1330 &self.syntax
1331 }
1332}
1333impl CstNode for EnumTypeExtension {
1334 fn can_cast(kind: SyntaxKind) -> bool {
1335 kind == ENUM_TYPE_EXTENSION
1336 }
1337 fn cast(syntax: SyntaxNode) -> Option<Self> {
1338 if Self::can_cast(syntax.kind()) {
1339 Some(Self { syntax })
1340 } else {
1341 None
1342 }
1343 }
1344 fn syntax(&self) -> &SyntaxNode {
1345 &self.syntax
1346 }
1347}
1348impl CstNode for InputObjectTypeExtension {
1349 fn can_cast(kind: SyntaxKind) -> bool {
1350 kind == INPUT_OBJECT_TYPE_EXTENSION
1351 }
1352 fn cast(syntax: SyntaxNode) -> Option<Self> {
1353 if Self::can_cast(syntax.kind()) {
1354 Some(Self { syntax })
1355 } else {
1356 None
1357 }
1358 }
1359 fn syntax(&self) -> &SyntaxNode {
1360 &self.syntax
1361 }
1362}
1363impl CstNode for Description {
1364 fn can_cast(kind: SyntaxKind) -> bool {
1365 kind == DESCRIPTION
1366 }
1367 fn cast(syntax: SyntaxNode) -> Option<Self> {
1368 if Self::can_cast(syntax.kind()) {
1369 Some(Self { syntax })
1370 } else {
1371 None
1372 }
1373 }
1374 fn syntax(&self) -> &SyntaxNode {
1375 &self.syntax
1376 }
1377}
1378impl CstNode for OperationType {
1379 fn can_cast(kind: SyntaxKind) -> bool {
1380 kind == OPERATION_TYPE
1381 }
1382 fn cast(syntax: SyntaxNode) -> Option<Self> {
1383 if Self::can_cast(syntax.kind()) {
1384 Some(Self { syntax })
1385 } else {
1386 None
1387 }
1388 }
1389 fn syntax(&self) -> &SyntaxNode {
1390 &self.syntax
1391 }
1392}
1393impl CstNode for VariableDefinitions {
1394 fn can_cast(kind: SyntaxKind) -> bool {
1395 kind == VARIABLE_DEFINITIONS
1396 }
1397 fn cast(syntax: SyntaxNode) -> Option<Self> {
1398 if Self::can_cast(syntax.kind()) {
1399 Some(Self { syntax })
1400 } else {
1401 None
1402 }
1403 }
1404 fn syntax(&self) -> &SyntaxNode {
1405 &self.syntax
1406 }
1407}
1408impl CstNode for Directives {
1409 fn can_cast(kind: SyntaxKind) -> bool {
1410 kind == DIRECTIVES
1411 }
1412 fn cast(syntax: SyntaxNode) -> Option<Self> {
1413 if Self::can_cast(syntax.kind()) {
1414 Some(Self { syntax })
1415 } else {
1416 None
1417 }
1418 }
1419 fn syntax(&self) -> &SyntaxNode {
1420 &self.syntax
1421 }
1422}
1423impl CstNode for SelectionSet {
1424 fn can_cast(kind: SyntaxKind) -> bool {
1425 kind == SELECTION_SET
1426 }
1427 fn cast(syntax: SyntaxNode) -> Option<Self> {
1428 if Self::can_cast(syntax.kind()) {
1429 Some(Self { syntax })
1430 } else {
1431 None
1432 }
1433 }
1434 fn syntax(&self) -> &SyntaxNode {
1435 &self.syntax
1436 }
1437}
1438impl CstNode for Field {
1439 fn can_cast(kind: SyntaxKind) -> bool {
1440 kind == FIELD
1441 }
1442 fn cast(syntax: SyntaxNode) -> Option<Self> {
1443 if Self::can_cast(syntax.kind()) {
1444 Some(Self { syntax })
1445 } else {
1446 None
1447 }
1448 }
1449 fn syntax(&self) -> &SyntaxNode {
1450 &self.syntax
1451 }
1452}
1453impl CstNode for FragmentSpread {
1454 fn can_cast(kind: SyntaxKind) -> bool {
1455 kind == FRAGMENT_SPREAD
1456 }
1457 fn cast(syntax: SyntaxNode) -> Option<Self> {
1458 if Self::can_cast(syntax.kind()) {
1459 Some(Self { syntax })
1460 } else {
1461 None
1462 }
1463 }
1464 fn syntax(&self) -> &SyntaxNode {
1465 &self.syntax
1466 }
1467}
1468impl CstNode for InlineFragment {
1469 fn can_cast(kind: SyntaxKind) -> bool {
1470 kind == INLINE_FRAGMENT
1471 }
1472 fn cast(syntax: SyntaxNode) -> Option<Self> {
1473 if Self::can_cast(syntax.kind()) {
1474 Some(Self { syntax })
1475 } else {
1476 None
1477 }
1478 }
1479 fn syntax(&self) -> &SyntaxNode {
1480 &self.syntax
1481 }
1482}
1483impl CstNode for Alias {
1484 fn can_cast(kind: SyntaxKind) -> bool {
1485 kind == ALIAS
1486 }
1487 fn cast(syntax: SyntaxNode) -> Option<Self> {
1488 if Self::can_cast(syntax.kind()) {
1489 Some(Self { syntax })
1490 } else {
1491 None
1492 }
1493 }
1494 fn syntax(&self) -> &SyntaxNode {
1495 &self.syntax
1496 }
1497}
1498impl CstNode for Arguments {
1499 fn can_cast(kind: SyntaxKind) -> bool {
1500 kind == ARGUMENTS
1501 }
1502 fn cast(syntax: SyntaxNode) -> Option<Self> {
1503 if Self::can_cast(syntax.kind()) {
1504 Some(Self { syntax })
1505 } else {
1506 None
1507 }
1508 }
1509 fn syntax(&self) -> &SyntaxNode {
1510 &self.syntax
1511 }
1512}
1513impl CstNode for Argument {
1514 fn can_cast(kind: SyntaxKind) -> bool {
1515 kind == ARGUMENT
1516 }
1517 fn cast(syntax: SyntaxNode) -> Option<Self> {
1518 if Self::can_cast(syntax.kind()) {
1519 Some(Self { syntax })
1520 } else {
1521 None
1522 }
1523 }
1524 fn syntax(&self) -> &SyntaxNode {
1525 &self.syntax
1526 }
1527}
1528impl CstNode for FragmentName {
1529 fn can_cast(kind: SyntaxKind) -> bool {
1530 kind == FRAGMENT_NAME
1531 }
1532 fn cast(syntax: SyntaxNode) -> Option<Self> {
1533 if Self::can_cast(syntax.kind()) {
1534 Some(Self { syntax })
1535 } else {
1536 None
1537 }
1538 }
1539 fn syntax(&self) -> &SyntaxNode {
1540 &self.syntax
1541 }
1542}
1543impl CstNode for TypeCondition {
1544 fn can_cast(kind: SyntaxKind) -> bool {
1545 kind == TYPE_CONDITION
1546 }
1547 fn cast(syntax: SyntaxNode) -> Option<Self> {
1548 if Self::can_cast(syntax.kind()) {
1549 Some(Self { syntax })
1550 } else {
1551 None
1552 }
1553 }
1554 fn syntax(&self) -> &SyntaxNode {
1555 &self.syntax
1556 }
1557}
1558impl CstNode for NamedType {
1559 fn can_cast(kind: SyntaxKind) -> bool {
1560 kind == NAMED_TYPE
1561 }
1562 fn cast(syntax: SyntaxNode) -> Option<Self> {
1563 if Self::can_cast(syntax.kind()) {
1564 Some(Self { syntax })
1565 } else {
1566 None
1567 }
1568 }
1569 fn syntax(&self) -> &SyntaxNode {
1570 &self.syntax
1571 }
1572}
1573impl CstNode for Variable {
1574 fn can_cast(kind: SyntaxKind) -> bool {
1575 kind == VARIABLE
1576 }
1577 fn cast(syntax: SyntaxNode) -> Option<Self> {
1578 if Self::can_cast(syntax.kind()) {
1579 Some(Self { syntax })
1580 } else {
1581 None
1582 }
1583 }
1584 fn syntax(&self) -> &SyntaxNode {
1585 &self.syntax
1586 }
1587}
1588impl CstNode for StringValue {
1589 fn can_cast(kind: SyntaxKind) -> bool {
1590 kind == STRING_VALUE
1591 }
1592 fn cast(syntax: SyntaxNode) -> Option<Self> {
1593 if Self::can_cast(syntax.kind()) {
1594 Some(Self { syntax })
1595 } else {
1596 None
1597 }
1598 }
1599 fn syntax(&self) -> &SyntaxNode {
1600 &self.syntax
1601 }
1602}
1603impl CstNode for FloatValue {
1604 fn can_cast(kind: SyntaxKind) -> bool {
1605 kind == FLOAT_VALUE
1606 }
1607 fn cast(syntax: SyntaxNode) -> Option<Self> {
1608 if Self::can_cast(syntax.kind()) {
1609 Some(Self { syntax })
1610 } else {
1611 None
1612 }
1613 }
1614 fn syntax(&self) -> &SyntaxNode {
1615 &self.syntax
1616 }
1617}
1618impl CstNode for IntValue {
1619 fn can_cast(kind: SyntaxKind) -> bool {
1620 kind == INT_VALUE
1621 }
1622 fn cast(syntax: SyntaxNode) -> Option<Self> {
1623 if Self::can_cast(syntax.kind()) {
1624 Some(Self { syntax })
1625 } else {
1626 None
1627 }
1628 }
1629 fn syntax(&self) -> &SyntaxNode {
1630 &self.syntax
1631 }
1632}
1633impl CstNode for BooleanValue {
1634 fn can_cast(kind: SyntaxKind) -> bool {
1635 kind == BOOLEAN_VALUE
1636 }
1637 fn cast(syntax: SyntaxNode) -> Option<Self> {
1638 if Self::can_cast(syntax.kind()) {
1639 Some(Self { syntax })
1640 } else {
1641 None
1642 }
1643 }
1644 fn syntax(&self) -> &SyntaxNode {
1645 &self.syntax
1646 }
1647}
1648impl CstNode for NullValue {
1649 fn can_cast(kind: SyntaxKind) -> bool {
1650 kind == NULL_VALUE
1651 }
1652 fn cast(syntax: SyntaxNode) -> Option<Self> {
1653 if Self::can_cast(syntax.kind()) {
1654 Some(Self { syntax })
1655 } else {
1656 None
1657 }
1658 }
1659 fn syntax(&self) -> &SyntaxNode {
1660 &self.syntax
1661 }
1662}
1663impl CstNode for EnumValue {
1664 fn can_cast(kind: SyntaxKind) -> bool {
1665 kind == ENUM_VALUE
1666 }
1667 fn cast(syntax: SyntaxNode) -> Option<Self> {
1668 if Self::can_cast(syntax.kind()) {
1669 Some(Self { syntax })
1670 } else {
1671 None
1672 }
1673 }
1674 fn syntax(&self) -> &SyntaxNode {
1675 &self.syntax
1676 }
1677}
1678impl CstNode for ListValue {
1679 fn can_cast(kind: SyntaxKind) -> bool {
1680 kind == LIST_VALUE
1681 }
1682 fn cast(syntax: SyntaxNode) -> Option<Self> {
1683 if Self::can_cast(syntax.kind()) {
1684 Some(Self { syntax })
1685 } else {
1686 None
1687 }
1688 }
1689 fn syntax(&self) -> &SyntaxNode {
1690 &self.syntax
1691 }
1692}
1693impl CstNode for ObjectValue {
1694 fn can_cast(kind: SyntaxKind) -> bool {
1695 kind == OBJECT_VALUE
1696 }
1697 fn cast(syntax: SyntaxNode) -> Option<Self> {
1698 if Self::can_cast(syntax.kind()) {
1699 Some(Self { syntax })
1700 } else {
1701 None
1702 }
1703 }
1704 fn syntax(&self) -> &SyntaxNode {
1705 &self.syntax
1706 }
1707}
1708impl CstNode for ObjectField {
1709 fn can_cast(kind: SyntaxKind) -> bool {
1710 kind == OBJECT_FIELD
1711 }
1712 fn cast(syntax: SyntaxNode) -> Option<Self> {
1713 if Self::can_cast(syntax.kind()) {
1714 Some(Self { syntax })
1715 } else {
1716 None
1717 }
1718 }
1719 fn syntax(&self) -> &SyntaxNode {
1720 &self.syntax
1721 }
1722}
1723impl CstNode for VariableDefinition {
1724 fn can_cast(kind: SyntaxKind) -> bool {
1725 kind == VARIABLE_DEFINITION
1726 }
1727 fn cast(syntax: SyntaxNode) -> Option<Self> {
1728 if Self::can_cast(syntax.kind()) {
1729 Some(Self { syntax })
1730 } else {
1731 None
1732 }
1733 }
1734 fn syntax(&self) -> &SyntaxNode {
1735 &self.syntax
1736 }
1737}
1738impl CstNode for DefaultValue {
1739 fn can_cast(kind: SyntaxKind) -> bool {
1740 kind == DEFAULT_VALUE
1741 }
1742 fn cast(syntax: SyntaxNode) -> Option<Self> {
1743 if Self::can_cast(syntax.kind()) {
1744 Some(Self { syntax })
1745 } else {
1746 None
1747 }
1748 }
1749 fn syntax(&self) -> &SyntaxNode {
1750 &self.syntax
1751 }
1752}
1753impl CstNode for ListType {
1754 fn can_cast(kind: SyntaxKind) -> bool {
1755 kind == LIST_TYPE
1756 }
1757 fn cast(syntax: SyntaxNode) -> Option<Self> {
1758 if Self::can_cast(syntax.kind()) {
1759 Some(Self { syntax })
1760 } else {
1761 None
1762 }
1763 }
1764 fn syntax(&self) -> &SyntaxNode {
1765 &self.syntax
1766 }
1767}
1768impl CstNode for NonNullType {
1769 fn can_cast(kind: SyntaxKind) -> bool {
1770 kind == NON_NULL_TYPE
1771 }
1772 fn cast(syntax: SyntaxNode) -> Option<Self> {
1773 if Self::can_cast(syntax.kind()) {
1774 Some(Self { syntax })
1775 } else {
1776 None
1777 }
1778 }
1779 fn syntax(&self) -> &SyntaxNode {
1780 &self.syntax
1781 }
1782}
1783impl CstNode for Directive {
1784 fn can_cast(kind: SyntaxKind) -> bool {
1785 kind == DIRECTIVE
1786 }
1787 fn cast(syntax: SyntaxNode) -> Option<Self> {
1788 if Self::can_cast(syntax.kind()) {
1789 Some(Self { syntax })
1790 } else {
1791 None
1792 }
1793 }
1794 fn syntax(&self) -> &SyntaxNode {
1795 &self.syntax
1796 }
1797}
1798impl CstNode for RootOperationTypeDefinition {
1799 fn can_cast(kind: SyntaxKind) -> bool {
1800 kind == ROOT_OPERATION_TYPE_DEFINITION
1801 }
1802 fn cast(syntax: SyntaxNode) -> Option<Self> {
1803 if Self::can_cast(syntax.kind()) {
1804 Some(Self { syntax })
1805 } else {
1806 None
1807 }
1808 }
1809 fn syntax(&self) -> &SyntaxNode {
1810 &self.syntax
1811 }
1812}
1813impl CstNode for ImplementsInterfaces {
1814 fn can_cast(kind: SyntaxKind) -> bool {
1815 kind == IMPLEMENTS_INTERFACES
1816 }
1817 fn cast(syntax: SyntaxNode) -> Option<Self> {
1818 if Self::can_cast(syntax.kind()) {
1819 Some(Self { syntax })
1820 } else {
1821 None
1822 }
1823 }
1824 fn syntax(&self) -> &SyntaxNode {
1825 &self.syntax
1826 }
1827}
1828impl CstNode for FieldsDefinition {
1829 fn can_cast(kind: SyntaxKind) -> bool {
1830 kind == FIELDS_DEFINITION
1831 }
1832 fn cast(syntax: SyntaxNode) -> Option<Self> {
1833 if Self::can_cast(syntax.kind()) {
1834 Some(Self { syntax })
1835 } else {
1836 None
1837 }
1838 }
1839 fn syntax(&self) -> &SyntaxNode {
1840 &self.syntax
1841 }
1842}
1843impl CstNode for FieldDefinition {
1844 fn can_cast(kind: SyntaxKind) -> bool {
1845 kind == FIELD_DEFINITION
1846 }
1847 fn cast(syntax: SyntaxNode) -> Option<Self> {
1848 if Self::can_cast(syntax.kind()) {
1849 Some(Self { syntax })
1850 } else {
1851 None
1852 }
1853 }
1854 fn syntax(&self) -> &SyntaxNode {
1855 &self.syntax
1856 }
1857}
1858impl CstNode for ArgumentsDefinition {
1859 fn can_cast(kind: SyntaxKind) -> bool {
1860 kind == ARGUMENTS_DEFINITION
1861 }
1862 fn cast(syntax: SyntaxNode) -> Option<Self> {
1863 if Self::can_cast(syntax.kind()) {
1864 Some(Self { syntax })
1865 } else {
1866 None
1867 }
1868 }
1869 fn syntax(&self) -> &SyntaxNode {
1870 &self.syntax
1871 }
1872}
1873impl CstNode for InputValueDefinition {
1874 fn can_cast(kind: SyntaxKind) -> bool {
1875 kind == INPUT_VALUE_DEFINITION
1876 }
1877 fn cast(syntax: SyntaxNode) -> Option<Self> {
1878 if Self::can_cast(syntax.kind()) {
1879 Some(Self { syntax })
1880 } else {
1881 None
1882 }
1883 }
1884 fn syntax(&self) -> &SyntaxNode {
1885 &self.syntax
1886 }
1887}
1888impl CstNode for UnionMemberTypes {
1889 fn can_cast(kind: SyntaxKind) -> bool {
1890 kind == UNION_MEMBER_TYPES
1891 }
1892 fn cast(syntax: SyntaxNode) -> Option<Self> {
1893 if Self::can_cast(syntax.kind()) {
1894 Some(Self { syntax })
1895 } else {
1896 None
1897 }
1898 }
1899 fn syntax(&self) -> &SyntaxNode {
1900 &self.syntax
1901 }
1902}
1903impl CstNode for EnumValuesDefinition {
1904 fn can_cast(kind: SyntaxKind) -> bool {
1905 kind == ENUM_VALUES_DEFINITION
1906 }
1907 fn cast(syntax: SyntaxNode) -> Option<Self> {
1908 if Self::can_cast(syntax.kind()) {
1909 Some(Self { syntax })
1910 } else {
1911 None
1912 }
1913 }
1914 fn syntax(&self) -> &SyntaxNode {
1915 &self.syntax
1916 }
1917}
1918impl CstNode for EnumValueDefinition {
1919 fn can_cast(kind: SyntaxKind) -> bool {
1920 kind == ENUM_VALUE_DEFINITION
1921 }
1922 fn cast(syntax: SyntaxNode) -> Option<Self> {
1923 if Self::can_cast(syntax.kind()) {
1924 Some(Self { syntax })
1925 } else {
1926 None
1927 }
1928 }
1929 fn syntax(&self) -> &SyntaxNode {
1930 &self.syntax
1931 }
1932}
1933impl CstNode for InputFieldsDefinition {
1934 fn can_cast(kind: SyntaxKind) -> bool {
1935 kind == INPUT_FIELDS_DEFINITION
1936 }
1937 fn cast(syntax: SyntaxNode) -> Option<Self> {
1938 if Self::can_cast(syntax.kind()) {
1939 Some(Self { syntax })
1940 } else {
1941 None
1942 }
1943 }
1944 fn syntax(&self) -> &SyntaxNode {
1945 &self.syntax
1946 }
1947}
1948impl CstNode for DirectiveLocations {
1949 fn can_cast(kind: SyntaxKind) -> bool {
1950 kind == DIRECTIVE_LOCATIONS
1951 }
1952 fn cast(syntax: SyntaxNode) -> Option<Self> {
1953 if Self::can_cast(syntax.kind()) {
1954 Some(Self { syntax })
1955 } else {
1956 None
1957 }
1958 }
1959 fn syntax(&self) -> &SyntaxNode {
1960 &self.syntax
1961 }
1962}
1963impl CstNode for DirectiveLocation {
1964 fn can_cast(kind: SyntaxKind) -> bool {
1965 kind == DIRECTIVE_LOCATION
1966 }
1967 fn cast(syntax: SyntaxNode) -> Option<Self> {
1968 if Self::can_cast(syntax.kind()) {
1969 Some(Self { syntax })
1970 } else {
1971 None
1972 }
1973 }
1974 fn syntax(&self) -> &SyntaxNode {
1975 &self.syntax
1976 }
1977}
1978impl From<OperationDefinition> for Definition {
1979 fn from(node: OperationDefinition) -> Definition {
1980 Definition::OperationDefinition(node)
1981 }
1982}
1983impl From<FragmentDefinition> for Definition {
1984 fn from(node: FragmentDefinition) -> Definition {
1985 Definition::FragmentDefinition(node)
1986 }
1987}
1988impl From<DirectiveDefinition> for Definition {
1989 fn from(node: DirectiveDefinition) -> Definition {
1990 Definition::DirectiveDefinition(node)
1991 }
1992}
1993impl From<SchemaDefinition> for Definition {
1994 fn from(node: SchemaDefinition) -> Definition {
1995 Definition::SchemaDefinition(node)
1996 }
1997}
1998impl From<ScalarTypeDefinition> for Definition {
1999 fn from(node: ScalarTypeDefinition) -> Definition {
2000 Definition::ScalarTypeDefinition(node)
2001 }
2002}
2003impl From<ObjectTypeDefinition> for Definition {
2004 fn from(node: ObjectTypeDefinition) -> Definition {
2005 Definition::ObjectTypeDefinition(node)
2006 }
2007}
2008impl From<InterfaceTypeDefinition> for Definition {
2009 fn from(node: InterfaceTypeDefinition) -> Definition {
2010 Definition::InterfaceTypeDefinition(node)
2011 }
2012}
2013impl From<UnionTypeDefinition> for Definition {
2014 fn from(node: UnionTypeDefinition) -> Definition {
2015 Definition::UnionTypeDefinition(node)
2016 }
2017}
2018impl From<EnumTypeDefinition> for Definition {
2019 fn from(node: EnumTypeDefinition) -> Definition {
2020 Definition::EnumTypeDefinition(node)
2021 }
2022}
2023impl From<InputObjectTypeDefinition> for Definition {
2024 fn from(node: InputObjectTypeDefinition) -> Definition {
2025 Definition::InputObjectTypeDefinition(node)
2026 }
2027}
2028impl From<SchemaExtension> for Definition {
2029 fn from(node: SchemaExtension) -> Definition {
2030 Definition::SchemaExtension(node)
2031 }
2032}
2033impl From<ScalarTypeExtension> for Definition {
2034 fn from(node: ScalarTypeExtension) -> Definition {
2035 Definition::ScalarTypeExtension(node)
2036 }
2037}
2038impl From<ObjectTypeExtension> for Definition {
2039 fn from(node: ObjectTypeExtension) -> Definition {
2040 Definition::ObjectTypeExtension(node)
2041 }
2042}
2043impl From<InterfaceTypeExtension> for Definition {
2044 fn from(node: InterfaceTypeExtension) -> Definition {
2045 Definition::InterfaceTypeExtension(node)
2046 }
2047}
2048impl From<UnionTypeExtension> for Definition {
2049 fn from(node: UnionTypeExtension) -> Definition {
2050 Definition::UnionTypeExtension(node)
2051 }
2052}
2053impl From<EnumTypeExtension> for Definition {
2054 fn from(node: EnumTypeExtension) -> Definition {
2055 Definition::EnumTypeExtension(node)
2056 }
2057}
2058impl From<InputObjectTypeExtension> for Definition {
2059 fn from(node: InputObjectTypeExtension) -> Definition {
2060 Definition::InputObjectTypeExtension(node)
2061 }
2062}
2063impl CstNode for Definition {
2064 fn can_cast(kind: SyntaxKind) -> bool {
2065 matches!(
2066 kind,
2067 OPERATION_DEFINITION
2068 | FRAGMENT_DEFINITION
2069 | DIRECTIVE_DEFINITION
2070 | SCHEMA_DEFINITION
2071 | SCALAR_TYPE_DEFINITION
2072 | OBJECT_TYPE_DEFINITION
2073 | INTERFACE_TYPE_DEFINITION
2074 | UNION_TYPE_DEFINITION
2075 | ENUM_TYPE_DEFINITION
2076 | INPUT_OBJECT_TYPE_DEFINITION
2077 | SCHEMA_EXTENSION
2078 | SCALAR_TYPE_EXTENSION
2079 | OBJECT_TYPE_EXTENSION
2080 | INTERFACE_TYPE_EXTENSION
2081 | UNION_TYPE_EXTENSION
2082 | ENUM_TYPE_EXTENSION
2083 | INPUT_OBJECT_TYPE_EXTENSION
2084 )
2085 }
2086 fn cast(syntax: SyntaxNode) -> Option<Self> {
2087 let res = match syntax.kind() {
2088 OPERATION_DEFINITION => Definition::OperationDefinition(OperationDefinition { syntax }),
2089 FRAGMENT_DEFINITION => Definition::FragmentDefinition(FragmentDefinition { syntax }),
2090 DIRECTIVE_DEFINITION => Definition::DirectiveDefinition(DirectiveDefinition { syntax }),
2091 SCHEMA_DEFINITION => Definition::SchemaDefinition(SchemaDefinition { syntax }),
2092 SCALAR_TYPE_DEFINITION => {
2093 Definition::ScalarTypeDefinition(ScalarTypeDefinition { syntax })
2094 }
2095 OBJECT_TYPE_DEFINITION => {
2096 Definition::ObjectTypeDefinition(ObjectTypeDefinition { syntax })
2097 }
2098 INTERFACE_TYPE_DEFINITION => {
2099 Definition::InterfaceTypeDefinition(InterfaceTypeDefinition { syntax })
2100 }
2101 UNION_TYPE_DEFINITION => {
2102 Definition::UnionTypeDefinition(UnionTypeDefinition { syntax })
2103 }
2104 ENUM_TYPE_DEFINITION => Definition::EnumTypeDefinition(EnumTypeDefinition { syntax }),
2105 INPUT_OBJECT_TYPE_DEFINITION => {
2106 Definition::InputObjectTypeDefinition(InputObjectTypeDefinition { syntax })
2107 }
2108 SCHEMA_EXTENSION => Definition::SchemaExtension(SchemaExtension { syntax }),
2109 SCALAR_TYPE_EXTENSION => {
2110 Definition::ScalarTypeExtension(ScalarTypeExtension { syntax })
2111 }
2112 OBJECT_TYPE_EXTENSION => {
2113 Definition::ObjectTypeExtension(ObjectTypeExtension { syntax })
2114 }
2115 INTERFACE_TYPE_EXTENSION => {
2116 Definition::InterfaceTypeExtension(InterfaceTypeExtension { syntax })
2117 }
2118 UNION_TYPE_EXTENSION => Definition::UnionTypeExtension(UnionTypeExtension { syntax }),
2119 ENUM_TYPE_EXTENSION => Definition::EnumTypeExtension(EnumTypeExtension { syntax }),
2120 INPUT_OBJECT_TYPE_EXTENSION => {
2121 Definition::InputObjectTypeExtension(InputObjectTypeExtension { syntax })
2122 }
2123 _ => return None,
2124 };
2125 Some(res)
2126 }
2127 fn syntax(&self) -> &SyntaxNode {
2128 match self {
2129 Definition::OperationDefinition(it) => it.syntax(),
2130 Definition::FragmentDefinition(it) => it.syntax(),
2131 Definition::DirectiveDefinition(it) => it.syntax(),
2132 Definition::SchemaDefinition(it) => it.syntax(),
2133 Definition::ScalarTypeDefinition(it) => it.syntax(),
2134 Definition::ObjectTypeDefinition(it) => it.syntax(),
2135 Definition::InterfaceTypeDefinition(it) => it.syntax(),
2136 Definition::UnionTypeDefinition(it) => it.syntax(),
2137 Definition::EnumTypeDefinition(it) => it.syntax(),
2138 Definition::InputObjectTypeDefinition(it) => it.syntax(),
2139 Definition::SchemaExtension(it) => it.syntax(),
2140 Definition::ScalarTypeExtension(it) => it.syntax(),
2141 Definition::ObjectTypeExtension(it) => it.syntax(),
2142 Definition::InterfaceTypeExtension(it) => it.syntax(),
2143 Definition::UnionTypeExtension(it) => it.syntax(),
2144 Definition::EnumTypeExtension(it) => it.syntax(),
2145 Definition::InputObjectTypeExtension(it) => it.syntax(),
2146 }
2147 }
2148}
2149impl From<Field> for Selection {
2150 fn from(node: Field) -> Selection {
2151 Selection::Field(node)
2152 }
2153}
2154impl From<FragmentSpread> for Selection {
2155 fn from(node: FragmentSpread) -> Selection {
2156 Selection::FragmentSpread(node)
2157 }
2158}
2159impl From<InlineFragment> for Selection {
2160 fn from(node: InlineFragment) -> Selection {
2161 Selection::InlineFragment(node)
2162 }
2163}
2164impl CstNode for Selection {
2165 fn can_cast(kind: SyntaxKind) -> bool {
2166 matches!(kind, FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT)
2167 }
2168 fn cast(syntax: SyntaxNode) -> Option<Self> {
2169 let res = match syntax.kind() {
2170 FIELD => Selection::Field(Field { syntax }),
2171 FRAGMENT_SPREAD => Selection::FragmentSpread(FragmentSpread { syntax }),
2172 INLINE_FRAGMENT => Selection::InlineFragment(InlineFragment { syntax }),
2173 _ => return None,
2174 };
2175 Some(res)
2176 }
2177 fn syntax(&self) -> &SyntaxNode {
2178 match self {
2179 Selection::Field(it) => it.syntax(),
2180 Selection::FragmentSpread(it) => it.syntax(),
2181 Selection::InlineFragment(it) => it.syntax(),
2182 }
2183 }
2184}
2185impl From<Variable> for Value {
2186 fn from(node: Variable) -> Value {
2187 Value::Variable(node)
2188 }
2189}
2190impl From<StringValue> for Value {
2191 fn from(node: StringValue) -> Value {
2192 Value::StringValue(node)
2193 }
2194}
2195impl From<FloatValue> for Value {
2196 fn from(node: FloatValue) -> Value {
2197 Value::FloatValue(node)
2198 }
2199}
2200impl From<IntValue> for Value {
2201 fn from(node: IntValue) -> Value {
2202 Value::IntValue(node)
2203 }
2204}
2205impl From<BooleanValue> for Value {
2206 fn from(node: BooleanValue) -> Value {
2207 Value::BooleanValue(node)
2208 }
2209}
2210impl From<NullValue> for Value {
2211 fn from(node: NullValue) -> Value {
2212 Value::NullValue(node)
2213 }
2214}
2215impl From<EnumValue> for Value {
2216 fn from(node: EnumValue) -> Value {
2217 Value::EnumValue(node)
2218 }
2219}
2220impl From<ListValue> for Value {
2221 fn from(node: ListValue) -> Value {
2222 Value::ListValue(node)
2223 }
2224}
2225impl From<ObjectValue> for Value {
2226 fn from(node: ObjectValue) -> Value {
2227 Value::ObjectValue(node)
2228 }
2229}
2230impl CstNode for Value {
2231 fn can_cast(kind: SyntaxKind) -> bool {
2232 matches!(
2233 kind,
2234 VARIABLE
2235 | STRING_VALUE
2236 | FLOAT_VALUE
2237 | INT_VALUE
2238 | BOOLEAN_VALUE
2239 | NULL_VALUE
2240 | ENUM_VALUE
2241 | LIST_VALUE
2242 | OBJECT_VALUE
2243 )
2244 }
2245 fn cast(syntax: SyntaxNode) -> Option<Self> {
2246 let res = match syntax.kind() {
2247 VARIABLE => Value::Variable(Variable { syntax }),
2248 STRING_VALUE => Value::StringValue(StringValue { syntax }),
2249 FLOAT_VALUE => Value::FloatValue(FloatValue { syntax }),
2250 INT_VALUE => Value::IntValue(IntValue { syntax }),
2251 BOOLEAN_VALUE => Value::BooleanValue(BooleanValue { syntax }),
2252 NULL_VALUE => Value::NullValue(NullValue { syntax }),
2253 ENUM_VALUE => Value::EnumValue(EnumValue { syntax }),
2254 LIST_VALUE => Value::ListValue(ListValue { syntax }),
2255 OBJECT_VALUE => Value::ObjectValue(ObjectValue { syntax }),
2256 _ => return None,
2257 };
2258 Some(res)
2259 }
2260 fn syntax(&self) -> &SyntaxNode {
2261 match self {
2262 Value::Variable(it) => it.syntax(),
2263 Value::StringValue(it) => it.syntax(),
2264 Value::FloatValue(it) => it.syntax(),
2265 Value::IntValue(it) => it.syntax(),
2266 Value::BooleanValue(it) => it.syntax(),
2267 Value::NullValue(it) => it.syntax(),
2268 Value::EnumValue(it) => it.syntax(),
2269 Value::ListValue(it) => it.syntax(),
2270 Value::ObjectValue(it) => it.syntax(),
2271 }
2272 }
2273}
2274impl From<NamedType> for Type {
2275 fn from(node: NamedType) -> Type {
2276 Type::NamedType(node)
2277 }
2278}
2279impl From<ListType> for Type {
2280 fn from(node: ListType) -> Type {
2281 Type::ListType(node)
2282 }
2283}
2284impl From<NonNullType> for Type {
2285 fn from(node: NonNullType) -> Type {
2286 Type::NonNullType(node)
2287 }
2288}
2289impl CstNode for Type {
2290 fn can_cast(kind: SyntaxKind) -> bool {
2291 matches!(kind, NAMED_TYPE | LIST_TYPE | NON_NULL_TYPE)
2292 }
2293 fn cast(syntax: SyntaxNode) -> Option<Self> {
2294 let res = match syntax.kind() {
2295 NAMED_TYPE => Type::NamedType(NamedType { syntax }),
2296 LIST_TYPE => Type::ListType(ListType { syntax }),
2297 NON_NULL_TYPE => Type::NonNullType(NonNullType { syntax }),
2298 _ => return None,
2299 };
2300 Some(res)
2301 }
2302 fn syntax(&self) -> &SyntaxNode {
2303 match self {
2304 Type::NamedType(it) => it.syntax(),
2305 Type::ListType(it) => it.syntax(),
2306 Type::NonNullType(it) => it.syntax(),
2307 }
2308 }
2309}