diff --git a/crates/biome_graphql_parser/src/parser/definitions/field.rs b/crates/biome_graphql_parser/src/parser/definitions/field.rs new file mode 100644 index 000000000000..af71fd20bc28 --- /dev/null +++ b/crates/biome_graphql_parser/src/parser/definitions/field.rs @@ -0,0 +1,225 @@ +use crate::parser::{ + directive::DirectiveList, + is_at_name, parse_description, + parse_error::{expected_field_definition, expected_name, expected_type}, + parse_name, + r#type::parse_type, + value::{is_at_string, parse_default_value}, + GraphqlParser, +}; +use biome_graphql_syntax::{ + GraphqlSyntaxKind::{self, *}, + T, +}; +use biome_parser::{ + parse_lists::ParseNodeList, parse_recovery::ParseRecovery, parsed_syntax::ParsedSyntax, + prelude::ParsedSyntax::*, Parser, +}; + +use super::is_at_definition; + +#[inline] +pub(super) fn parse_fields_definition(p: &mut GraphqlParser) -> ParsedSyntax { + if !is_at_fields(p) { + return Absent; + } + let m = p.start(); + + p.expect(T!['{']); + FieldDefinitionList.parse_list(p); + + p.expect(T!['}']); + Present(m.complete(p, GRAPHQL_FIELDS_DEFINITION)) +} + +#[derive(Default)] +struct FieldDefinitionList; + +impl ParseNodeList for FieldDefinitionList { + type Kind = GraphqlSyntaxKind; + type Parser<'source> = GraphqlParser<'source>; + + const LIST_KIND: Self::Kind = GRAPHQL_FIELD_DEFINITION_LIST; + + fn parse_element(&mut self, p: &mut Self::Parser<'_>) -> ParsedSyntax { + parse_field_definition(p) + } + + fn is_at_list_end(&self, p: &mut Self::Parser<'_>) -> bool { + is_at_fields_end(p) + } + + fn recover( + &mut self, + p: &mut Self::Parser<'_>, + parsed_element: ParsedSyntax, + ) -> biome_parser::parse_recovery::RecoveryResult { + parsed_element.or_recover( + p, + &FieldDefinitionListParseRecovery, + expected_field_definition, + ) + } +} + +struct FieldDefinitionListParseRecovery; + +impl ParseRecovery for FieldDefinitionListParseRecovery { + type Kind = GraphqlSyntaxKind; + type Parser<'source> = GraphqlParser<'source>; + const RECOVERED_KIND: Self::Kind = GRAPHQL_BOGUS; + + fn is_at_recovered(&self, p: &mut Self::Parser<'_>) -> bool { + is_at_field(p) || is_at_fields_end(p) + } +} + +#[inline] +fn parse_field_definition(p: &mut GraphqlParser) -> ParsedSyntax { + if !is_at_field(p) { + return Absent; + } + let m = p.start(); + + // description is optional + parse_description(p).ok(); + parse_name(p).or_add_diagnostic(p, expected_name); + + // arguments are optional + parse_arguments_definition(p).ok(); + p.expect(T![:]); + + parse_type(p).or_add_diagnostic(p, expected_type); + + DirectiveList.parse_list(p); + + Present(m.complete(p, GRAPHQL_FIELD_DEFINITION)) +} + +#[inline] +fn parse_arguments_definition(p: &mut GraphqlParser) -> ParsedSyntax { + if !is_at_arguments_definition(p) { + return Absent; + } + let m = p.start(); + + p.expect(T!['(']); + ArgumentDefinitionList.parse_list(p); + p.expect(T![')']); + + Present(m.complete(p, GRAPHQL_ARGUMENTS_DEFINITION)) +} + +#[derive(Default)] +struct ArgumentDefinitionList; +impl ParseNodeList for ArgumentDefinitionList { + type Kind = GraphqlSyntaxKind; + type Parser<'source> = GraphqlParser<'source>; + + const LIST_KIND: Self::Kind = GRAPHQL_ARGUMENT_DEFINITION_LIST; + + fn parse_element(&mut self, p: &mut Self::Parser<'_>) -> ParsedSyntax { + parse_input_value_definition(p) + } + + fn is_at_list_end(&self, p: &mut Self::Parser<'_>) -> bool { + is_at_arguments_definition_end(p) + } + + fn recover( + &mut self, + p: &mut Self::Parser<'_>, + parsed_element: ParsedSyntax, + ) -> biome_parser::parse_recovery::RecoveryResult { + parsed_element.or_recover( + p, + &ArgumentDefinitionListParseRecovery, + expected_field_definition, + ) + } +} + +struct ArgumentDefinitionListParseRecovery; +impl ParseRecovery for ArgumentDefinitionListParseRecovery { + type Kind = GraphqlSyntaxKind; + type Parser<'source> = GraphqlParser<'source>; + const RECOVERED_KIND: Self::Kind = GRAPHQL_BOGUS; + + fn is_at_recovered(&self, p: &mut Self::Parser<'_>) -> bool { + is_at_field(p) || is_at_fields_end(p) + } +} + +#[inline] +fn parse_input_value_definition(p: &mut GraphqlParser) -> ParsedSyntax { + if !is_at_input_value_definition(p) { + return Absent; + } + let m = p.start(); + + // description is optional + parse_description(p).ok(); + parse_name(p).or_add_diagnostic(p, expected_name); + + p.expect(T![:]); + + parse_type(p).or_add_diagnostic(p, expected_type); + + // default value is optional + parse_default_value(p).ok(); + + DirectiveList.parse_list(p); + + Present(m.complete(p, GRAPHQL_INPUT_VALUE_DEFINITION)) +} + +#[inline] +pub(super) fn is_at_fields(p: &mut GraphqlParser<'_>) -> bool { + p.at(T!['{']) + // missing opening brace + || is_at_field(p) +} + +#[inline] +pub(super) fn is_at_fields_end(p: &mut GraphqlParser<'_>) -> bool { + p.at(T!['}']) || is_at_definition(p) +} + +#[inline] +fn is_at_field(p: &mut GraphqlParser<'_>) -> bool { + (is_at_name(p) && p.nth_at(1, T![:])) + // with arguments + || (is_at_name(p) && p.nth_at(1, T!['('])) + || (is_at_string(p) && p.nth_at(1, GRAPHQL_NAME)) && p.nth_at(2, T![:]) + // missing name + || p.at(T![:]) +} + +#[inline] +fn is_at_input_value_definition(p: &mut GraphqlParser<'_>) -> bool { + (is_at_name(p) && p.nth_at(1, T![:])) + || (is_at_string(p) && p.nth_at(1, GRAPHQL_NAME) && p.nth_at(2, T![:])) + // missing name + || p.at(T![:]) + || (is_at_string(p) && p.nth_at(1, T![:])) + // missing colon: `name String` + || (is_at_name(p) && p.nth_at(1, GRAPHQL_NAME)) +} + +/// We must enforce that the arguments definition is always opened with a `(` token. +/// Otherwise, we might end up parsing a field definition as an input value definition. +/// For example: +/// ```graphql +/// name : String = "") : String +/// ``` +/// In this case, the opening parenthesis is missing, the name token of an input value definition +/// is also missing. It would be to complex to disambiguate input value definitions from field. +#[inline] +fn is_at_arguments_definition(p: &mut GraphqlParser<'_>) -> bool { + p.at(T!['(']) +} + +#[inline] +fn is_at_arguments_definition_end(p: &mut GraphqlParser<'_>) -> bool { + p.at(T![')']) || is_at_fields_end(p) +} diff --git a/crates/biome_graphql_parser/src/parser/definitions/interface.rs b/crates/biome_graphql_parser/src/parser/definitions/interface.rs new file mode 100644 index 000000000000..c37c57cc2d8f --- /dev/null +++ b/crates/biome_graphql_parser/src/parser/definitions/interface.rs @@ -0,0 +1,92 @@ +use crate::parser::{ + directive::is_at_directive, is_at_name, parse_error::expected_named_type, + r#type::parse_named_type, GraphqlParser, +}; +use biome_graphql_syntax::{ + GraphqlSyntaxKind::{self, *}, + T, +}; +use biome_parser::{ + parse_lists::ParseSeparatedList, parse_recovery::ParseRecovery, parsed_syntax::ParsedSyntax, + prelude::ParsedSyntax::*, Parser, +}; + +use super::field::{is_at_fields, is_at_fields_end}; + +#[inline] +pub(super) fn parse_implements_interface(p: &mut GraphqlParser) -> ParsedSyntax { + if !is_at_implements_interface(p) { + return Absent; + } + let m = p.start(); + + p.bump(T![implements]); + + if p.at(T![&]) { + p.bump(T![&]); + } + + ImplementsInterfaceList.parse_list(p); + + Present(m.complete(p, GRAPHQL_IMPLEMENTS_INTERFACES)) +} + +#[derive(Default)] +struct ImplementsInterfaceList; + +impl ParseSeparatedList for ImplementsInterfaceList { + type Kind = GraphqlSyntaxKind; + type Parser<'source> = GraphqlParser<'source>; + + const LIST_KIND: Self::Kind = GRAPHQL_IMPLEMENTS_INTERFACE_LIST; + + fn parse_element(&mut self, p: &mut Self::Parser<'_>) -> ParsedSyntax { + parse_named_type(p) + } + + fn is_at_list_end(&self, p: &mut Self::Parser<'_>) -> bool { + is_at_implements_interface_end(p) + } + + fn recover( + &mut self, + p: &mut Self::Parser<'_>, + parsed_element: ParsedSyntax, + ) -> biome_parser::parse_recovery::RecoveryResult { + parsed_element.or_recover( + p, + &ImplementsInterfaceListParseRecovery, + expected_named_type, + ) + } + + fn separating_element_kind(&mut self) -> Self::Kind { + T![&] + } + + fn allow_trailing_separating_element(&self) -> bool { + false + } +} + +struct ImplementsInterfaceListParseRecovery; + +impl ParseRecovery for ImplementsInterfaceListParseRecovery { + type Kind = GraphqlSyntaxKind; + type Parser<'source> = GraphqlParser<'source>; + const RECOVERED_KIND: Self::Kind = GRAPHQL_BOGUS; + + fn is_at_recovered(&self, p: &mut Self::Parser<'_>) -> bool { + is_at_name(p) || p.at(T![&]) || is_at_implements_interface_end(p) + } +} + +#[inline] +fn is_at_implements_interface(p: &mut GraphqlParser<'_>) -> bool { + p.at(T![implements]) +} + +#[inline] +fn is_at_implements_interface_end(p: &mut GraphqlParser<'_>) -> bool { + is_at_directive(p) || is_at_fields(p) || is_at_fields_end(p) +} diff --git a/crates/biome_graphql_parser/src/parser/definitions/mod.rs b/crates/biome_graphql_parser/src/parser/definitions/mod.rs index 31d2f86b3ea4..638ef1bf98fe 100644 --- a/crates/biome_graphql_parser/src/parser/definitions/mod.rs +++ b/crates/biome_graphql_parser/src/parser/definitions/mod.rs @@ -1,4 +1,7 @@ +mod field; mod fragment; +mod interface; +mod object; mod operation; mod scalar; mod schema; @@ -12,6 +15,7 @@ use biome_parser::{ use self::{ fragment::{is_at_fragment_definition, parse_fragment_definition}, + object::{is_at_object_type_definition, parse_object_type_definition}, operation::{is_at_operation, parse_operation_definition}, scalar::{is_at_scalar_type_definition, parse_scalar_type_definition}, schema::{is_at_schema_definition, parse_schema_definition}, @@ -67,6 +71,8 @@ fn parse_definition(p: &mut GraphqlParser) -> ParsedSyntax { parse_schema_definition(p) } else if is_at_scalar_type_definition(p) { parse_scalar_type_definition(p) + } else if is_at_object_type_definition(p) { + parse_object_type_definition(p) } else { Absent } @@ -79,4 +85,5 @@ fn is_at_definition(p: &mut GraphqlParser<'_>) -> bool { || is_at_fragment_definition(p) || is_at_schema_definition(p) || is_at_scalar_type_definition(p) + || is_at_object_type_definition(p) } diff --git a/crates/biome_graphql_parser/src/parser/definitions/object.rs b/crates/biome_graphql_parser/src/parser/definitions/object.rs new file mode 100644 index 000000000000..66e6a8baa09b --- /dev/null +++ b/crates/biome_graphql_parser/src/parser/definitions/object.rs @@ -0,0 +1,39 @@ +use crate::parser::{ + directive::DirectiveList, parse_description, parse_error::expected_name, parse_name, + value::is_at_string, GraphqlParser, +}; +use biome_graphql_syntax::{GraphqlSyntaxKind::*, T}; +use biome_parser::{ + parse_lists::ParseNodeList, parsed_syntax::ParsedSyntax, prelude::ParsedSyntax::*, Parser, +}; + +use super::{field::parse_fields_definition, interface::parse_implements_interface}; + +#[inline] +pub(crate) fn parse_object_type_definition(p: &mut GraphqlParser) -> ParsedSyntax { + if !is_at_object_type_definition(p) { + return Absent; + } + let m = p.start(); + + // description is optional + parse_description(p).ok(); + + p.bump(T![type]); + + parse_name(p).or_add_diagnostic(p, expected_name); + + // implements interface is optional + parse_implements_interface(p).ok(); + DirectiveList.parse_list(p); + + // fields definition is optional + parse_fields_definition(p).ok(); + + Present(m.complete(p, GRAPHQL_OBJECT_TYPE_DEFINITION)) +} + +#[inline] +pub(crate) fn is_at_object_type_definition(p: &mut GraphqlParser<'_>) -> bool { + p.at(T![type]) || (is_at_string(p) && p.nth_at(1, T![type])) +} diff --git a/crates/biome_graphql_parser/src/parser/definitions/operation.rs b/crates/biome_graphql_parser/src/parser/definitions/operation.rs index 05fab76496d5..5b7533acf54c 100644 --- a/crates/biome_graphql_parser/src/parser/definitions/operation.rs +++ b/crates/biome_graphql_parser/src/parser/definitions/operation.rs @@ -3,12 +3,11 @@ use crate::parser::{ directive::{is_at_directive, DirectiveList}, is_at_name, parse_error::{ - expected_any_selection, expected_name, expected_type, expected_value, - expected_variable_definition, + expected_any_selection, expected_name, expected_type, expected_variable_definition, }, parse_name, r#type::parse_type, - value::parse_value, + value::parse_default_value, variable::{is_at_variable, parse_variable}, GraphqlParser, }; @@ -248,18 +247,6 @@ fn parse_variable_definition(p: &mut GraphqlParser) -> ParsedSyntax { Present(m.complete(p, GRAPHQL_VARIABLE_DEFINITION)) } -#[inline] -fn parse_default_value(p: &mut GraphqlParser) -> ParsedSyntax { - if !p.at(T![=]) { - return Absent; - } - - let m = p.start(); - p.bump(T![=]); - parse_value(p).or_add_diagnostic(p, expected_value); - Present(m.complete(p, GRAPHQL_DEFAULT_VALUE)) -} - #[inline] pub(crate) fn is_at_operation(p: &GraphqlParser<'_>) -> bool { p.at_ts(OPERATION_TYPE) || is_at_selection_set(p) diff --git a/crates/biome_graphql_parser/src/parser/parse_error.rs b/crates/biome_graphql_parser/src/parser/parse_error.rs index 71a844dc9ab5..e15ed09977c1 100644 --- a/crates/biome_graphql_parser/src/parser/parse_error.rs +++ b/crates/biome_graphql_parser/src/parser/parse_error.rs @@ -38,6 +38,10 @@ pub(crate) fn expected_object_field(p: &GraphqlParser, range: TextRange) -> Pars expected_node("object field", range, p) } +pub(crate) fn expected_field_definition(p: &GraphqlParser, range: TextRange) -> ParseDiagnostic { + expected_node("field definition", range, p) +} + pub(crate) fn expected_argument(p: &GraphqlParser, range: TextRange) -> ParseDiagnostic { expected_node("argument", range, p) } diff --git a/crates/biome_graphql_parser/src/parser/value.rs b/crates/biome_graphql_parser/src/parser/value.rs index 003be7e7f284..1c16b86a85a7 100644 --- a/crates/biome_graphql_parser/src/parser/value.rs +++ b/crates/biome_graphql_parser/src/parser/value.rs @@ -99,6 +99,18 @@ impl ParseNodeList for ObjectValueMemberList { } } +#[inline] +pub(crate) fn parse_default_value(p: &mut GraphqlParser) -> ParsedSyntax { + if !p.at(T![=]) { + return Absent; + } + + let m = p.start(); + p.bump(T![=]); + parse_value(p).or_add_diagnostic(p, expected_value); + Present(m.complete(p, GRAPHQL_DEFAULT_VALUE)) +} + #[inline] pub(crate) fn parse_value(p: &mut GraphqlParser) -> ParsedSyntax { if is_at_variable(p) { diff --git a/crates/biome_graphql_parser/tests/graphql_test_suite/err/definitions/object.graphql b/crates/biome_graphql_parser/tests/graphql_test_suite/err/definitions/object.graphql new file mode 100644 index 000000000000..d6cfbb26292d --- /dev/null +++ b/crates/biome_graphql_parser/tests/graphql_test_suite/err/definitions/object.graphql @@ -0,0 +1,61 @@ +type Person + name: String +} + +type Person { + name: String + +type Person + name: String + +type Person { + name: +} + +type Person { + : String +} + +type Person { + : +} + +type Person { + name String +} + +type Person deprecated { + name: String +} + +type Person @ { + name: String +} + +type Person @ + name: String +} + +type Person implement Character @ { + name: String +} + +typ Person + +type Person implemets Character + +type Person @ + +type Person implents Character @ + +type Person implements Character & Character1 & @deprecated + +type Person { + name(start_with:): String + "filder by age age: Int @deprecated + picture(: Int = 0): Url + height("filter by height" greater_than: @deprecated): Int + weight("filter by weight" greater_than: Int = @deprecated): Int + name(start_with String): String +} + diff --git a/crates/biome_graphql_parser/tests/graphql_test_suite/err/definitions/object.graphql.snap b/crates/biome_graphql_parser/tests/graphql_test_suite/err/definitions/object.graphql.snap new file mode 100644 index 000000000000..3219ea2430cb --- /dev/null +++ b/crates/biome_graphql_parser/tests/graphql_test_suite/err/definitions/object.graphql.snap @@ -0,0 +1,1579 @@ +--- +source: crates/biome_graphql_parser/tests/spec_test.rs +expression: snapshot +--- +## Input +```graphql +type Person + name: String +} + +type Person { + name: String + +type Person + name: String + +type Person { + name: +} + +type Person { + : String +} + +type Person { + : +} + +type Person { + name String +} + +type Person deprecated { + name: String +} + +type Person @ { + name: String +} + +type Person @ + name: String +} + +type Person implement Character @ { + name: String +} + +typ Person + +type Person implemets Character + +type Person @ + +type Person implents Character @ + +type Person implements Character & Character1 & @deprecated + +type Person { + name(start_with:): String + "filder by age age: Int @deprecated + picture(: Int = 0): Url + height("filter by height" greater_than: @deprecated): Int + weight("filter by weight" greater_than: Int = @deprecated): Int + name(start_with String): String +} + + +``` + +## AST + +``` +GraphqlRoot { + bom_token: missing (optional), + definitions: GraphqlDefinitionList [ + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@5..11 "Person" [] [], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [], + fields: GraphqlFieldsDefinition { + l_curly_token: missing (required), + fields: GraphqlFieldDefinitionList [ + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@11..18 "name" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: missing (optional), + colon_token: COLON@18..20 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@20..26 "String" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + ], + r_curly_token: R_CURLY@26..28 "}" [Newline("\n")] [], + }, + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@28..35 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@35..42 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [], + fields: GraphqlFieldsDefinition { + l_curly_token: L_CURLY@42..43 "{" [] [], + fields: GraphqlFieldDefinitionList [ + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@43..50 "name" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: missing (optional), + colon_token: COLON@50..52 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@52..58 "String" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + ], + r_curly_token: missing (required), + }, + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@58..65 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@65..71 "Person" [] [], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [], + fields: GraphqlFieldsDefinition { + l_curly_token: missing (required), + fields: GraphqlFieldDefinitionList [ + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@71..78 "name" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: missing (optional), + colon_token: COLON@78..80 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@80..86 "String" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + ], + r_curly_token: missing (required), + }, + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@86..93 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@93..100 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [], + fields: GraphqlFieldsDefinition { + l_curly_token: L_CURLY@100..101 "{" [] [], + fields: GraphqlFieldDefinitionList [ + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@101..108 "name" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: missing (optional), + colon_token: COLON@108..109 ":" [] [], + ty: missing (required), + directives: GraphqlDirectiveList [], + }, + ], + r_curly_token: R_CURLY@109..111 "}" [Newline("\n")] [], + }, + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@111..118 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@118..125 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [], + fields: GraphqlFieldsDefinition { + l_curly_token: L_CURLY@125..126 "{" [] [], + fields: GraphqlFieldDefinitionList [ + GraphqlFieldDefinition { + description: missing (optional), + name: missing (required), + arguments: missing (optional), + colon_token: COLON@126..131 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@131..137 "String" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + ], + r_curly_token: R_CURLY@137..139 "}" [Newline("\n")] [], + }, + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@139..146 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@146..153 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [], + fields: GraphqlFieldsDefinition { + l_curly_token: L_CURLY@153..154 "{" [] [], + fields: GraphqlFieldDefinitionList [ + GraphqlFieldDefinition { + description: missing (optional), + name: missing (required), + arguments: missing (optional), + colon_token: COLON@154..158 ":" [Newline("\n"), Whitespace(" ")] [], + ty: missing (required), + directives: GraphqlDirectiveList [], + }, + ], + r_curly_token: R_CURLY@158..160 "}" [Newline("\n")] [], + }, + }, + GraphqlBogusDefinition { + items: [ + TYPE_KW@160..167 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + GraphqlName { + value_token: GRAPHQL_NAME@167..174 "Person" [] [Whitespace(" ")], + }, + GraphqlDirectiveList [], + GraphqlBogus { + items: [ + L_CURLY@174..175 "{" [] [], + GraphqlBogus { + items: [ + GraphqlBogus { + items: [ + GRAPHQL_NAME@175..183 "name" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + GRAPHQL_NAME@183..189 "String" [] [], + ], + }, + ], + }, + R_CURLY@189..191 "}" [Newline("\n")] [], + ], + }, + ], + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@191..198 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@198..205 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [], + fields: missing (optional), + }, + GraphqlBogusDefinition { + items: [ + GRAPHQL_NAME@205..216 "deprecated" [] [Whitespace(" ")], + ], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@216..217 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: GraphqlAlias { + value: GraphqlName { + value_token: GRAPHQL_NAME@217..224 "name" [Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@224..226 ":" [] [Whitespace(" ")], + }, + name: GraphqlName { + value_token: GRAPHQL_NAME@226..232 "String" [] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@232..234 "}" [Newline("\n")] [], + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@234..241 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@241..248 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@248..250 "@" [] [Whitespace(" ")], + name: missing (required), + arguments: missing (optional), + }, + ], + fields: GraphqlFieldsDefinition { + l_curly_token: L_CURLY@250..251 "{" [] [], + fields: GraphqlFieldDefinitionList [ + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@251..258 "name" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: missing (optional), + colon_token: COLON@258..260 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@260..266 "String" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + ], + r_curly_token: R_CURLY@266..268 "}" [Newline("\n")] [], + }, + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@268..275 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@275..282 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@282..283 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@283..290 "name" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: missing (optional), + }, + ], + fields: GraphqlFieldsDefinition { + l_curly_token: missing (required), + fields: GraphqlFieldDefinitionList [ + GraphqlFieldDefinition { + description: missing (optional), + name: missing (required), + arguments: missing (optional), + colon_token: COLON@290..292 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@292..298 "String" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + ], + r_curly_token: R_CURLY@298..300 "}" [Newline("\n")] [], + }, + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@300..307 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@307..314 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [], + fields: missing (optional), + }, + GraphqlBogusDefinition { + items: [ + GRAPHQL_NAME@314..324 "implement" [] [Whitespace(" ")], + GRAPHQL_NAME@324..334 "Character" [] [Whitespace(" ")], + AT@334..336 "@" [] [Whitespace(" ")], + ], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@336..337 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: GraphqlAlias { + value: GraphqlName { + value_token: GRAPHQL_NAME@337..344 "name" [Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@344..346 ":" [] [Whitespace(" ")], + }, + name: GraphqlName { + value_token: GRAPHQL_NAME@346..352 "String" [] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@352..354 "}" [Newline("\n")] [], + }, + GraphqlBogusDefinition { + items: [ + GRAPHQL_NAME@354..360 "typ" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + GRAPHQL_NAME@360..366 "Person" [] [], + ], + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@366..373 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@373..380 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [], + fields: missing (optional), + }, + GraphqlBogusDefinition { + items: [ + GRAPHQL_NAME@380..390 "implemets" [] [Whitespace(" ")], + GRAPHQL_NAME@390..399 "Character" [] [], + ], + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@399..406 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@406..413 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@413..414 "@" [] [], + name: missing (required), + arguments: missing (optional), + }, + ], + fields: missing (optional), + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@414..421 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@421..428 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [], + fields: missing (optional), + }, + GraphqlBogusDefinition { + items: [ + GRAPHQL_NAME@428..437 "implents" [] [Whitespace(" ")], + GRAPHQL_NAME@437..447 "Character" [] [Whitespace(" ")], + AT@447..448 "@" [] [], + ], + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@448..455 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@455..462 "Person" [] [Whitespace(" ")], + }, + implements: GraphqlImplementsInterfaces { + implements_token: IMPLEMENTS_KW@462..473 "implements" [] [Whitespace(" ")], + amp_token: missing (optional), + interfaces: GraphqlImplementsInterfaceList [ + GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@473..483 "Character" [] [Whitespace(" ")], + }, + }, + AMP@483..485 "&" [] [Whitespace(" ")], + GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@485..496 "Character1" [] [Whitespace(" ")], + }, + }, + AMP@496..498 "&" [] [Whitespace(" ")], + missing element, + ], + }, + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@498..499 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@499..509 "deprecated" [] [], + }, + arguments: missing (optional), + }, + ], + fields: missing (optional), + }, + GraphqlBogusDefinition { + items: [ + TYPE_KW@509..516 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + GraphqlName { + value_token: GRAPHQL_NAME@516..523 "Person" [] [Whitespace(" ")], + }, + GraphqlDirectiveList [], + GraphqlBogus { + items: [ + L_CURLY@523..524 "{" [] [], + GraphqlBogus { + items: [ + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@524..531 "name" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: GraphqlArgumentsDefinition { + l_paren_token: L_PAREN@531..532 "(" [] [], + arguments: GraphqlArgumentDefinitionList [ + GraphqlInputValueDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@532..542 "start_with" [] [], + }, + colon_token: COLON@542..543 ":" [] [], + ty: missing (required), + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + ], + r_paren_token: R_PAREN@543..544 ")" [] [], + }, + colon_token: COLON@544..546 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@546..552 "String" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + GraphqlBogus { + items: [ + ERROR_TOKEN@552..590 "\"filder by age age: Int @deprecated" [Newline("\n"), Whitespace(" ")] [], + ], + }, + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@590..600 "picture" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: GraphqlArgumentsDefinition { + l_paren_token: L_PAREN@600..601 "(" [] [], + arguments: GraphqlArgumentDefinitionList [ + GraphqlInputValueDefinition { + description: missing (optional), + name: missing (required), + colon_token: COLON@601..603 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@603..607 "Int" [] [Whitespace(" ")], + }, + }, + default: GraphqlDefaultValue { + eq_token: EQ@607..609 "=" [] [Whitespace(" ")], + value: GraphqlIntValue { + graphql_int_literal_token: GRAPHQL_INT_LITERAL@609..610 "0" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + ], + r_paren_token: R_PAREN@610..611 ")" [] [], + }, + colon_token: COLON@611..613 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@613..616 "Url" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@616..625 "height" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: GraphqlArgumentsDefinition { + l_paren_token: L_PAREN@625..626 "(" [] [], + arguments: GraphqlArgumentDefinitionList [ + GraphqlInputValueDefinition { + description: GraphqlDescription { + graphql_string_value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@626..645 "\"filter by height\"" [] [Whitespace(" ")], + }, + }, + name: GraphqlName { + value_token: GRAPHQL_NAME@645..657 "greater_than" [] [], + }, + colon_token: COLON@657..659 ":" [] [Whitespace(" ")], + ty: missing (required), + default: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@659..660 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@660..670 "deprecated" [] [], + }, + arguments: missing (optional), + }, + ], + }, + ], + r_paren_token: R_PAREN@670..671 ")" [] [], + }, + colon_token: COLON@671..673 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@673..676 "Int" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@676..685 "weight" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: GraphqlArgumentsDefinition { + l_paren_token: L_PAREN@685..686 "(" [] [], + arguments: GraphqlArgumentDefinitionList [ + GraphqlInputValueDefinition { + description: GraphqlDescription { + graphql_string_value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@686..705 "\"filter by weight\"" [] [Whitespace(" ")], + }, + }, + name: GraphqlName { + value_token: GRAPHQL_NAME@705..717 "greater_than" [] [], + }, + colon_token: COLON@717..719 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@719..723 "Int" [] [Whitespace(" ")], + }, + }, + default: GraphqlDefaultValue { + eq_token: EQ@723..725 "=" [] [Whitespace(" ")], + value: missing (required), + }, + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@725..726 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@726..736 "deprecated" [] [], + }, + arguments: missing (optional), + }, + ], + }, + ], + r_paren_token: R_PAREN@736..737 ")" [] [], + }, + colon_token: COLON@737..739 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@739..742 "Int" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@742..749 "name" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: GraphqlArgumentsDefinition { + l_paren_token: L_PAREN@749..750 "(" [] [], + arguments: GraphqlArgumentDefinitionList [ + GraphqlInputValueDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@750..761 "start_with" [] [Whitespace(" ")], + }, + colon_token: missing (required), + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@761..767 "String" [] [], + }, + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + ], + r_paren_token: R_PAREN@767..768 ")" [] [], + }, + colon_token: COLON@768..770 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@770..776 "String" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + ], + }, + R_CURLY@776..778 "}" [Newline("\n")] [], + ], + }, + ], + }, + ], + eof_token: EOF@778..780 "" [Newline("\n"), Newline("\n")] [], +} +``` + +## CST + +``` +0: GRAPHQL_ROOT@0..780 + 0: (empty) + 1: GRAPHQL_DEFINITION_LIST@0..778 + 0: GRAPHQL_OBJECT_TYPE_DEFINITION@0..28 + 0: (empty) + 1: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 2: GRAPHQL_NAME@5..11 + 0: GRAPHQL_NAME@5..11 "Person" [] [] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@11..11 + 5: GRAPHQL_FIELDS_DEFINITION@11..28 + 0: (empty) + 1: GRAPHQL_FIELD_DEFINITION_LIST@11..26 + 0: GRAPHQL_FIELD_DEFINITION@11..26 + 0: (empty) + 1: GRAPHQL_NAME@11..18 + 0: GRAPHQL_NAME@11..18 "name" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: COLON@18..20 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@20..26 + 0: GRAPHQL_NAME@20..26 + 0: GRAPHQL_NAME@20..26 "String" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@26..26 + 2: R_CURLY@26..28 "}" [Newline("\n")] [] + 1: GRAPHQL_OBJECT_TYPE_DEFINITION@28..58 + 0: (empty) + 1: TYPE_KW@28..35 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@35..42 + 0: GRAPHQL_NAME@35..42 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@42..42 + 5: GRAPHQL_FIELDS_DEFINITION@42..58 + 0: L_CURLY@42..43 "{" [] [] + 1: GRAPHQL_FIELD_DEFINITION_LIST@43..58 + 0: GRAPHQL_FIELD_DEFINITION@43..58 + 0: (empty) + 1: GRAPHQL_NAME@43..50 + 0: GRAPHQL_NAME@43..50 "name" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: COLON@50..52 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@52..58 + 0: GRAPHQL_NAME@52..58 + 0: GRAPHQL_NAME@52..58 "String" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@58..58 + 2: (empty) + 2: GRAPHQL_OBJECT_TYPE_DEFINITION@58..86 + 0: (empty) + 1: TYPE_KW@58..65 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@65..71 + 0: GRAPHQL_NAME@65..71 "Person" [] [] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@71..71 + 5: GRAPHQL_FIELDS_DEFINITION@71..86 + 0: (empty) + 1: GRAPHQL_FIELD_DEFINITION_LIST@71..86 + 0: GRAPHQL_FIELD_DEFINITION@71..86 + 0: (empty) + 1: GRAPHQL_NAME@71..78 + 0: GRAPHQL_NAME@71..78 "name" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: COLON@78..80 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@80..86 + 0: GRAPHQL_NAME@80..86 + 0: GRAPHQL_NAME@80..86 "String" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@86..86 + 2: (empty) + 3: GRAPHQL_OBJECT_TYPE_DEFINITION@86..111 + 0: (empty) + 1: TYPE_KW@86..93 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@93..100 + 0: GRAPHQL_NAME@93..100 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@100..100 + 5: GRAPHQL_FIELDS_DEFINITION@100..111 + 0: L_CURLY@100..101 "{" [] [] + 1: GRAPHQL_FIELD_DEFINITION_LIST@101..109 + 0: GRAPHQL_FIELD_DEFINITION@101..109 + 0: (empty) + 1: GRAPHQL_NAME@101..108 + 0: GRAPHQL_NAME@101..108 "name" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: COLON@108..109 ":" [] [] + 4: (empty) + 5: GRAPHQL_DIRECTIVE_LIST@109..109 + 2: R_CURLY@109..111 "}" [Newline("\n")] [] + 4: GRAPHQL_OBJECT_TYPE_DEFINITION@111..139 + 0: (empty) + 1: TYPE_KW@111..118 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@118..125 + 0: GRAPHQL_NAME@118..125 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@125..125 + 5: GRAPHQL_FIELDS_DEFINITION@125..139 + 0: L_CURLY@125..126 "{" [] [] + 1: GRAPHQL_FIELD_DEFINITION_LIST@126..137 + 0: GRAPHQL_FIELD_DEFINITION@126..137 + 0: (empty) + 1: (empty) + 2: (empty) + 3: COLON@126..131 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@131..137 + 0: GRAPHQL_NAME@131..137 + 0: GRAPHQL_NAME@131..137 "String" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@137..137 + 2: R_CURLY@137..139 "}" [Newline("\n")] [] + 5: GRAPHQL_OBJECT_TYPE_DEFINITION@139..160 + 0: (empty) + 1: TYPE_KW@139..146 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@146..153 + 0: GRAPHQL_NAME@146..153 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@153..153 + 5: GRAPHQL_FIELDS_DEFINITION@153..160 + 0: L_CURLY@153..154 "{" [] [] + 1: GRAPHQL_FIELD_DEFINITION_LIST@154..158 + 0: GRAPHQL_FIELD_DEFINITION@154..158 + 0: (empty) + 1: (empty) + 2: (empty) + 3: COLON@154..158 ":" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: GRAPHQL_DIRECTIVE_LIST@158..158 + 2: R_CURLY@158..160 "}" [Newline("\n")] [] + 6: GRAPHQL_BOGUS_DEFINITION@160..191 + 0: TYPE_KW@160..167 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: GRAPHQL_NAME@167..174 + 0: GRAPHQL_NAME@167..174 "Person" [] [Whitespace(" ")] + 2: GRAPHQL_DIRECTIVE_LIST@174..174 + 3: GRAPHQL_BOGUS@174..191 + 0: L_CURLY@174..175 "{" [] [] + 1: GRAPHQL_BOGUS@175..189 + 0: GRAPHQL_BOGUS@175..189 + 0: GRAPHQL_NAME@175..183 "name" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: GRAPHQL_NAME@183..189 "String" [] [] + 2: R_CURLY@189..191 "}" [Newline("\n")] [] + 7: GRAPHQL_OBJECT_TYPE_DEFINITION@191..205 + 0: (empty) + 1: TYPE_KW@191..198 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@198..205 + 0: GRAPHQL_NAME@198..205 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@205..205 + 5: (empty) + 8: GRAPHQL_BOGUS_DEFINITION@205..216 + 0: GRAPHQL_NAME@205..216 "deprecated" [] [Whitespace(" ")] + 9: GRAPHQL_SELECTION_SET@216..234 + 0: L_CURLY@216..217 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@217..232 + 0: GRAPHQL_FIELD@217..232 + 0: GRAPHQL_ALIAS@217..226 + 0: GRAPHQL_NAME@217..224 + 0: GRAPHQL_NAME@217..224 "name" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@224..226 ":" [] [Whitespace(" ")] + 1: GRAPHQL_NAME@226..232 + 0: GRAPHQL_NAME@226..232 "String" [] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@232..232 + 4: (empty) + 2: R_CURLY@232..234 "}" [Newline("\n")] [] + 10: GRAPHQL_OBJECT_TYPE_DEFINITION@234..268 + 0: (empty) + 1: TYPE_KW@234..241 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@241..248 + 0: GRAPHQL_NAME@241..248 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@248..250 + 0: GRAPHQL_DIRECTIVE@248..250 + 0: AT@248..250 "@" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 5: GRAPHQL_FIELDS_DEFINITION@250..268 + 0: L_CURLY@250..251 "{" [] [] + 1: GRAPHQL_FIELD_DEFINITION_LIST@251..266 + 0: GRAPHQL_FIELD_DEFINITION@251..266 + 0: (empty) + 1: GRAPHQL_NAME@251..258 + 0: GRAPHQL_NAME@251..258 "name" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: COLON@258..260 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@260..266 + 0: GRAPHQL_NAME@260..266 + 0: GRAPHQL_NAME@260..266 "String" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@266..266 + 2: R_CURLY@266..268 "}" [Newline("\n")] [] + 11: GRAPHQL_OBJECT_TYPE_DEFINITION@268..300 + 0: (empty) + 1: TYPE_KW@268..275 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@275..282 + 0: GRAPHQL_NAME@275..282 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@282..290 + 0: GRAPHQL_DIRECTIVE@282..290 + 0: AT@282..283 "@" [] [] + 1: GRAPHQL_NAME@283..290 + 0: GRAPHQL_NAME@283..290 "name" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 5: GRAPHQL_FIELDS_DEFINITION@290..300 + 0: (empty) + 1: GRAPHQL_FIELD_DEFINITION_LIST@290..298 + 0: GRAPHQL_FIELD_DEFINITION@290..298 + 0: (empty) + 1: (empty) + 2: (empty) + 3: COLON@290..292 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@292..298 + 0: GRAPHQL_NAME@292..298 + 0: GRAPHQL_NAME@292..298 "String" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@298..298 + 2: R_CURLY@298..300 "}" [Newline("\n")] [] + 12: GRAPHQL_OBJECT_TYPE_DEFINITION@300..314 + 0: (empty) + 1: TYPE_KW@300..307 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@307..314 + 0: GRAPHQL_NAME@307..314 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@314..314 + 5: (empty) + 13: GRAPHQL_BOGUS_DEFINITION@314..336 + 0: GRAPHQL_NAME@314..324 "implement" [] [Whitespace(" ")] + 1: GRAPHQL_NAME@324..334 "Character" [] [Whitespace(" ")] + 2: AT@334..336 "@" [] [Whitespace(" ")] + 14: GRAPHQL_SELECTION_SET@336..354 + 0: L_CURLY@336..337 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@337..352 + 0: GRAPHQL_FIELD@337..352 + 0: GRAPHQL_ALIAS@337..346 + 0: GRAPHQL_NAME@337..344 + 0: GRAPHQL_NAME@337..344 "name" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@344..346 ":" [] [Whitespace(" ")] + 1: GRAPHQL_NAME@346..352 + 0: GRAPHQL_NAME@346..352 "String" [] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@352..352 + 4: (empty) + 2: R_CURLY@352..354 "}" [Newline("\n")] [] + 15: GRAPHQL_BOGUS_DEFINITION@354..366 + 0: GRAPHQL_NAME@354..360 "typ" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: GRAPHQL_NAME@360..366 "Person" [] [] + 16: GRAPHQL_OBJECT_TYPE_DEFINITION@366..380 + 0: (empty) + 1: TYPE_KW@366..373 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@373..380 + 0: GRAPHQL_NAME@373..380 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@380..380 + 5: (empty) + 17: GRAPHQL_BOGUS_DEFINITION@380..399 + 0: GRAPHQL_NAME@380..390 "implemets" [] [Whitespace(" ")] + 1: GRAPHQL_NAME@390..399 "Character" [] [] + 18: GRAPHQL_OBJECT_TYPE_DEFINITION@399..414 + 0: (empty) + 1: TYPE_KW@399..406 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@406..413 + 0: GRAPHQL_NAME@406..413 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@413..414 + 0: GRAPHQL_DIRECTIVE@413..414 + 0: AT@413..414 "@" [] [] + 1: (empty) + 2: (empty) + 5: (empty) + 19: GRAPHQL_OBJECT_TYPE_DEFINITION@414..428 + 0: (empty) + 1: TYPE_KW@414..421 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@421..428 + 0: GRAPHQL_NAME@421..428 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@428..428 + 5: (empty) + 20: GRAPHQL_BOGUS_DEFINITION@428..448 + 0: GRAPHQL_NAME@428..437 "implents" [] [Whitespace(" ")] + 1: GRAPHQL_NAME@437..447 "Character" [] [Whitespace(" ")] + 2: AT@447..448 "@" [] [] + 21: GRAPHQL_OBJECT_TYPE_DEFINITION@448..509 + 0: (empty) + 1: TYPE_KW@448..455 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@455..462 + 0: GRAPHQL_NAME@455..462 "Person" [] [Whitespace(" ")] + 3: GRAPHQL_IMPLEMENTS_INTERFACES@462..498 + 0: IMPLEMENTS_KW@462..473 "implements" [] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_IMPLEMENTS_INTERFACE_LIST@473..498 + 0: GRAPHQL_NAMED_TYPE@473..483 + 0: GRAPHQL_NAME@473..483 + 0: GRAPHQL_NAME@473..483 "Character" [] [Whitespace(" ")] + 1: AMP@483..485 "&" [] [Whitespace(" ")] + 2: GRAPHQL_NAMED_TYPE@485..496 + 0: GRAPHQL_NAME@485..496 + 0: GRAPHQL_NAME@485..496 "Character1" [] [Whitespace(" ")] + 3: AMP@496..498 "&" [] [Whitespace(" ")] + 4: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@498..509 + 0: GRAPHQL_DIRECTIVE@498..509 + 0: AT@498..499 "@" [] [] + 1: GRAPHQL_NAME@499..509 + 0: GRAPHQL_NAME@499..509 "deprecated" [] [] + 2: (empty) + 5: (empty) + 22: GRAPHQL_BOGUS_DEFINITION@509..778 + 0: TYPE_KW@509..516 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: GRAPHQL_NAME@516..523 + 0: GRAPHQL_NAME@516..523 "Person" [] [Whitespace(" ")] + 2: GRAPHQL_DIRECTIVE_LIST@523..523 + 3: GRAPHQL_BOGUS@523..778 + 0: L_CURLY@523..524 "{" [] [] + 1: GRAPHQL_BOGUS@524..776 + 0: GRAPHQL_FIELD_DEFINITION@524..552 + 0: (empty) + 1: GRAPHQL_NAME@524..531 + 0: GRAPHQL_NAME@524..531 "name" [Newline("\n"), Whitespace(" ")] [] + 2: GRAPHQL_ARGUMENTS_DEFINITION@531..544 + 0: L_PAREN@531..532 "(" [] [] + 1: GRAPHQL_ARGUMENT_DEFINITION_LIST@532..543 + 0: GRAPHQL_INPUT_VALUE_DEFINITION@532..543 + 0: (empty) + 1: GRAPHQL_NAME@532..542 + 0: GRAPHQL_NAME@532..542 "start_with" [] [] + 2: COLON@542..543 ":" [] [] + 3: (empty) + 4: (empty) + 5: GRAPHQL_DIRECTIVE_LIST@543..543 + 2: R_PAREN@543..544 ")" [] [] + 3: COLON@544..546 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@546..552 + 0: GRAPHQL_NAME@546..552 + 0: GRAPHQL_NAME@546..552 "String" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@552..552 + 1: GRAPHQL_BOGUS@552..590 + 0: ERROR_TOKEN@552..590 "\"filder by age age: Int @deprecated" [Newline("\n"), Whitespace(" ")] [] + 2: GRAPHQL_FIELD_DEFINITION@590..616 + 0: (empty) + 1: GRAPHQL_NAME@590..600 + 0: GRAPHQL_NAME@590..600 "picture" [Newline("\n"), Whitespace(" ")] [] + 2: GRAPHQL_ARGUMENTS_DEFINITION@600..611 + 0: L_PAREN@600..601 "(" [] [] + 1: GRAPHQL_ARGUMENT_DEFINITION_LIST@601..610 + 0: GRAPHQL_INPUT_VALUE_DEFINITION@601..610 + 0: (empty) + 1: (empty) + 2: COLON@601..603 ":" [] [Whitespace(" ")] + 3: GRAPHQL_NAMED_TYPE@603..607 + 0: GRAPHQL_NAME@603..607 + 0: GRAPHQL_NAME@603..607 "Int" [] [Whitespace(" ")] + 4: GRAPHQL_DEFAULT_VALUE@607..610 + 0: EQ@607..609 "=" [] [Whitespace(" ")] + 1: GRAPHQL_INT_VALUE@609..610 + 0: GRAPHQL_INT_LITERAL@609..610 "0" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@610..610 + 2: R_PAREN@610..611 ")" [] [] + 3: COLON@611..613 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@613..616 + 0: GRAPHQL_NAME@613..616 + 0: GRAPHQL_NAME@613..616 "Url" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@616..616 + 3: GRAPHQL_FIELD_DEFINITION@616..676 + 0: (empty) + 1: GRAPHQL_NAME@616..625 + 0: GRAPHQL_NAME@616..625 "height" [Newline("\n"), Whitespace(" ")] [] + 2: GRAPHQL_ARGUMENTS_DEFINITION@625..671 + 0: L_PAREN@625..626 "(" [] [] + 1: GRAPHQL_ARGUMENT_DEFINITION_LIST@626..670 + 0: GRAPHQL_INPUT_VALUE_DEFINITION@626..670 + 0: GRAPHQL_DESCRIPTION@626..645 + 0: GRAPHQL_STRING_VALUE@626..645 + 0: GRAPHQL_STRING_LITERAL@626..645 "\"filter by height\"" [] [Whitespace(" ")] + 1: GRAPHQL_NAME@645..657 + 0: GRAPHQL_NAME@645..657 "greater_than" [] [] + 2: COLON@657..659 ":" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: GRAPHQL_DIRECTIVE_LIST@659..670 + 0: GRAPHQL_DIRECTIVE@659..670 + 0: AT@659..660 "@" [] [] + 1: GRAPHQL_NAME@660..670 + 0: GRAPHQL_NAME@660..670 "deprecated" [] [] + 2: (empty) + 2: R_PAREN@670..671 ")" [] [] + 3: COLON@671..673 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@673..676 + 0: GRAPHQL_NAME@673..676 + 0: GRAPHQL_NAME@673..676 "Int" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@676..676 + 4: GRAPHQL_FIELD_DEFINITION@676..742 + 0: (empty) + 1: GRAPHQL_NAME@676..685 + 0: GRAPHQL_NAME@676..685 "weight" [Newline("\n"), Whitespace(" ")] [] + 2: GRAPHQL_ARGUMENTS_DEFINITION@685..737 + 0: L_PAREN@685..686 "(" [] [] + 1: GRAPHQL_ARGUMENT_DEFINITION_LIST@686..736 + 0: GRAPHQL_INPUT_VALUE_DEFINITION@686..736 + 0: GRAPHQL_DESCRIPTION@686..705 + 0: GRAPHQL_STRING_VALUE@686..705 + 0: GRAPHQL_STRING_LITERAL@686..705 "\"filter by weight\"" [] [Whitespace(" ")] + 1: GRAPHQL_NAME@705..717 + 0: GRAPHQL_NAME@705..717 "greater_than" [] [] + 2: COLON@717..719 ":" [] [Whitespace(" ")] + 3: GRAPHQL_NAMED_TYPE@719..723 + 0: GRAPHQL_NAME@719..723 + 0: GRAPHQL_NAME@719..723 "Int" [] [Whitespace(" ")] + 4: GRAPHQL_DEFAULT_VALUE@723..725 + 0: EQ@723..725 "=" [] [Whitespace(" ")] + 1: (empty) + 5: GRAPHQL_DIRECTIVE_LIST@725..736 + 0: GRAPHQL_DIRECTIVE@725..736 + 0: AT@725..726 "@" [] [] + 1: GRAPHQL_NAME@726..736 + 0: GRAPHQL_NAME@726..736 "deprecated" [] [] + 2: (empty) + 2: R_PAREN@736..737 ")" [] [] + 3: COLON@737..739 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@739..742 + 0: GRAPHQL_NAME@739..742 + 0: GRAPHQL_NAME@739..742 "Int" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@742..742 + 5: GRAPHQL_FIELD_DEFINITION@742..776 + 0: (empty) + 1: GRAPHQL_NAME@742..749 + 0: GRAPHQL_NAME@742..749 "name" [Newline("\n"), Whitespace(" ")] [] + 2: GRAPHQL_ARGUMENTS_DEFINITION@749..768 + 0: L_PAREN@749..750 "(" [] [] + 1: GRAPHQL_ARGUMENT_DEFINITION_LIST@750..767 + 0: GRAPHQL_INPUT_VALUE_DEFINITION@750..767 + 0: (empty) + 1: GRAPHQL_NAME@750..761 + 0: GRAPHQL_NAME@750..761 "start_with" [] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_NAMED_TYPE@761..767 + 0: GRAPHQL_NAME@761..767 + 0: GRAPHQL_NAME@761..767 "String" [] [] + 4: (empty) + 5: GRAPHQL_DIRECTIVE_LIST@767..767 + 2: R_PAREN@767..768 ")" [] [] + 3: COLON@768..770 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@770..776 + 0: GRAPHQL_NAME@770..776 + 0: GRAPHQL_NAME@770..776 "String" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@776..776 + 2: R_CURLY@776..778 "}" [Newline("\n")] [] + 2: EOF@778..780 "" [Newline("\n"), Newline("\n")] [] + +``` + +## Diagnostics + +``` +object.graphql:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `name` + + 1 │ type Person + > 2 │ name: String + │ ^^^^ + 3 │ } + 4 │ + + i Remove name + +object.graphql:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `type` + + 6 │ name: String + 7 │ + > 8 │ type Person + │ ^^^^ + 9 │ name: String + 10 │ + + i Remove type + +object.graphql:9:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `name` + + 8 │ type Person + > 9 │ name: String + │ ^^^^ + 10 │ + 11 │ type Person { + + i Remove name + +object.graphql:11:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `type` + + 9 │ name: String + 10 │ + > 11 │ type Person { + │ ^^^^ + 12 │ name: + 13 │ } + + i Remove type + +object.graphql:13:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type but instead found '}'. + + 11 │ type Person { + 12 │ name: + > 13 │ } + │ ^ + 14 │ + 15 │ type Person { + + i Expected a type here. + + 11 │ type Person { + 12 │ name: + > 13 │ } + │ ^ + 14 │ + 15 │ type Person { + +object.graphql:16:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found ':'. + + 15 │ type Person { + > 16 │ : String + │ ^ + 17 │ } + 18 │ + + i Expected a name here. + + 15 │ type Person { + > 16 │ : String + │ ^ + 17 │ } + 18 │ + +object.graphql:20:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found ':'. + + 19 │ type Person { + > 20 │ : + │ ^ + 21 │ } + 22 │ + + i Expected a name here. + + 19 │ type Person { + > 20 │ : + │ ^ + 21 │ } + 22 │ + +object.graphql:21:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type but instead found '}'. + + 19 │ type Person { + 20 │ : + > 21 │ } + │ ^ + 22 │ + 23 │ type Person { + + i Expected a type here. + + 19 │ type Person { + 20 │ : + > 21 │ } + │ ^ + 22 │ + 23 │ type Person { + +object.graphql:24:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a field definition but instead found 'name String'. + + 23 │ type Person { + > 24 │ name String + │ ^^^^^^^^^^^ + 25 │ } + 26 │ + + i Expected a field definition here. + + 23 │ type Person { + > 24 │ name String + │ ^^^^^^^^^^^ + 25 │ } + 26 │ + +object.graphql:27:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a definition but instead found 'deprecated'. + + 25 │ } + 26 │ + > 27 │ type Person deprecated { + │ ^^^^^^^^^^ + 28 │ name: String + 29 │ } + + i Expected a definition here. + + 25 │ } + 26 │ + > 27 │ type Person deprecated { + │ ^^^^^^^^^^ + 28 │ name: String + 29 │ } + +object.graphql:31:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '{'. + + 29 │ } + 30 │ + > 31 │ type Person @ { + │ ^ + 32 │ name: String + 33 │ } + + i Expected a name here. + + 29 │ } + 30 │ + > 31 │ type Person @ { + │ ^ + 32 │ name: String + 33 │ } + +object.graphql:36:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `:` + + 35 │ type Person @ + > 36 │ name: String + │ ^ + 37 │ } + 38 │ + + i Remove : + +object.graphql:39:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a definition but instead found 'implement Character @'. + + 37 │ } + 38 │ + > 39 │ type Person implement Character @ { + │ ^^^^^^^^^^^^^^^^^^^^^ + 40 │ name: String + 41 │ } + + i Expected a definition here. + + 37 │ } + 38 │ + > 39 │ type Person implement Character @ { + │ ^^^^^^^^^^^^^^^^^^^^^ + 40 │ name: String + 41 │ } + +object.graphql:43:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a definition but instead found 'typ Person'. + + 41 │ } + 42 │ + > 43 │ typ Person + │ ^^^^^^^^^^ + 44 │ + 45 │ type Person implemets Character + + i Expected a definition here. + + 41 │ } + 42 │ + > 43 │ typ Person + │ ^^^^^^^^^^ + 44 │ + 45 │ type Person implemets Character + +object.graphql:45:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a definition but instead found 'implemets Character'. + + 43 │ typ Person + 44 │ + > 45 │ type Person implemets Character + │ ^^^^^^^^^^^^^^^^^^^ + 46 │ + 47 │ type Person @ + + i Expected a definition here. + + 43 │ typ Person + 44 │ + > 45 │ type Person implemets Character + │ ^^^^^^^^^^^^^^^^^^^ + 46 │ + 47 │ type Person @ + +object.graphql:49:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found 'type'. + + 47 │ type Person @ + 48 │ + > 49 │ type Person implents Character @ + │ ^^^^ + 50 │ + 51 │ type Person implements Character & Character1 & @deprecated + + i Expected a name here. + + 47 │ type Person @ + 48 │ + > 49 │ type Person implents Character @ + │ ^^^^ + 50 │ + 51 │ type Person implements Character & Character1 & @deprecated + +object.graphql:49:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a definition but instead found 'implents Character @'. + + 47 │ type Person @ + 48 │ + > 49 │ type Person implents Character @ + │ ^^^^^^^^^^^^^^^^^^^^ + 50 │ + 51 │ type Person implements Character & Character1 & @deprecated + + i Expected a definition here. + + 47 │ type Person @ + 48 │ + > 49 │ type Person implents Character @ + │ ^^^^^^^^^^^^^^^^^^^^ + 50 │ + 51 │ type Person implements Character & Character1 & @deprecated + +object.graphql:51:49 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a named type but instead found '@'. + + 49 │ type Person implents Character @ + 50 │ + > 51 │ type Person implements Character & Character1 & @deprecated + │ ^ + 52 │ + 53 │ type Person { + + i Expected a named type here. + + 49 │ type Person implents Character @ + 50 │ + > 51 │ type Person implements Character & Character1 & @deprecated + │ ^ + 52 │ + 53 │ type Person { + +object.graphql:54:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type but instead found ')'. + + 53 │ type Person { + > 54 │ name(start_with:): String + │ ^ + 55 │ "filder by age age: Int @deprecated + 56 │ picture(: Int = 0): Url + + i Expected a type here. + + 53 │ type Person { + > 54 │ name(start_with:): String + │ ^ + 55 │ "filder by age age: Int @deprecated + 56 │ picture(: Int = 0): Url + +object.graphql:55:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Missing closing quote + + 53 │ type Person { + 54 │ name(start_with:): String + > 55 │ "filder by age age: Int @deprecated + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 56 │ picture(: Int = 0): Url + 57 │ height("filter by height" greater_than: @deprecated): Int + +object.graphql:56:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found ':'. + + 54 │ name(start_with:): String + 55 │ "filder by age age: Int @deprecated + > 56 │ picture(: Int = 0): Url + │ ^ + 57 │ height("filter by height" greater_than: @deprecated): Int + 58 │ weight("filter by weight" greater_than: Int = @deprecated): Int + + i Expected a name here. + + 54 │ name(start_with:): String + 55 │ "filder by age age: Int @deprecated + > 56 │ picture(: Int = 0): Url + │ ^ + 57 │ height("filter by height" greater_than: @deprecated): Int + 58 │ weight("filter by weight" greater_than: Int = @deprecated): Int + +object.graphql:57:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type but instead found '@'. + + 55 │ "filder by age age: Int @deprecated + 56 │ picture(: Int = 0): Url + > 57 │ height("filter by height" greater_than: @deprecated): Int + │ ^ + 58 │ weight("filter by weight" greater_than: Int = @deprecated): Int + 59 │ name(start_with String): String + + i Expected a type here. + + 55 │ "filder by age age: Int @deprecated + 56 │ picture(: Int = 0): Url + > 57 │ height("filter by height" greater_than: @deprecated): Int + │ ^ + 58 │ weight("filter by weight" greater_than: Int = @deprecated): Int + 59 │ name(start_with String): String + +object.graphql:58:49 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a value but instead found '@'. + + 56 │ picture(: Int = 0): Url + 57 │ height("filter by height" greater_than: @deprecated): Int + > 58 │ weight("filter by weight" greater_than: Int = @deprecated): Int + │ ^ + 59 │ name(start_with String): String + 60 │ } + + i Expected a value here. + + 56 │ picture(: Int = 0): Url + 57 │ height("filter by height" greater_than: @deprecated): Int + > 58 │ weight("filter by weight" greater_than: Int = @deprecated): Int + │ ^ + 59 │ name(start_with String): String + 60 │ } + +object.graphql:59:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `String` + + 57 │ height("filter by height" greater_than: @deprecated): Int + 58 │ weight("filter by weight" greater_than: Int = @deprecated): Int + > 59 │ name(start_with String): String + │ ^^^^^^ + 60 │ } + 61 │ + + i Remove String + +``` diff --git a/crates/biome_graphql_parser/tests/graphql_test_suite/ok/definitions/object.graphql b/crates/biome_graphql_parser/tests/graphql_test_suite/ok/definitions/object.graphql new file mode 100644 index 000000000000..e222e0756531 --- /dev/null +++ b/crates/biome_graphql_parser/tests/graphql_test_suite/ok/definitions/object.graphql @@ -0,0 +1,36 @@ +type Person { + name: String + age: Int + picture: Url +} + +type Person @deprecated { + name: String +} + +type Person implements Character @deprecated { + name: String +} + +type Person implements Character { + name: String +} + +type Person + +type Person implements Character + +type Person @deprecated + +type Person implements Character @deprecated + +type Person implements Character & Character1 @deprecated + +type Person { + name(start_with: String): String + "filder by age" age: Int @deprecated + picture(size: Int = 0): Url + height("filter by height" greater_than: Int @deprecated): Int + weight("filter by weight" greater_than: Int = 0 @deprecated): Int +} + diff --git a/crates/biome_graphql_parser/tests/graphql_test_suite/ok/definitions/object.graphql.snap b/crates/biome_graphql_parser/tests/graphql_test_suite/ok/definitions/object.graphql.snap new file mode 100644 index 000000000000..98b1ebb08e10 --- /dev/null +++ b/crates/biome_graphql_parser/tests/graphql_test_suite/ok/definitions/object.graphql.snap @@ -0,0 +1,905 @@ +--- +source: crates/biome_graphql_parser/tests/spec_test.rs +expression: snapshot +--- +## Input +```graphql +type Person { + name: String + age: Int + picture: Url +} + +type Person @deprecated { + name: String +} + +type Person implements Character @deprecated { + name: String +} + +type Person implements Character { + name: String +} + +type Person + +type Person implements Character + +type Person @deprecated + +type Person implements Character @deprecated + +type Person implements Character & Character1 @deprecated + +type Person { + name(start_with: String): String + "filder by age" age: Int @deprecated + picture(size: Int = 0): Url + height("filter by height" greater_than: Int @deprecated): Int + weight("filter by weight" greater_than: Int = 0 @deprecated): Int +} + + +``` + +## AST + +``` +GraphqlRoot { + bom_token: missing (optional), + definitions: GraphqlDefinitionList [ + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@5..12 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [], + fields: GraphqlFieldsDefinition { + l_curly_token: L_CURLY@12..13 "{" [] [], + fields: GraphqlFieldDefinitionList [ + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@13..20 "name" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: missing (optional), + colon_token: COLON@20..22 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@22..28 "String" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@28..34 "age" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: missing (optional), + colon_token: COLON@34..36 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@36..39 "Int" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@39..49 "picture" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: missing (optional), + colon_token: COLON@49..51 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@51..54 "Url" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + ], + r_curly_token: R_CURLY@54..56 "}" [Newline("\n")] [], + }, + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@56..63 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@63..70 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@70..71 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@71..82 "deprecated" [] [Whitespace(" ")], + }, + arguments: missing (optional), + }, + ], + fields: GraphqlFieldsDefinition { + l_curly_token: L_CURLY@82..83 "{" [] [], + fields: GraphqlFieldDefinitionList [ + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@83..90 "name" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: missing (optional), + colon_token: COLON@90..92 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@92..98 "String" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + ], + r_curly_token: R_CURLY@98..100 "}" [Newline("\n")] [], + }, + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@100..107 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@107..114 "Person" [] [Whitespace(" ")], + }, + implements: GraphqlImplementsInterfaces { + implements_token: IMPLEMENTS_KW@114..125 "implements" [] [Whitespace(" ")], + amp_token: missing (optional), + interfaces: GraphqlImplementsInterfaceList [ + GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@125..135 "Character" [] [Whitespace(" ")], + }, + }, + ], + }, + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@135..136 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@136..147 "deprecated" [] [Whitespace(" ")], + }, + arguments: missing (optional), + }, + ], + fields: GraphqlFieldsDefinition { + l_curly_token: L_CURLY@147..148 "{" [] [], + fields: GraphqlFieldDefinitionList [ + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@148..155 "name" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: missing (optional), + colon_token: COLON@155..157 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@157..163 "String" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + ], + r_curly_token: R_CURLY@163..165 "}" [Newline("\n")] [], + }, + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@165..172 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@172..179 "Person" [] [Whitespace(" ")], + }, + implements: GraphqlImplementsInterfaces { + implements_token: IMPLEMENTS_KW@179..190 "implements" [] [Whitespace(" ")], + amp_token: missing (optional), + interfaces: GraphqlImplementsInterfaceList [ + GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@190..200 "Character" [] [Whitespace(" ")], + }, + }, + ], + }, + directives: GraphqlDirectiveList [], + fields: GraphqlFieldsDefinition { + l_curly_token: L_CURLY@200..201 "{" [] [], + fields: GraphqlFieldDefinitionList [ + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@201..208 "name" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: missing (optional), + colon_token: COLON@208..210 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@210..216 "String" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + ], + r_curly_token: R_CURLY@216..218 "}" [Newline("\n")] [], + }, + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@218..225 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@225..231 "Person" [] [], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [], + fields: missing (optional), + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@231..238 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@238..245 "Person" [] [Whitespace(" ")], + }, + implements: GraphqlImplementsInterfaces { + implements_token: IMPLEMENTS_KW@245..256 "implements" [] [Whitespace(" ")], + amp_token: missing (optional), + interfaces: GraphqlImplementsInterfaceList [ + GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@256..265 "Character" [] [], + }, + }, + ], + }, + directives: GraphqlDirectiveList [], + fields: missing (optional), + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@265..272 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@272..279 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@279..280 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@280..290 "deprecated" [] [], + }, + arguments: missing (optional), + }, + ], + fields: missing (optional), + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@290..297 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@297..304 "Person" [] [Whitespace(" ")], + }, + implements: GraphqlImplementsInterfaces { + implements_token: IMPLEMENTS_KW@304..315 "implements" [] [Whitespace(" ")], + amp_token: missing (optional), + interfaces: GraphqlImplementsInterfaceList [ + GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@315..325 "Character" [] [Whitespace(" ")], + }, + }, + ], + }, + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@325..326 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@326..336 "deprecated" [] [], + }, + arguments: missing (optional), + }, + ], + fields: missing (optional), + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@336..343 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@343..350 "Person" [] [Whitespace(" ")], + }, + implements: GraphqlImplementsInterfaces { + implements_token: IMPLEMENTS_KW@350..361 "implements" [] [Whitespace(" ")], + amp_token: missing (optional), + interfaces: GraphqlImplementsInterfaceList [ + GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@361..371 "Character" [] [Whitespace(" ")], + }, + }, + AMP@371..373 "&" [] [Whitespace(" ")], + GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@373..384 "Character1" [] [Whitespace(" ")], + }, + }, + ], + }, + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@384..385 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@385..395 "deprecated" [] [], + }, + arguments: missing (optional), + }, + ], + fields: missing (optional), + }, + GraphqlObjectTypeDefinition { + description: missing (optional), + type_token: TYPE_KW@395..402 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@402..409 "Person" [] [Whitespace(" ")], + }, + implements: missing (optional), + directives: GraphqlDirectiveList [], + fields: GraphqlFieldsDefinition { + l_curly_token: L_CURLY@409..410 "{" [] [], + fields: GraphqlFieldDefinitionList [ + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@410..417 "name" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: GraphqlArgumentsDefinition { + l_paren_token: L_PAREN@417..418 "(" [] [], + arguments: GraphqlArgumentDefinitionList [ + GraphqlInputValueDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@418..428 "start_with" [] [], + }, + colon_token: COLON@428..430 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@430..436 "String" [] [], + }, + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + ], + r_paren_token: R_PAREN@436..437 ")" [] [], + }, + colon_token: COLON@437..439 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@439..445 "String" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + GraphqlFieldDefinition { + description: GraphqlDescription { + graphql_string_value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@445..464 "\"filder by age\"" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + }, + name: GraphqlName { + value_token: GRAPHQL_NAME@464..467 "age" [] [], + }, + arguments: missing (optional), + colon_token: COLON@467..469 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@469..473 "Int" [] [Whitespace(" ")], + }, + }, + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@473..474 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@474..484 "deprecated" [] [], + }, + arguments: missing (optional), + }, + ], + }, + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@484..494 "picture" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: GraphqlArgumentsDefinition { + l_paren_token: L_PAREN@494..495 "(" [] [], + arguments: GraphqlArgumentDefinitionList [ + GraphqlInputValueDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@495..499 "size" [] [], + }, + colon_token: COLON@499..501 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@501..505 "Int" [] [Whitespace(" ")], + }, + }, + default: GraphqlDefaultValue { + eq_token: EQ@505..507 "=" [] [Whitespace(" ")], + value: GraphqlIntValue { + graphql_int_literal_token: GRAPHQL_INT_LITERAL@507..508 "0" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + ], + r_paren_token: R_PAREN@508..509 ")" [] [], + }, + colon_token: COLON@509..511 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@511..514 "Url" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@514..523 "height" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: GraphqlArgumentsDefinition { + l_paren_token: L_PAREN@523..524 "(" [] [], + arguments: GraphqlArgumentDefinitionList [ + GraphqlInputValueDefinition { + description: GraphqlDescription { + graphql_string_value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@524..543 "\"filter by height\"" [] [Whitespace(" ")], + }, + }, + name: GraphqlName { + value_token: GRAPHQL_NAME@543..555 "greater_than" [] [], + }, + colon_token: COLON@555..557 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@557..561 "Int" [] [Whitespace(" ")], + }, + }, + default: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@561..562 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@562..572 "deprecated" [] [], + }, + arguments: missing (optional), + }, + ], + }, + ], + r_paren_token: R_PAREN@572..573 ")" [] [], + }, + colon_token: COLON@573..575 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@575..578 "Int" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + GraphqlFieldDefinition { + description: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@578..587 "weight" [Newline("\n"), Whitespace(" ")] [], + }, + arguments: GraphqlArgumentsDefinition { + l_paren_token: L_PAREN@587..588 "(" [] [], + arguments: GraphqlArgumentDefinitionList [ + GraphqlInputValueDefinition { + description: GraphqlDescription { + graphql_string_value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@588..607 "\"filter by weight\"" [] [Whitespace(" ")], + }, + }, + name: GraphqlName { + value_token: GRAPHQL_NAME@607..619 "greater_than" [] [], + }, + colon_token: COLON@619..621 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@621..625 "Int" [] [Whitespace(" ")], + }, + }, + default: GraphqlDefaultValue { + eq_token: EQ@625..627 "=" [] [Whitespace(" ")], + value: GraphqlIntValue { + graphql_int_literal_token: GRAPHQL_INT_LITERAL@627..629 "0" [] [Whitespace(" ")], + }, + }, + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@629..630 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@630..640 "deprecated" [] [], + }, + arguments: missing (optional), + }, + ], + }, + ], + r_paren_token: R_PAREN@640..641 ")" [] [], + }, + colon_token: COLON@641..643 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@643..646 "Int" [] [], + }, + }, + directives: GraphqlDirectiveList [], + }, + ], + r_curly_token: R_CURLY@646..648 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@648..650 "" [Newline("\n"), Newline("\n")] [], +} +``` + +## CST + +``` +0: GRAPHQL_ROOT@0..650 + 0: (empty) + 1: GRAPHQL_DEFINITION_LIST@0..648 + 0: GRAPHQL_OBJECT_TYPE_DEFINITION@0..56 + 0: (empty) + 1: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 2: GRAPHQL_NAME@5..12 + 0: GRAPHQL_NAME@5..12 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@12..12 + 5: GRAPHQL_FIELDS_DEFINITION@12..56 + 0: L_CURLY@12..13 "{" [] [] + 1: GRAPHQL_FIELD_DEFINITION_LIST@13..54 + 0: GRAPHQL_FIELD_DEFINITION@13..28 + 0: (empty) + 1: GRAPHQL_NAME@13..20 + 0: GRAPHQL_NAME@13..20 "name" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: COLON@20..22 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@22..28 + 0: GRAPHQL_NAME@22..28 + 0: GRAPHQL_NAME@22..28 "String" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@28..28 + 1: GRAPHQL_FIELD_DEFINITION@28..39 + 0: (empty) + 1: GRAPHQL_NAME@28..34 + 0: GRAPHQL_NAME@28..34 "age" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: COLON@34..36 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@36..39 + 0: GRAPHQL_NAME@36..39 + 0: GRAPHQL_NAME@36..39 "Int" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@39..39 + 2: GRAPHQL_FIELD_DEFINITION@39..54 + 0: (empty) + 1: GRAPHQL_NAME@39..49 + 0: GRAPHQL_NAME@39..49 "picture" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: COLON@49..51 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@51..54 + 0: GRAPHQL_NAME@51..54 + 0: GRAPHQL_NAME@51..54 "Url" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@54..54 + 2: R_CURLY@54..56 "}" [Newline("\n")] [] + 1: GRAPHQL_OBJECT_TYPE_DEFINITION@56..100 + 0: (empty) + 1: TYPE_KW@56..63 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@63..70 + 0: GRAPHQL_NAME@63..70 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@70..82 + 0: GRAPHQL_DIRECTIVE@70..82 + 0: AT@70..71 "@" [] [] + 1: GRAPHQL_NAME@71..82 + 0: GRAPHQL_NAME@71..82 "deprecated" [] [Whitespace(" ")] + 2: (empty) + 5: GRAPHQL_FIELDS_DEFINITION@82..100 + 0: L_CURLY@82..83 "{" [] [] + 1: GRAPHQL_FIELD_DEFINITION_LIST@83..98 + 0: GRAPHQL_FIELD_DEFINITION@83..98 + 0: (empty) + 1: GRAPHQL_NAME@83..90 + 0: GRAPHQL_NAME@83..90 "name" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: COLON@90..92 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@92..98 + 0: GRAPHQL_NAME@92..98 + 0: GRAPHQL_NAME@92..98 "String" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@98..98 + 2: R_CURLY@98..100 "}" [Newline("\n")] [] + 2: GRAPHQL_OBJECT_TYPE_DEFINITION@100..165 + 0: (empty) + 1: TYPE_KW@100..107 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@107..114 + 0: GRAPHQL_NAME@107..114 "Person" [] [Whitespace(" ")] + 3: GRAPHQL_IMPLEMENTS_INTERFACES@114..135 + 0: IMPLEMENTS_KW@114..125 "implements" [] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_IMPLEMENTS_INTERFACE_LIST@125..135 + 0: GRAPHQL_NAMED_TYPE@125..135 + 0: GRAPHQL_NAME@125..135 + 0: GRAPHQL_NAME@125..135 "Character" [] [Whitespace(" ")] + 4: GRAPHQL_DIRECTIVE_LIST@135..147 + 0: GRAPHQL_DIRECTIVE@135..147 + 0: AT@135..136 "@" [] [] + 1: GRAPHQL_NAME@136..147 + 0: GRAPHQL_NAME@136..147 "deprecated" [] [Whitespace(" ")] + 2: (empty) + 5: GRAPHQL_FIELDS_DEFINITION@147..165 + 0: L_CURLY@147..148 "{" [] [] + 1: GRAPHQL_FIELD_DEFINITION_LIST@148..163 + 0: GRAPHQL_FIELD_DEFINITION@148..163 + 0: (empty) + 1: GRAPHQL_NAME@148..155 + 0: GRAPHQL_NAME@148..155 "name" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: COLON@155..157 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@157..163 + 0: GRAPHQL_NAME@157..163 + 0: GRAPHQL_NAME@157..163 "String" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@163..163 + 2: R_CURLY@163..165 "}" [Newline("\n")] [] + 3: GRAPHQL_OBJECT_TYPE_DEFINITION@165..218 + 0: (empty) + 1: TYPE_KW@165..172 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@172..179 + 0: GRAPHQL_NAME@172..179 "Person" [] [Whitespace(" ")] + 3: GRAPHQL_IMPLEMENTS_INTERFACES@179..200 + 0: IMPLEMENTS_KW@179..190 "implements" [] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_IMPLEMENTS_INTERFACE_LIST@190..200 + 0: GRAPHQL_NAMED_TYPE@190..200 + 0: GRAPHQL_NAME@190..200 + 0: GRAPHQL_NAME@190..200 "Character" [] [Whitespace(" ")] + 4: GRAPHQL_DIRECTIVE_LIST@200..200 + 5: GRAPHQL_FIELDS_DEFINITION@200..218 + 0: L_CURLY@200..201 "{" [] [] + 1: GRAPHQL_FIELD_DEFINITION_LIST@201..216 + 0: GRAPHQL_FIELD_DEFINITION@201..216 + 0: (empty) + 1: GRAPHQL_NAME@201..208 + 0: GRAPHQL_NAME@201..208 "name" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: COLON@208..210 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@210..216 + 0: GRAPHQL_NAME@210..216 + 0: GRAPHQL_NAME@210..216 "String" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@216..216 + 2: R_CURLY@216..218 "}" [Newline("\n")] [] + 4: GRAPHQL_OBJECT_TYPE_DEFINITION@218..231 + 0: (empty) + 1: TYPE_KW@218..225 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@225..231 + 0: GRAPHQL_NAME@225..231 "Person" [] [] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@231..231 + 5: (empty) + 5: GRAPHQL_OBJECT_TYPE_DEFINITION@231..265 + 0: (empty) + 1: TYPE_KW@231..238 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@238..245 + 0: GRAPHQL_NAME@238..245 "Person" [] [Whitespace(" ")] + 3: GRAPHQL_IMPLEMENTS_INTERFACES@245..265 + 0: IMPLEMENTS_KW@245..256 "implements" [] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_IMPLEMENTS_INTERFACE_LIST@256..265 + 0: GRAPHQL_NAMED_TYPE@256..265 + 0: GRAPHQL_NAME@256..265 + 0: GRAPHQL_NAME@256..265 "Character" [] [] + 4: GRAPHQL_DIRECTIVE_LIST@265..265 + 5: (empty) + 6: GRAPHQL_OBJECT_TYPE_DEFINITION@265..290 + 0: (empty) + 1: TYPE_KW@265..272 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@272..279 + 0: GRAPHQL_NAME@272..279 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@279..290 + 0: GRAPHQL_DIRECTIVE@279..290 + 0: AT@279..280 "@" [] [] + 1: GRAPHQL_NAME@280..290 + 0: GRAPHQL_NAME@280..290 "deprecated" [] [] + 2: (empty) + 5: (empty) + 7: GRAPHQL_OBJECT_TYPE_DEFINITION@290..336 + 0: (empty) + 1: TYPE_KW@290..297 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@297..304 + 0: GRAPHQL_NAME@297..304 "Person" [] [Whitespace(" ")] + 3: GRAPHQL_IMPLEMENTS_INTERFACES@304..325 + 0: IMPLEMENTS_KW@304..315 "implements" [] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_IMPLEMENTS_INTERFACE_LIST@315..325 + 0: GRAPHQL_NAMED_TYPE@315..325 + 0: GRAPHQL_NAME@315..325 + 0: GRAPHQL_NAME@315..325 "Character" [] [Whitespace(" ")] + 4: GRAPHQL_DIRECTIVE_LIST@325..336 + 0: GRAPHQL_DIRECTIVE@325..336 + 0: AT@325..326 "@" [] [] + 1: GRAPHQL_NAME@326..336 + 0: GRAPHQL_NAME@326..336 "deprecated" [] [] + 2: (empty) + 5: (empty) + 8: GRAPHQL_OBJECT_TYPE_DEFINITION@336..395 + 0: (empty) + 1: TYPE_KW@336..343 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@343..350 + 0: GRAPHQL_NAME@343..350 "Person" [] [Whitespace(" ")] + 3: GRAPHQL_IMPLEMENTS_INTERFACES@350..384 + 0: IMPLEMENTS_KW@350..361 "implements" [] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_IMPLEMENTS_INTERFACE_LIST@361..384 + 0: GRAPHQL_NAMED_TYPE@361..371 + 0: GRAPHQL_NAME@361..371 + 0: GRAPHQL_NAME@361..371 "Character" [] [Whitespace(" ")] + 1: AMP@371..373 "&" [] [Whitespace(" ")] + 2: GRAPHQL_NAMED_TYPE@373..384 + 0: GRAPHQL_NAME@373..384 + 0: GRAPHQL_NAME@373..384 "Character1" [] [Whitespace(" ")] + 4: GRAPHQL_DIRECTIVE_LIST@384..395 + 0: GRAPHQL_DIRECTIVE@384..395 + 0: AT@384..385 "@" [] [] + 1: GRAPHQL_NAME@385..395 + 0: GRAPHQL_NAME@385..395 "deprecated" [] [] + 2: (empty) + 5: (empty) + 9: GRAPHQL_OBJECT_TYPE_DEFINITION@395..648 + 0: (empty) + 1: TYPE_KW@395..402 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: GRAPHQL_NAME@402..409 + 0: GRAPHQL_NAME@402..409 "Person" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@409..409 + 5: GRAPHQL_FIELDS_DEFINITION@409..648 + 0: L_CURLY@409..410 "{" [] [] + 1: GRAPHQL_FIELD_DEFINITION_LIST@410..646 + 0: GRAPHQL_FIELD_DEFINITION@410..445 + 0: (empty) + 1: GRAPHQL_NAME@410..417 + 0: GRAPHQL_NAME@410..417 "name" [Newline("\n"), Whitespace(" ")] [] + 2: GRAPHQL_ARGUMENTS_DEFINITION@417..437 + 0: L_PAREN@417..418 "(" [] [] + 1: GRAPHQL_ARGUMENT_DEFINITION_LIST@418..436 + 0: GRAPHQL_INPUT_VALUE_DEFINITION@418..436 + 0: (empty) + 1: GRAPHQL_NAME@418..428 + 0: GRAPHQL_NAME@418..428 "start_with" [] [] + 2: COLON@428..430 ":" [] [Whitespace(" ")] + 3: GRAPHQL_NAMED_TYPE@430..436 + 0: GRAPHQL_NAME@430..436 + 0: GRAPHQL_NAME@430..436 "String" [] [] + 4: (empty) + 5: GRAPHQL_DIRECTIVE_LIST@436..436 + 2: R_PAREN@436..437 ")" [] [] + 3: COLON@437..439 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@439..445 + 0: GRAPHQL_NAME@439..445 + 0: GRAPHQL_NAME@439..445 "String" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@445..445 + 1: GRAPHQL_FIELD_DEFINITION@445..484 + 0: GRAPHQL_DESCRIPTION@445..464 + 0: GRAPHQL_STRING_VALUE@445..464 + 0: GRAPHQL_STRING_LITERAL@445..464 "\"filder by age\"" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: GRAPHQL_NAME@464..467 + 0: GRAPHQL_NAME@464..467 "age" [] [] + 2: (empty) + 3: COLON@467..469 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@469..473 + 0: GRAPHQL_NAME@469..473 + 0: GRAPHQL_NAME@469..473 "Int" [] [Whitespace(" ")] + 5: GRAPHQL_DIRECTIVE_LIST@473..484 + 0: GRAPHQL_DIRECTIVE@473..484 + 0: AT@473..474 "@" [] [] + 1: GRAPHQL_NAME@474..484 + 0: GRAPHQL_NAME@474..484 "deprecated" [] [] + 2: (empty) + 2: GRAPHQL_FIELD_DEFINITION@484..514 + 0: (empty) + 1: GRAPHQL_NAME@484..494 + 0: GRAPHQL_NAME@484..494 "picture" [Newline("\n"), Whitespace(" ")] [] + 2: GRAPHQL_ARGUMENTS_DEFINITION@494..509 + 0: L_PAREN@494..495 "(" [] [] + 1: GRAPHQL_ARGUMENT_DEFINITION_LIST@495..508 + 0: GRAPHQL_INPUT_VALUE_DEFINITION@495..508 + 0: (empty) + 1: GRAPHQL_NAME@495..499 + 0: GRAPHQL_NAME@495..499 "size" [] [] + 2: COLON@499..501 ":" [] [Whitespace(" ")] + 3: GRAPHQL_NAMED_TYPE@501..505 + 0: GRAPHQL_NAME@501..505 + 0: GRAPHQL_NAME@501..505 "Int" [] [Whitespace(" ")] + 4: GRAPHQL_DEFAULT_VALUE@505..508 + 0: EQ@505..507 "=" [] [Whitespace(" ")] + 1: GRAPHQL_INT_VALUE@507..508 + 0: GRAPHQL_INT_LITERAL@507..508 "0" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@508..508 + 2: R_PAREN@508..509 ")" [] [] + 3: COLON@509..511 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@511..514 + 0: GRAPHQL_NAME@511..514 + 0: GRAPHQL_NAME@511..514 "Url" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@514..514 + 3: GRAPHQL_FIELD_DEFINITION@514..578 + 0: (empty) + 1: GRAPHQL_NAME@514..523 + 0: GRAPHQL_NAME@514..523 "height" [Newline("\n"), Whitespace(" ")] [] + 2: GRAPHQL_ARGUMENTS_DEFINITION@523..573 + 0: L_PAREN@523..524 "(" [] [] + 1: GRAPHQL_ARGUMENT_DEFINITION_LIST@524..572 + 0: GRAPHQL_INPUT_VALUE_DEFINITION@524..572 + 0: GRAPHQL_DESCRIPTION@524..543 + 0: GRAPHQL_STRING_VALUE@524..543 + 0: GRAPHQL_STRING_LITERAL@524..543 "\"filter by height\"" [] [Whitespace(" ")] + 1: GRAPHQL_NAME@543..555 + 0: GRAPHQL_NAME@543..555 "greater_than" [] [] + 2: COLON@555..557 ":" [] [Whitespace(" ")] + 3: GRAPHQL_NAMED_TYPE@557..561 + 0: GRAPHQL_NAME@557..561 + 0: GRAPHQL_NAME@557..561 "Int" [] [Whitespace(" ")] + 4: (empty) + 5: GRAPHQL_DIRECTIVE_LIST@561..572 + 0: GRAPHQL_DIRECTIVE@561..572 + 0: AT@561..562 "@" [] [] + 1: GRAPHQL_NAME@562..572 + 0: GRAPHQL_NAME@562..572 "deprecated" [] [] + 2: (empty) + 2: R_PAREN@572..573 ")" [] [] + 3: COLON@573..575 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@575..578 + 0: GRAPHQL_NAME@575..578 + 0: GRAPHQL_NAME@575..578 "Int" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@578..578 + 4: GRAPHQL_FIELD_DEFINITION@578..646 + 0: (empty) + 1: GRAPHQL_NAME@578..587 + 0: GRAPHQL_NAME@578..587 "weight" [Newline("\n"), Whitespace(" ")] [] + 2: GRAPHQL_ARGUMENTS_DEFINITION@587..641 + 0: L_PAREN@587..588 "(" [] [] + 1: GRAPHQL_ARGUMENT_DEFINITION_LIST@588..640 + 0: GRAPHQL_INPUT_VALUE_DEFINITION@588..640 + 0: GRAPHQL_DESCRIPTION@588..607 + 0: GRAPHQL_STRING_VALUE@588..607 + 0: GRAPHQL_STRING_LITERAL@588..607 "\"filter by weight\"" [] [Whitespace(" ")] + 1: GRAPHQL_NAME@607..619 + 0: GRAPHQL_NAME@607..619 "greater_than" [] [] + 2: COLON@619..621 ":" [] [Whitespace(" ")] + 3: GRAPHQL_NAMED_TYPE@621..625 + 0: GRAPHQL_NAME@621..625 + 0: GRAPHQL_NAME@621..625 "Int" [] [Whitespace(" ")] + 4: GRAPHQL_DEFAULT_VALUE@625..629 + 0: EQ@625..627 "=" [] [Whitespace(" ")] + 1: GRAPHQL_INT_VALUE@627..629 + 0: GRAPHQL_INT_LITERAL@627..629 "0" [] [Whitespace(" ")] + 5: GRAPHQL_DIRECTIVE_LIST@629..640 + 0: GRAPHQL_DIRECTIVE@629..640 + 0: AT@629..630 "@" [] [] + 1: GRAPHQL_NAME@630..640 + 0: GRAPHQL_NAME@630..640 "deprecated" [] [] + 2: (empty) + 2: R_PAREN@640..641 ")" [] [] + 3: COLON@641..643 ":" [] [Whitespace(" ")] + 4: GRAPHQL_NAMED_TYPE@643..646 + 0: GRAPHQL_NAME@643..646 + 0: GRAPHQL_NAME@643..646 "Int" [] [] + 5: GRAPHQL_DIRECTIVE_LIST@646..646 + 2: R_CURLY@646..648 "}" [Newline("\n")] [] + 2: EOF@648..650 "" [Newline("\n"), Newline("\n")] [] + +```