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