diff --git a/crates/biome_graphql_parser/src/lexer/mod.rs b/crates/biome_graphql_parser/src/lexer/mod.rs index 665aa742e1ce..6fc6e696912f 100644 --- a/crates/biome_graphql_parser/src/lexer/mod.rs +++ b/crates/biome_graphql_parser/src/lexer/mod.rs @@ -507,10 +507,10 @@ impl<'src> GraphqlLexer<'src> { b'\\' => self.consume_escape_sequence_in_string(state), b'\n' | b'\r' => ( LexStringState::Terminated, - Some( - ParseDiagnostic::new("Missing closing quote", start..self.text_position()) - .with_detail(self.position..self.position + 1, "line breaks here"), - ), + Some(ParseDiagnostic::new( + "Missing closing quote", + start..self.text_position(), + )), ), _ => { self.advance_char_unchecked(); diff --git a/crates/biome_graphql_parser/src/parser/argument.rs b/crates/biome_graphql_parser/src/parser/argument.rs index 9c9e501222df..51a22d8d3d4e 100644 --- a/crates/biome_graphql_parser/src/parser/argument.rs +++ b/crates/biome_graphql_parser/src/parser/argument.rs @@ -9,6 +9,8 @@ use biome_parser::{ }; use super::{ + definitions::is_at_selection_set_end, + directive::is_at_directive, is_at_name, parse_error::{expected_argument, expected_value}, value::parse_value, @@ -22,7 +24,7 @@ impl ParseRecovery for ArgumentListParseRecovery { const RECOVERED_KIND: Self::Kind = GRAPHQL_ARGUMENT; fn is_at_recovered(&self, p: &mut Self::Parser<'_>) -> bool { - is_at_name(p) + is_at_name(p) || is_at_argument_list_end(p) } } @@ -40,7 +42,7 @@ impl ParseNodeList for ArgumentList { } fn is_at_list_end(&self, p: &mut Self::Parser<'_>) -> bool { - p.at(T![')']) + is_at_argument_list_end(p) } fn recover( @@ -81,3 +83,15 @@ fn parse_argument(p: &mut GraphqlParser) -> ParsedSyntax { Present(m.complete(p, GRAPHQL_ARGUMENT)) } + +/// Arguments are only allowed in the following cases: +/// - Inside a selection set +/// - In a directive +#[inline] +pub(crate) fn is_at_argument_list_end(p: &GraphqlParser<'_>) -> bool { + p.at(T![')']) + // also handle the start of a selection set + || is_at_selection_set_end(p) + // at the start of a new directive + || is_at_directive(p) +} diff --git a/crates/biome_graphql_parser/src/parser/definitions/mod.rs b/crates/biome_graphql_parser/src/parser/definitions/mod.rs index 0695ea6caa6c..71499c29df10 100644 --- a/crates/biome_graphql_parser/src/parser/definitions/mod.rs +++ b/crates/biome_graphql_parser/src/parser/definitions/mod.rs @@ -8,6 +8,7 @@ use biome_parser::{ }; use self::operation::{is_at_operation, parse_operation_definition}; +pub(crate) use operation::is_at_selection_set_end; struct DefinitionListParseRecovery; @@ -17,8 +18,7 @@ impl ParseRecovery for DefinitionListParseRecovery { const RECOVERED_KIND: Self::Kind = GRAPHQL_BOGUS_DEFINITION; fn is_at_recovered(&self, p: &mut Self::Parser<'_>) -> bool { - // TODO: recover at any definition - is_at_operation(p) + is_at_definition(p) } } @@ -56,3 +56,9 @@ fn parse_definition(p: &mut GraphqlParser) -> ParsedSyntax { _ => Absent, } } + +#[inline] +fn is_at_definition(p: &GraphqlParser<'_>) -> bool { + // TODO: recover at any definition + is_at_operation(p) +} diff --git a/crates/biome_graphql_parser/src/parser/definitions/operation.rs b/crates/biome_graphql_parser/src/parser/definitions/operation.rs index 750a0f09af73..465b958efc14 100644 --- a/crates/biome_graphql_parser/src/parser/definitions/operation.rs +++ b/crates/biome_graphql_parser/src/parser/definitions/operation.rs @@ -1,6 +1,6 @@ use crate::parser::{ argument::parse_arguments, - directive::DirectiveList, + directive::{is_at_directive, DirectiveList}, is_at_name, parse_error::{ expected_any_selection, expected_name, expected_named_type, expected_type, expected_value, @@ -21,6 +21,8 @@ use biome_parser::{ prelude::ParsedSyntax::*, token_set, Parser, TokenSet, }; +use super::is_at_definition; + const OPERATION_TYPE: TokenSet = token_set![T![query], T![mutation], T![subscription]]; @@ -38,7 +40,7 @@ impl ParseNodeList for SelectionList { } fn is_at_list_end(&self, p: &mut Self::Parser<'_>) -> bool { - p.at(T!['}']) + is_at_selection_set_end(p) } fn recover( @@ -58,7 +60,7 @@ impl ParseRecovery for SelectionListParseRecovery { const RECOVERED_KIND: Self::Kind = GRAPHQL_BOGUS_SELECTION; fn is_at_recovered(&self, p: &mut Self::Parser<'_>) -> bool { - is_at_selection(p) + is_at_selection(p) || is_at_selection_set_end(p) } } @@ -76,7 +78,7 @@ impl ParseNodeList for VariableDefinitionList { } fn is_at_list_end(&self, p: &mut Self::Parser<'_>) -> bool { - p.at(T![')']) + is_at_variable_definitions_end(p) } fn recover( @@ -97,10 +99,10 @@ struct VariableDefinitionListParseRecovery; impl ParseRecovery for VariableDefinitionListParseRecovery { type Kind = GraphqlSyntaxKind; type Parser<'source> = GraphqlParser<'source>; - const RECOVERED_KIND: Self::Kind = GRAPHQL_VARIABLE_DEFINITION; + const RECOVERED_KIND: Self::Kind = GRAPHQL_BOGUS; fn is_at_recovered(&self, p: &mut Self::Parser<'_>) -> bool { - is_at_variable(p) + is_at_variable(p) || is_at_variable_definitions_end(p) } } @@ -262,15 +264,26 @@ fn parse_default_value(p: &mut GraphqlParser) -> ParsedSyntax { } #[inline] -pub(crate) fn is_at_operation(p: &mut GraphqlParser<'_>) -> bool { +pub(crate) fn is_at_operation(p: &GraphqlParser<'_>) -> bool { p.at_ts(OPERATION_TYPE) || is_at_selection_set(p) } +#[inline] +fn is_at_variable_definitions_end(p: &GraphqlParser) -> bool { + p.at(T![')']) || is_at_directive(p) || is_at_selection_set(p) +} + #[inline] fn is_at_selection_set(p: &GraphqlParser) -> bool { p.at(T!['{']) } +#[inline] +pub(crate) fn is_at_selection_set_end(p: &GraphqlParser) -> bool { + // stop at closing brace or at the start of a new definition + p.at(T!['}']) || is_at_definition(p) +} + #[inline] fn is_at_selection(p: &GraphqlParser) -> bool { is_at_field(p) || is_at_fragment(p) diff --git a/crates/biome_graphql_parser/src/parser/directive.rs b/crates/biome_graphql_parser/src/parser/directive.rs index adea298bcbc3..289df07c4b9b 100644 --- a/crates/biome_graphql_parser/src/parser/directive.rs +++ b/crates/biome_graphql_parser/src/parser/directive.rs @@ -64,6 +64,6 @@ pub(crate) fn parse_directive(p: &mut GraphqlParser) -> ParsedSyntax { } #[inline] -fn is_at_directive(p: &mut GraphqlParser<'_>) -> bool { +pub(crate) fn is_at_directive(p: &GraphqlParser<'_>) -> bool { p.at(T![@]) } diff --git a/crates/biome_graphql_parser/src/parser/value.rs b/crates/biome_graphql_parser/src/parser/value.rs index 7d1a18e66c91..846d75744b3c 100644 --- a/crates/biome_graphql_parser/src/parser/value.rs +++ b/crates/biome_graphql_parser/src/parser/value.rs @@ -11,6 +11,7 @@ use biome_parser::{ }; use super::{ + argument::is_at_argument_list_end, is_at_name, parse_error::{expected_object_field, expected_value}, variable::{is_at_variable, parse_variable}, @@ -26,7 +27,7 @@ impl ParseRecovery for ListValueElementListParseRecovery { const RECOVERED_KIND: Self::Kind = GRAPHQL_BOGUS_VALUE; fn is_at_recovered(&self, p: &mut Self::Parser<'_>) -> bool { - is_at_value(p) + is_at_value(p) || is_at_list_end(p) } } @@ -44,7 +45,7 @@ impl ParseNodeList for ListValueElementList { } fn is_at_list_end(&self, p: &mut Self::Parser<'_>) -> bool { - p.at(T![']']) + is_at_list_end(p) } fn recover( @@ -64,7 +65,7 @@ impl ParseRecovery for ObjectValueMemberListParseRecovery { const RECOVERED_KIND: Self::Kind = GRAPHQL_OBJECT_FIELD; fn is_at_recovered(&self, p: &mut Self::Parser<'_>) -> bool { - is_at_name(p) + is_at_name(p) || is_at_object_end(p) } } @@ -82,7 +83,7 @@ impl ParseNodeList for ObjectValueMemberList { } fn is_at_list_end(&self, p: &mut Self::Parser<'_>) -> bool { - p.at(T!['}']) + is_at_object_end(p) } fn recover( @@ -267,6 +268,15 @@ fn is_at_list(p: &GraphqlParser) -> bool { p.at(T!['[']) } +#[inline] +fn is_at_list_end(p: &mut GraphqlParser) -> bool { + p.at(T![']']) + // at next argument + || p.lookahead() == T![:] + // value is only used in argument + || is_at_argument_list_end(p) +} + #[inline] fn is_at_object(p: &GraphqlParser) -> bool { p.at(T!['{']) @@ -276,3 +286,10 @@ fn is_at_object(p: &GraphqlParser) -> bool { fn is_at_object_field(p: &GraphqlParser) -> bool { is_at_name(p) } + +#[inline] +fn is_at_object_end(p: &GraphqlParser) -> bool { + p.at(T!['}']) + // value is only used in argument + || is_at_argument_list_end(p) +} diff --git a/crates/biome_graphql_parser/tests/graphql_test_suite/err/directive.graphql b/crates/biome_graphql_parser/tests/graphql_test_suite/err/directive.graphql new file mode 100644 index 000000000000..0283181a6943 --- /dev/null +++ b/crates/biome_graphql_parser/tests/graphql_test_suite/err/directive.graphql @@ -0,0 +1,35 @@ +{ + hero @ +} + +{ + hero @ @ +} + +{ + hero @deprecated(: "Deprecated") +} + +{ + hero @deprecated(reason:) +} + +{ + hero @deprecated(reason: "Deprecated" +} + +{ + hero @(reason: "Deprecated" +} + +{ + hero @(: "Deprecated" +} + +{ + hero @(: +} + +{ + hero @(:) +} diff --git a/crates/biome_graphql_parser/tests/graphql_test_suite/err/directive.graphql.snap b/crates/biome_graphql_parser/tests/graphql_test_suite/err/directive.graphql.snap new file mode 100644 index 000000000000..f4658afde68f --- /dev/null +++ b/crates/biome_graphql_parser/tests/graphql_test_suite/err/directive.graphql.snap @@ -0,0 +1,821 @@ +--- +source: crates/biome_graphql_parser/tests/spec_test.rs +expression: snapshot +--- +## Input +```graphql +{ + hero @ +} + +{ + hero @ @ +} + +{ + hero @deprecated(: "Deprecated") +} + +{ + hero @deprecated(reason:) +} + +{ + hero @deprecated(reason: "Deprecated" +} + +{ + hero @(reason: "Deprecated" +} + +{ + hero @(: "Deprecated" +} + +{ + hero @(: +} + +{ + hero @(:) +} + +``` + +## AST + +``` +GraphqlRoot { + bom_token: missing (optional), + definitions: GraphqlDefinitionList [ + GraphqlSelectionSet { + l_curly_token: L_CURLY@0..1 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@1..9 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@9..10 "@" [] [], + name: missing (required), + arguments: missing (optional), + }, + ], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@10..12 "}" [Newline("\n")] [], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@12..15 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@15..23 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@23..25 "@" [] [Whitespace(" ")], + name: missing (required), + arguments: missing (optional), + }, + GraphqlDirective { + at_token: AT@25..26 "@" [] [], + name: missing (required), + arguments: missing (optional), + }, + ], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@26..28 "}" [Newline("\n")] [], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@28..31 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlBogusSelection { + items: [ + GraphqlName { + value_token: GRAPHQL_NAME@31..39 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + GraphqlBogus { + items: [ + GraphqlBogus { + items: [ + AT@39..40 "@" [] [], + GraphqlName { + value_token: GRAPHQL_NAME@40..50 "deprecated" [] [], + }, + GraphqlBogus { + items: [ + L_PAREN@50..51 "(" [] [], + GraphqlBogus { + items: [ + GraphqlBogus { + items: [ + COLON@51..53 ":" [] [Whitespace(" ")], + GRAPHQL_STRING_LITERAL@53..65 "\"Deprecated\"" [] [], + ], + }, + ], + }, + R_PAREN@65..66 ")" [] [], + ], + }, + ], + }, + ], + }, + ], + }, + ], + r_curly_token: R_CURLY@66..68 "}" [Newline("\n")] [], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@68..71 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@71..79 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@79..80 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@80..90 "deprecated" [] [], + }, + arguments: GraphqlArguments { + l_paren_token: L_PAREN@90..91 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@91..97 "reason" [] [], + }, + colon_token: COLON@97..98 ":" [] [], + value: missing (required), + }, + ], + r_paren_token: R_PAREN@98..99 ")" [] [], + }, + }, + ], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@99..101 "}" [Newline("\n")] [], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@101..104 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@104..112 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@112..113 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@113..123 "deprecated" [] [], + }, + arguments: GraphqlArguments { + l_paren_token: L_PAREN@123..124 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@124..130 "reason" [] [], + }, + colon_token: COLON@130..132 ":" [] [Whitespace(" ")], + value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@132..144 "\"Deprecated\"" [] [], + }, + }, + ], + r_paren_token: missing (required), + }, + }, + ], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@144..146 "}" [Newline("\n")] [], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@146..149 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@149..157 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@157..158 "@" [] [], + name: missing (required), + arguments: GraphqlArguments { + l_paren_token: L_PAREN@158..159 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@159..165 "reason" [] [], + }, + colon_token: COLON@165..167 ":" [] [Whitespace(" ")], + value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@167..179 "\"Deprecated\"" [] [], + }, + }, + ], + r_paren_token: missing (required), + }, + }, + ], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@179..181 "}" [Newline("\n")] [], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@181..184 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlBogusSelection { + items: [ + GraphqlName { + value_token: GRAPHQL_NAME@184..192 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + GraphqlBogus { + items: [ + GraphqlBogus { + items: [ + AT@192..193 "@" [] [], + GraphqlBogus { + items: [ + L_PAREN@193..194 "(" [] [], + GraphqlBogus { + items: [ + GraphqlBogus { + items: [ + COLON@194..196 ":" [] [Whitespace(" ")], + GRAPHQL_STRING_LITERAL@196..208 "\"Deprecated\"" [] [], + ], + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], + r_curly_token: R_CURLY@208..210 "}" [Newline("\n")] [], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@210..213 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@213..221 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@221..222 "@" [] [], + name: missing (required), + arguments: GraphqlArguments { + l_paren_token: L_PAREN@222..223 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: missing (required), + colon_token: COLON@223..224 ":" [] [], + value: missing (required), + }, + ], + r_paren_token: missing (required), + }, + }, + ], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@224..226 "}" [Newline("\n")] [], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@226..229 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@229..237 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@237..238 "@" [] [], + name: missing (required), + arguments: GraphqlArguments { + l_paren_token: L_PAREN@238..239 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: missing (required), + colon_token: COLON@239..240 ":" [] [], + value: missing (required), + }, + ], + r_paren_token: R_PAREN@240..241 ")" [] [], + }, + }, + ], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@241..243 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@243..244 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: GRAPHQL_ROOT@0..244 + 0: (empty) + 1: GRAPHQL_DEFINITION_LIST@0..243 + 0: GRAPHQL_SELECTION_SET@0..12 + 0: L_CURLY@0..1 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@1..10 + 0: GRAPHQL_FIELD@1..10 + 0: (empty) + 1: GRAPHQL_NAME@1..9 + 0: GRAPHQL_NAME@1..9 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@9..10 + 0: GRAPHQL_DIRECTIVE@9..10 + 0: AT@9..10 "@" [] [] + 1: (empty) + 2: (empty) + 4: (empty) + 2: R_CURLY@10..12 "}" [Newline("\n")] [] + 1: GRAPHQL_SELECTION_SET@12..28 + 0: L_CURLY@12..15 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@15..26 + 0: GRAPHQL_FIELD@15..26 + 0: (empty) + 1: GRAPHQL_NAME@15..23 + 0: GRAPHQL_NAME@15..23 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@23..26 + 0: GRAPHQL_DIRECTIVE@23..25 + 0: AT@23..25 "@" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 1: GRAPHQL_DIRECTIVE@25..26 + 0: AT@25..26 "@" [] [] + 1: (empty) + 2: (empty) + 4: (empty) + 2: R_CURLY@26..28 "}" [Newline("\n")] [] + 2: GRAPHQL_SELECTION_SET@28..68 + 0: L_CURLY@28..31 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@31..66 + 0: GRAPHQL_BOGUS_SELECTION@31..66 + 0: GRAPHQL_NAME@31..39 + 0: GRAPHQL_NAME@31..39 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: GRAPHQL_BOGUS@39..66 + 0: GRAPHQL_BOGUS@39..66 + 0: AT@39..40 "@" [] [] + 1: GRAPHQL_NAME@40..50 + 0: GRAPHQL_NAME@40..50 "deprecated" [] [] + 2: GRAPHQL_BOGUS@50..66 + 0: L_PAREN@50..51 "(" [] [] + 1: GRAPHQL_BOGUS@51..65 + 0: GRAPHQL_BOGUS@51..65 + 0: COLON@51..53 ":" [] [Whitespace(" ")] + 1: GRAPHQL_STRING_LITERAL@53..65 "\"Deprecated\"" [] [] + 2: R_PAREN@65..66 ")" [] [] + 2: R_CURLY@66..68 "}" [Newline("\n")] [] + 3: GRAPHQL_SELECTION_SET@68..101 + 0: L_CURLY@68..71 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@71..99 + 0: GRAPHQL_FIELD@71..99 + 0: (empty) + 1: GRAPHQL_NAME@71..79 + 0: GRAPHQL_NAME@71..79 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@79..99 + 0: GRAPHQL_DIRECTIVE@79..99 + 0: AT@79..80 "@" [] [] + 1: GRAPHQL_NAME@80..90 + 0: GRAPHQL_NAME@80..90 "deprecated" [] [] + 2: GRAPHQL_ARGUMENTS@90..99 + 0: L_PAREN@90..91 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@91..98 + 0: GRAPHQL_ARGUMENT@91..98 + 0: GRAPHQL_NAME@91..97 + 0: GRAPHQL_NAME@91..97 "reason" [] [] + 1: COLON@97..98 ":" [] [] + 2: (empty) + 2: R_PAREN@98..99 ")" [] [] + 4: (empty) + 2: R_CURLY@99..101 "}" [Newline("\n")] [] + 4: GRAPHQL_SELECTION_SET@101..146 + 0: L_CURLY@101..104 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@104..144 + 0: GRAPHQL_FIELD@104..144 + 0: (empty) + 1: GRAPHQL_NAME@104..112 + 0: GRAPHQL_NAME@104..112 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@112..144 + 0: GRAPHQL_DIRECTIVE@112..144 + 0: AT@112..113 "@" [] [] + 1: GRAPHQL_NAME@113..123 + 0: GRAPHQL_NAME@113..123 "deprecated" [] [] + 2: GRAPHQL_ARGUMENTS@123..144 + 0: L_PAREN@123..124 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@124..144 + 0: GRAPHQL_ARGUMENT@124..144 + 0: GRAPHQL_NAME@124..130 + 0: GRAPHQL_NAME@124..130 "reason" [] [] + 1: COLON@130..132 ":" [] [Whitespace(" ")] + 2: GRAPHQL_STRING_VALUE@132..144 + 0: GRAPHQL_STRING_LITERAL@132..144 "\"Deprecated\"" [] [] + 2: (empty) + 4: (empty) + 2: R_CURLY@144..146 "}" [Newline("\n")] [] + 5: GRAPHQL_SELECTION_SET@146..181 + 0: L_CURLY@146..149 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@149..179 + 0: GRAPHQL_FIELD@149..179 + 0: (empty) + 1: GRAPHQL_NAME@149..157 + 0: GRAPHQL_NAME@149..157 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@157..179 + 0: GRAPHQL_DIRECTIVE@157..179 + 0: AT@157..158 "@" [] [] + 1: (empty) + 2: GRAPHQL_ARGUMENTS@158..179 + 0: L_PAREN@158..159 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@159..179 + 0: GRAPHQL_ARGUMENT@159..179 + 0: GRAPHQL_NAME@159..165 + 0: GRAPHQL_NAME@159..165 "reason" [] [] + 1: COLON@165..167 ":" [] [Whitespace(" ")] + 2: GRAPHQL_STRING_VALUE@167..179 + 0: GRAPHQL_STRING_LITERAL@167..179 "\"Deprecated\"" [] [] + 2: (empty) + 4: (empty) + 2: R_CURLY@179..181 "}" [Newline("\n")] [] + 6: GRAPHQL_SELECTION_SET@181..210 + 0: L_CURLY@181..184 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@184..208 + 0: GRAPHQL_BOGUS_SELECTION@184..208 + 0: GRAPHQL_NAME@184..192 + 0: GRAPHQL_NAME@184..192 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: GRAPHQL_BOGUS@192..208 + 0: GRAPHQL_BOGUS@192..208 + 0: AT@192..193 "@" [] [] + 1: GRAPHQL_BOGUS@193..208 + 0: L_PAREN@193..194 "(" [] [] + 1: GRAPHQL_BOGUS@194..208 + 0: GRAPHQL_BOGUS@194..208 + 0: COLON@194..196 ":" [] [Whitespace(" ")] + 1: GRAPHQL_STRING_LITERAL@196..208 "\"Deprecated\"" [] [] + 2: R_CURLY@208..210 "}" [Newline("\n")] [] + 7: GRAPHQL_SELECTION_SET@210..226 + 0: L_CURLY@210..213 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@213..224 + 0: GRAPHQL_FIELD@213..224 + 0: (empty) + 1: GRAPHQL_NAME@213..221 + 0: GRAPHQL_NAME@213..221 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@221..224 + 0: GRAPHQL_DIRECTIVE@221..224 + 0: AT@221..222 "@" [] [] + 1: (empty) + 2: GRAPHQL_ARGUMENTS@222..224 + 0: L_PAREN@222..223 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@223..224 + 0: GRAPHQL_ARGUMENT@223..224 + 0: (empty) + 1: COLON@223..224 ":" [] [] + 2: (empty) + 2: (empty) + 4: (empty) + 2: R_CURLY@224..226 "}" [Newline("\n")] [] + 8: GRAPHQL_SELECTION_SET@226..243 + 0: L_CURLY@226..229 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@229..241 + 0: GRAPHQL_FIELD@229..241 + 0: (empty) + 1: GRAPHQL_NAME@229..237 + 0: GRAPHQL_NAME@229..237 "hero" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@237..241 + 0: GRAPHQL_DIRECTIVE@237..241 + 0: AT@237..238 "@" [] [] + 1: (empty) + 2: GRAPHQL_ARGUMENTS@238..241 + 0: L_PAREN@238..239 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@239..240 + 0: GRAPHQL_ARGUMENT@239..240 + 0: (empty) + 1: COLON@239..240 ":" [] [] + 2: (empty) + 2: R_PAREN@240..241 ")" [] [] + 4: (empty) + 2: R_CURLY@241..243 "}" [Newline("\n")] [] + 2: EOF@243..244 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +directive.graphql:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '}'. + + 1 │ { + 2 │ hero @ + > 3 │ } + │ ^ + 4 │ + 5 │ { + + i Expected a name here. + + 1 │ { + 2 │ hero @ + > 3 │ } + │ ^ + 4 │ + 5 │ { + +directive.graphql:6:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '@'. + + 5 │ { + > 6 │ hero @ @ + │ ^ + 7 │ } + 8 │ + + i Expected a name here. + + 5 │ { + > 6 │ hero @ @ + │ ^ + 7 │ } + 8 │ + +directive.graphql:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '}'. + + 5 │ { + 6 │ hero @ @ + > 7 │ } + │ ^ + 8 │ + 9 │ { + + i Expected a name here. + + 5 │ { + 6 │ hero @ @ + > 7 │ } + │ ^ + 8 │ + 9 │ { + +directive.graphql:10:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an argument but instead found ': "Deprecated"'. + + 9 │ { + > 10 │ hero @deprecated(: "Deprecated") + │ ^^^^^^^^^^^^^^ + 11 │ } + 12 │ + + i Expected an argument here. + + 9 │ { + > 10 │ hero @deprecated(: "Deprecated") + │ ^^^^^^^^^^^^^^ + 11 │ } + 12 │ + +directive.graphql:14:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a value but instead found ')'. + + 13 │ { + > 14 │ hero @deprecated(reason:) + │ ^ + 15 │ } + 16 │ + + i Expected a value here. + + 13 │ { + > 14 │ hero @deprecated(reason:) + │ ^ + 15 │ } + 16 │ + +directive.graphql:19:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `}` + + 17 │ { + 18 │ hero @deprecated(reason: "Deprecated" + > 19 │ } + │ ^ + 20 │ + 21 │ { + + i Remove } + +directive.graphql:22:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '('. + + 21 │ { + > 22 │ hero @(reason: "Deprecated" + │ ^ + 23 │ } + 24 │ + + i Expected a name here. + + 21 │ { + > 22 │ hero @(reason: "Deprecated" + │ ^ + 23 │ } + 24 │ + +directive.graphql:23:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `}` + + 21 │ { + 22 │ hero @(reason: "Deprecated" + > 23 │ } + │ ^ + 24 │ + 25 │ { + + i Remove } + +directive.graphql:26:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '('. + + 25 │ { + > 26 │ hero @(: "Deprecated" + │ ^ + 27 │ } + 28 │ + + i Expected a name here. + + 25 │ { + > 26 │ hero @(: "Deprecated" + │ ^ + 27 │ } + 28 │ + +directive.graphql:26:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an argument but instead found ': "Deprecated"'. + + 25 │ { + > 26 │ hero @(: "Deprecated" + │ ^^^^^^^^^^^^^^ + 27 │ } + 28 │ + + i Expected an argument here. + + 25 │ { + > 26 │ hero @(: "Deprecated" + │ ^^^^^^^^^^^^^^ + 27 │ } + 28 │ + +directive.graphql:27:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `}` + + 25 │ { + 26 │ hero @(: "Deprecated" + > 27 │ } + │ ^ + 28 │ + 29 │ { + + i Remove } + +directive.graphql:30:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '('. + + 29 │ { + > 30 │ hero @(: + │ ^ + 31 │ } + 32 │ + + i Expected a name here. + + 29 │ { + > 30 │ hero @(: + │ ^ + 31 │ } + 32 │ + +directive.graphql:30:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an argument but instead found ':'. + + 29 │ { + > 30 │ hero @(: + │ ^ + 31 │ } + 32 │ + + i Expected an argument here. + + 29 │ { + > 30 │ hero @(: + │ ^ + 31 │ } + 32 │ + +directive.graphql:31:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `}` + + 29 │ { + 30 │ hero @(: + > 31 │ } + │ ^ + 32 │ + 33 │ { + + i Remove } + +directive.graphql:34:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '('. + + 33 │ { + > 34 │ hero @(:) + │ ^ + 35 │ } + 36 │ + + i Expected a name here. + + 33 │ { + > 34 │ hero @(:) + │ ^ + 35 │ } + 36 │ + +directive.graphql:34:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an argument but instead found ':'. + + 33 │ { + > 34 │ hero @(:) + │ ^ + 35 │ } + 36 │ + + i Expected an argument here. + + 33 │ { + > 34 │ hero @(:) + │ ^ + 35 │ } + 36 │ + +``` diff --git a/crates/biome_graphql_parser/tests/graphql_test_suite/err/operation.graphql b/crates/biome_graphql_parser/tests/graphql_test_suite/err/operation.graphql index 41ea4701b180..cdf828e74420 100644 --- a/crates/biome_graphql_parser/tests/graphql_test_suite/err/operation.graphql +++ b/crates/biome_graphql_parser/tests/graphql_test_suite/err/operation.graphql @@ -1,3 +1,68 @@ +query likeStory } + query likeStory +query like$Story + +# malformed variables +query ($storyId: ID! { + likeStory(storyId: $storyId) +} + +query $storyId: ID! { + likeStory(storyId: $storyId) +} + +query $storyId: ID!) { + likeStory(storyId: $storyId) +} + +query ($: ) { + likeStory(storyId: $) +} + +query (a: ) { + likeStory +} + +query (a: { + likeStory +} + +query (: ) { + likeStory +} + +query (: { + likeStory +} + +query ( { + likeStory +} + +query ($storyId: = @ { + likeStory +} + +# malformed arguments +query ($storyId: ID!) { + likeStory storyId: $storyId) +} + +query ($storyId: ID!) { + likeStory(storyId: $storyId +} + +query ($storyId: ID!) { + likeStory storyId: $storyId +} + +query ($storyId: ID!) { + likeStory storyId: $ +} +# malformed directives +query ($storyId: ID!) @ { + likeStory +} diff --git a/crates/biome_graphql_parser/tests/graphql_test_suite/err/operation.graphql.snap b/crates/biome_graphql_parser/tests/graphql_test_suite/err/operation.graphql.snap index 5d89a7068d9d..f6c81c6f56e6 100644 --- a/crates/biome_graphql_parser/tests/graphql_test_suite/err/operation.graphql.snap +++ b/crates/biome_graphql_parser/tests/graphql_test_suite/err/operation.graphql.snap @@ -4,9 +4,74 @@ expression: snapshot --- ## Input ```graphql +query likeStory } + query likeStory +query like$Story + +# malformed variables +query ($storyId: ID! { + likeStory(storyId: $storyId) +} + +query $storyId: ID! { + likeStory(storyId: $storyId) +} + +query $storyId: ID!) { + likeStory(storyId: $storyId) +} + +query ($: ) { + likeStory(storyId: $) +} + +query (a: ) { + likeStory +} + +query (a: { + likeStory +} + +query (: ) { + likeStory +} + +query (: { + likeStory +} + +query ( { + likeStory +} + +query ($storyId: = @ { + likeStory +} + +# malformed arguments +query ($storyId: ID!) { + likeStory storyId: $storyId) +} + +query ($storyId: ID!) { + likeStory(storyId: $storyId +} +query ($storyId: ID!) { + likeStory storyId: $storyId +} + +query ($storyId: ID!) { + likeStory storyId: $ +} + +# malformed directives +query ($storyId: ID!) @ { + likeStory +} ``` @@ -21,7 +86,22 @@ GraphqlRoot { value_token: QUERY_KW@0..6 "query" [] [Whitespace(" ")], }, name: GraphqlName { - value_token: GRAPHQL_NAME@6..15 "likeStory" [] [], + value_token: GRAPHQL_NAME@6..16 "likeStory" [] [Whitespace(" ")], + }, + variables: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: missing (required), + selections: GraphqlSelectionList [], + r_curly_token: R_CURLY@16..17 "}" [] [], + }, + }, + GraphqlOperationDefinition { + ty: GraphqlOperationType { + value_token: QUERY_KW@17..25 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + name: GraphqlName { + value_token: GRAPHQL_NAME@25..34 "likeStory" [] [], }, variables: missing (optional), directives: GraphqlDirectiveList [], @@ -31,45 +111,1952 @@ GraphqlRoot { r_curly_token: missing (required), }, }, + GraphqlOperationDefinition { + ty: GraphqlOperationType { + value_token: QUERY_KW@34..42 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + name: GraphqlName { + value_token: GRAPHQL_NAME@42..46 "like" [] [], + }, + variables: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: missing (required), + selections: GraphqlSelectionList [ + GraphqlBogusSelection { + items: [ + DOLLAR@46..47 "$" [] [], + ], + }, + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@47..52 "Story" [] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: missing (required), + }, + }, + GraphqlOperationDefinition { + ty: GraphqlOperationType { + value_token: QUERY_KW@52..82 "query" [Newline("\n"), Newline("\n"), Comments("# malformed variables"), Newline("\n")] [Whitespace(" ")], + }, + name: missing (optional), + variables: GraphqlVariableDefinitions { + l_paren_token: L_PAREN@82..83 "(" [] [], + elements: GraphqlVariableDefinitionList [ + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@83..84 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@84..91 "storyId" [] [], + }, + }, + colon_token: COLON@91..93 ":" [] [Whitespace(" ")], + ty: GraphqlNonNullType { + base: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@93..95 "ID" [] [], + }, + }, + excl_token: BANG@95..97 "!" [] [Whitespace(" ")], + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + ], + r_paren_token: missing (required), + }, + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@97..98 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@98..109 "likeStory" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: GraphqlArguments { + l_paren_token: L_PAREN@109..110 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@110..117 "storyId" [] [], + }, + colon_token: COLON@117..119 ":" [] [Whitespace(" ")], + value: GraphqlVariable { + dollar_token: DOLLAR@119..120 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@120..127 "storyId" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@127..128 ")" [] [], + }, + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@128..130 "}" [Newline("\n")] [], + }, + }, + GraphqlOperationDefinition { + ty: GraphqlOperationType { + value_token: QUERY_KW@130..138 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + name: missing (optional), + variables: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: missing (required), + selections: GraphqlSelectionList [ + GraphqlBogusSelection { + items: [ + DOLLAR@138..139 "$" [] [], + ], + }, + GraphqlField { + alias: GraphqlAlias { + value: GraphqlName { + value_token: GRAPHQL_NAME@139..146 "storyId" [] [], + }, + colon_token: COLON@146..148 ":" [] [Whitespace(" ")], + }, + name: GraphqlName { + value_token: GRAPHQL_NAME@148..150 "ID" [] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlBogusSelection { + items: [ + BANG@150..152 "!" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: missing (required), + }, + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@152..153 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@153..164 "likeStory" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: GraphqlArguments { + l_paren_token: L_PAREN@164..165 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@165..172 "storyId" [] [], + }, + colon_token: COLON@172..174 ":" [] [Whitespace(" ")], + value: GraphqlVariable { + dollar_token: DOLLAR@174..175 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@175..182 "storyId" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@182..183 ")" [] [], + }, + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@183..185 "}" [Newline("\n")] [], + }, + GraphqlOperationDefinition { + ty: GraphqlOperationType { + value_token: QUERY_KW@185..193 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + name: missing (optional), + variables: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: missing (required), + selections: GraphqlSelectionList [ + GraphqlBogusSelection { + items: [ + DOLLAR@193..194 "$" [] [], + ], + }, + GraphqlField { + alias: GraphqlAlias { + value: GraphqlName { + value_token: GRAPHQL_NAME@194..201 "storyId" [] [], + }, + colon_token: COLON@201..203 ":" [] [Whitespace(" ")], + }, + name: GraphqlName { + value_token: GRAPHQL_NAME@203..205 "ID" [] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlBogusSelection { + items: [ + BANG@205..206 "!" [] [], + R_PAREN@206..208 ")" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: missing (required), + }, + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@208..209 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@209..220 "likeStory" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: GraphqlArguments { + l_paren_token: L_PAREN@220..221 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@221..228 "storyId" [] [], + }, + colon_token: COLON@228..230 ":" [] [Whitespace(" ")], + value: GraphqlVariable { + dollar_token: DOLLAR@230..231 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@231..238 "storyId" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@238..239 ")" [] [], + }, + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@239..241 "}" [Newline("\n")] [], + }, + GraphqlOperationDefinition { + ty: GraphqlOperationType { + value_token: QUERY_KW@241..249 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + name: missing (optional), + variables: GraphqlVariableDefinitions { + l_paren_token: L_PAREN@249..250 "(" [] [], + elements: GraphqlVariableDefinitionList [ + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@250..251 "$" [] [], + name: missing (required), + }, + colon_token: COLON@251..253 ":" [] [Whitespace(" ")], + ty: missing (required), + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + ], + r_paren_token: R_PAREN@253..255 ")" [] [Whitespace(" ")], + }, + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@255..256 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@256..267 "likeStory" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: GraphqlArguments { + l_paren_token: L_PAREN@267..268 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@268..275 "storyId" [] [], + }, + colon_token: COLON@275..277 ":" [] [Whitespace(" ")], + value: GraphqlVariable { + dollar_token: DOLLAR@277..278 "$" [] [], + name: missing (required), + }, + }, + ], + r_paren_token: R_PAREN@278..279 ")" [] [], + }, + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@279..281 "}" [Newline("\n")] [], + }, + }, + GraphqlBogusDefinition { + items: [ + GraphqlOperationType { + value_token: QUERY_KW@281..289 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + GraphqlBogus { + items: [ + L_PAREN@289..290 "(" [] [], + GraphqlBogus { + items: [ + GraphqlBogus { + items: [ + GRAPHQL_NAME@290..291 "a" [] [], + COLON@291..293 ":" [] [Whitespace(" ")], + ], + }, + ], + }, + R_PAREN@293..295 ")" [] [Whitespace(" ")], + ], + }, + GraphqlDirectiveList [], + GraphqlSelectionSet { + l_curly_token: L_CURLY@295..296 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@296..307 "likeStory" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@307..309 "}" [Newline("\n")] [], + }, + ], + }, + GraphqlBogusDefinition { + items: [ + GraphqlOperationType { + value_token: QUERY_KW@309..317 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + GraphqlBogus { + items: [ + L_PAREN@317..318 "(" [] [], + GraphqlBogus { + items: [ + GraphqlBogus { + items: [ + GRAPHQL_NAME@318..319 "a" [] [], + COLON@319..322 ":" [] [Whitespace(" ")], + ], + }, + ], + }, + ], + }, + GraphqlDirectiveList [], + GraphqlSelectionSet { + l_curly_token: L_CURLY@322..323 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@323..334 "likeStory" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@334..336 "}" [Newline("\n")] [], + }, + ], + }, + GraphqlBogusDefinition { + items: [ + GraphqlOperationType { + value_token: QUERY_KW@336..344 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + GraphqlBogus { + items: [ + L_PAREN@344..345 "(" [] [], + GraphqlBogus { + items: [ + GraphqlBogus { + items: [ + COLON@345..347 ":" [] [Whitespace(" ")], + ], + }, + ], + }, + R_PAREN@347..349 ")" [] [Whitespace(" ")], + ], + }, + GraphqlDirectiveList [], + GraphqlSelectionSet { + l_curly_token: L_CURLY@349..350 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@350..361 "likeStory" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@361..363 "}" [Newline("\n")] [], + }, + ], + }, + GraphqlBogusDefinition { + items: [ + GraphqlOperationType { + value_token: QUERY_KW@363..371 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + GraphqlBogus { + items: [ + L_PAREN@371..372 "(" [] [], + GraphqlBogus { + items: [ + GraphqlBogus { + items: [ + COLON@372..375 ":" [] [Whitespace(" ")], + ], + }, + ], + }, + ], + }, + GraphqlDirectiveList [], + GraphqlSelectionSet { + l_curly_token: L_CURLY@375..376 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@376..387 "likeStory" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@387..389 "}" [Newline("\n")] [], + }, + ], + }, + GraphqlOperationDefinition { + ty: GraphqlOperationType { + value_token: QUERY_KW@389..397 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + name: missing (optional), + variables: GraphqlVariableDefinitions { + l_paren_token: L_PAREN@397..400 "(" [] [Whitespace(" ")], + elements: GraphqlVariableDefinitionList [], + r_paren_token: missing (required), + }, + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@400..401 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@401..412 "likeStory" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@412..414 "}" [Newline("\n")] [], + }, + }, + GraphqlOperationDefinition { + ty: GraphqlOperationType { + value_token: QUERY_KW@414..422 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + name: missing (optional), + variables: GraphqlVariableDefinitions { + l_paren_token: L_PAREN@422..423 "(" [] [], + elements: GraphqlVariableDefinitionList [ + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@423..424 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@424..431 "storyId" [] [], + }, + }, + colon_token: COLON@431..433 ":" [] [Whitespace(" ")], + ty: missing (required), + default: GraphqlDefaultValue { + eq_token: EQ@433..435 "=" [] [Whitespace(" ")], + value: missing (required), + }, + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@435..437 "@" [] [Whitespace(" ")], + name: missing (required), + arguments: missing (optional), + }, + ], + }, + ], + r_paren_token: missing (required), + }, + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@437..438 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@438..449 "likeStory" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@449..451 "}" [Newline("\n")] [], + }, + }, + GraphqlOperationDefinition { + ty: GraphqlOperationType { + value_token: QUERY_KW@451..481 "query" [Newline("\n"), Newline("\n"), Comments("# malformed arguments"), Newline("\n")] [Whitespace(" ")], + }, + name: missing (optional), + variables: GraphqlVariableDefinitions { + l_paren_token: L_PAREN@481..482 "(" [] [], + elements: GraphqlVariableDefinitionList [ + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@482..483 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@483..490 "storyId" [] [], + }, + }, + colon_token: COLON@490..492 ":" [] [Whitespace(" ")], + ty: GraphqlNonNullType { + base: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@492..494 "ID" [] [], + }, + }, + excl_token: BANG@494..495 "!" [] [], + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + ], + r_paren_token: R_PAREN@495..497 ")" [] [Whitespace(" ")], + }, + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@497..498 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@498..510 "likeStory" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlField { + alias: GraphqlAlias { + value: GraphqlName { + value_token: GRAPHQL_NAME@510..517 "storyId" [] [], + }, + colon_token: COLON@517..519 ":" [] [Whitespace(" ")], + }, + name: missing (required), + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlBogusSelection { + items: [ + DOLLAR@519..520 "$" [] [], + ], + }, + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@520..527 "storyId" [] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlBogusSelection { + items: [ + R_PAREN@527..528 ")" [] [], + ], + }, + ], + r_curly_token: R_CURLY@528..530 "}" [Newline("\n")] [], + }, + }, + GraphqlOperationDefinition { + ty: GraphqlOperationType { + value_token: QUERY_KW@530..538 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + name: missing (optional), + variables: GraphqlVariableDefinitions { + l_paren_token: L_PAREN@538..539 "(" [] [], + elements: GraphqlVariableDefinitionList [ + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@539..540 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@540..547 "storyId" [] [], + }, + }, + colon_token: COLON@547..549 ":" [] [Whitespace(" ")], + ty: GraphqlNonNullType { + base: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@549..551 "ID" [] [], + }, + }, + excl_token: BANG@551..552 "!" [] [], + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + ], + r_paren_token: R_PAREN@552..554 ")" [] [Whitespace(" ")], + }, + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@554..555 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@555..566 "likeStory" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: GraphqlArguments { + l_paren_token: L_PAREN@566..567 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@567..574 "storyId" [] [], + }, + colon_token: COLON@574..576 ":" [] [Whitespace(" ")], + value: GraphqlVariable { + dollar_token: DOLLAR@576..577 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@577..584 "storyId" [] [], + }, + }, + }, + ], + r_paren_token: missing (required), + }, + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@584..586 "}" [Newline("\n")] [], + }, + }, + GraphqlOperationDefinition { + ty: GraphqlOperationType { + value_token: QUERY_KW@586..594 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + name: missing (optional), + variables: GraphqlVariableDefinitions { + l_paren_token: L_PAREN@594..595 "(" [] [], + elements: GraphqlVariableDefinitionList [ + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@595..596 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@596..603 "storyId" [] [], + }, + }, + colon_token: COLON@603..605 ":" [] [Whitespace(" ")], + ty: GraphqlNonNullType { + base: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@605..607 "ID" [] [], + }, + }, + excl_token: BANG@607..608 "!" [] [], + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + ], + r_paren_token: R_PAREN@608..611 ")" [] [Whitespace(" ")], + }, + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@611..612 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@612..624 "likeStory" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlField { + alias: GraphqlAlias { + value: GraphqlName { + value_token: GRAPHQL_NAME@624..631 "storyId" [] [], + }, + colon_token: COLON@631..633 ":" [] [Whitespace(" ")], + }, + name: missing (required), + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlBogusSelection { + items: [ + DOLLAR@633..634 "$" [] [], + ], + }, + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@634..641 "storyId" [] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@641..643 "}" [Newline("\n")] [], + }, + }, + GraphqlOperationDefinition { + ty: GraphqlOperationType { + value_token: QUERY_KW@643..651 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + name: missing (optional), + variables: GraphqlVariableDefinitions { + l_paren_token: L_PAREN@651..652 "(" [] [], + elements: GraphqlVariableDefinitionList [ + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@652..653 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@653..660 "storyId" [] [], + }, + }, + colon_token: COLON@660..662 ":" [] [Whitespace(" ")], + ty: GraphqlNonNullType { + base: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@662..664 "ID" [] [], + }, + }, + excl_token: BANG@664..665 "!" [] [], + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + ], + r_paren_token: R_PAREN@665..667 ")" [] [Whitespace(" ")], + }, + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@667..668 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@668..680 "likeStory" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlField { + alias: GraphqlAlias { + value: GraphqlName { + value_token: GRAPHQL_NAME@680..687 "storyId" [] [], + }, + colon_token: COLON@687..689 ":" [] [Whitespace(" ")], + }, + name: missing (required), + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlBogusSelection { + items: [ + DOLLAR@689..690 "$" [] [], + ], + }, + ], + r_curly_token: R_CURLY@690..692 "}" [Newline("\n")] [], + }, + }, + GraphqlOperationDefinition { + ty: GraphqlOperationType { + value_token: QUERY_KW@692..723 "query" [Newline("\n"), Newline("\n"), Comments("# malformed directives"), Newline("\n")] [Whitespace(" ")], + }, + name: missing (optional), + variables: GraphqlVariableDefinitions { + l_paren_token: L_PAREN@723..724 "(" [] [], + elements: GraphqlVariableDefinitionList [ + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@724..725 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@725..732 "storyId" [] [], + }, + }, + colon_token: COLON@732..734 ":" [] [Whitespace(" ")], + ty: GraphqlNonNullType { + base: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@734..736 "ID" [] [], + }, + }, + excl_token: BANG@736..737 "!" [] [], + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + ], + r_paren_token: R_PAREN@737..739 ")" [] [Whitespace(" ")], + }, + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@739..741 "@" [] [Whitespace(" ")], + name: missing (required), + arguments: missing (optional), + }, + ], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@741..742 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@742..753 "likeStory" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@753..755 "}" [Newline("\n")] [], + }, + }, ], - eof_token: EOF@15..18 "" [Newline("\n"), Newline("\n"), Newline("\n")] [], + eof_token: EOF@755..756 "" [Newline("\n")] [], } ``` ## CST ``` -0: GRAPHQL_ROOT@0..18 +0: GRAPHQL_ROOT@0..756 0: (empty) - 1: GRAPHQL_DEFINITION_LIST@0..15 - 0: GRAPHQL_OPERATION_DEFINITION@0..15 + 1: GRAPHQL_DEFINITION_LIST@0..755 + 0: GRAPHQL_OPERATION_DEFINITION@0..17 0: GRAPHQL_OPERATION_TYPE@0..6 0: QUERY_KW@0..6 "query" [] [Whitespace(" ")] - 1: GRAPHQL_NAME@6..15 - 0: GRAPHQL_NAME@6..15 "likeStory" [] [] + 1: GRAPHQL_NAME@6..16 + 0: GRAPHQL_NAME@6..16 "likeStory" [] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@16..16 + 4: GRAPHQL_SELECTION_SET@16..17 + 0: (empty) + 1: GRAPHQL_SELECTION_LIST@16..16 + 2: R_CURLY@16..17 "}" [] [] + 1: GRAPHQL_OPERATION_DEFINITION@17..34 + 0: GRAPHQL_OPERATION_TYPE@17..25 + 0: QUERY_KW@17..25 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: GRAPHQL_NAME@25..34 + 0: GRAPHQL_NAME@25..34 "likeStory" [] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@34..34 + 4: GRAPHQL_SELECTION_SET@34..34 + 0: (empty) + 1: GRAPHQL_SELECTION_LIST@34..34 + 2: (empty) + 2: GRAPHQL_OPERATION_DEFINITION@34..52 + 0: GRAPHQL_OPERATION_TYPE@34..42 + 0: QUERY_KW@34..42 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: GRAPHQL_NAME@42..46 + 0: GRAPHQL_NAME@42..46 "like" [] [] 2: (empty) - 3: GRAPHQL_DIRECTIVE_LIST@15..15 - 4: GRAPHQL_SELECTION_SET@15..15 + 3: GRAPHQL_DIRECTIVE_LIST@46..46 + 4: GRAPHQL_SELECTION_SET@46..52 0: (empty) - 1: GRAPHQL_SELECTION_LIST@15..15 + 1: GRAPHQL_SELECTION_LIST@46..52 + 0: GRAPHQL_BOGUS_SELECTION@46..47 + 0: DOLLAR@46..47 "$" [] [] + 1: GRAPHQL_FIELD@47..52 + 0: (empty) + 1: GRAPHQL_NAME@47..52 + 0: GRAPHQL_NAME@47..52 "Story" [] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@52..52 + 4: (empty) + 2: (empty) + 3: GRAPHQL_OPERATION_DEFINITION@52..130 + 0: GRAPHQL_OPERATION_TYPE@52..82 + 0: QUERY_KW@52..82 "query" [Newline("\n"), Newline("\n"), Comments("# malformed variables"), Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_VARIABLE_DEFINITIONS@82..97 + 0: L_PAREN@82..83 "(" [] [] + 1: GRAPHQL_VARIABLE_DEFINITION_LIST@83..97 + 0: GRAPHQL_VARIABLE_DEFINITION@83..97 + 0: GRAPHQL_VARIABLE@83..91 + 0: DOLLAR@83..84 "$" [] [] + 1: GRAPHQL_NAME@84..91 + 0: GRAPHQL_NAME@84..91 "storyId" [] [] + 1: COLON@91..93 ":" [] [Whitespace(" ")] + 2: GRAPHQL_NON_NULL_TYPE@93..97 + 0: GRAPHQL_NAMED_TYPE@93..95 + 0: GRAPHQL_NAME@93..95 + 0: GRAPHQL_NAME@93..95 "ID" [] [] + 1: BANG@95..97 "!" [] [Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@97..97 2: (empty) - 2: EOF@15..18 "" [Newline("\n"), Newline("\n"), Newline("\n")] [] + 3: GRAPHQL_DIRECTIVE_LIST@97..97 + 4: GRAPHQL_SELECTION_SET@97..130 + 0: L_CURLY@97..98 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@98..128 + 0: GRAPHQL_FIELD@98..128 + 0: (empty) + 1: GRAPHQL_NAME@98..109 + 0: GRAPHQL_NAME@98..109 "likeStory" [Newline("\n"), Whitespace("\t")] [] + 2: GRAPHQL_ARGUMENTS@109..128 + 0: L_PAREN@109..110 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@110..127 + 0: GRAPHQL_ARGUMENT@110..127 + 0: GRAPHQL_NAME@110..117 + 0: GRAPHQL_NAME@110..117 "storyId" [] [] + 1: COLON@117..119 ":" [] [Whitespace(" ")] + 2: GRAPHQL_VARIABLE@119..127 + 0: DOLLAR@119..120 "$" [] [] + 1: GRAPHQL_NAME@120..127 + 0: GRAPHQL_NAME@120..127 "storyId" [] [] + 2: R_PAREN@127..128 ")" [] [] + 3: GRAPHQL_DIRECTIVE_LIST@128..128 + 4: (empty) + 2: R_CURLY@128..130 "}" [Newline("\n")] [] + 4: GRAPHQL_OPERATION_DEFINITION@130..152 + 0: GRAPHQL_OPERATION_TYPE@130..138 + 0: QUERY_KW@130..138 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@138..138 + 4: GRAPHQL_SELECTION_SET@138..152 + 0: (empty) + 1: GRAPHQL_SELECTION_LIST@138..152 + 0: GRAPHQL_BOGUS_SELECTION@138..139 + 0: DOLLAR@138..139 "$" [] [] + 1: GRAPHQL_FIELD@139..150 + 0: GRAPHQL_ALIAS@139..148 + 0: GRAPHQL_NAME@139..146 + 0: GRAPHQL_NAME@139..146 "storyId" [] [] + 1: COLON@146..148 ":" [] [Whitespace(" ")] + 1: GRAPHQL_NAME@148..150 + 0: GRAPHQL_NAME@148..150 "ID" [] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@150..150 + 4: (empty) + 2: GRAPHQL_BOGUS_SELECTION@150..152 + 0: BANG@150..152 "!" [] [Whitespace(" ")] + 2: (empty) + 5: GRAPHQL_SELECTION_SET@152..185 + 0: L_CURLY@152..153 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@153..183 + 0: GRAPHQL_FIELD@153..183 + 0: (empty) + 1: GRAPHQL_NAME@153..164 + 0: GRAPHQL_NAME@153..164 "likeStory" [Newline("\n"), Whitespace("\t")] [] + 2: GRAPHQL_ARGUMENTS@164..183 + 0: L_PAREN@164..165 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@165..182 + 0: GRAPHQL_ARGUMENT@165..182 + 0: GRAPHQL_NAME@165..172 + 0: GRAPHQL_NAME@165..172 "storyId" [] [] + 1: COLON@172..174 ":" [] [Whitespace(" ")] + 2: GRAPHQL_VARIABLE@174..182 + 0: DOLLAR@174..175 "$" [] [] + 1: GRAPHQL_NAME@175..182 + 0: GRAPHQL_NAME@175..182 "storyId" [] [] + 2: R_PAREN@182..183 ")" [] [] + 3: GRAPHQL_DIRECTIVE_LIST@183..183 + 4: (empty) + 2: R_CURLY@183..185 "}" [Newline("\n")] [] + 6: GRAPHQL_OPERATION_DEFINITION@185..208 + 0: GRAPHQL_OPERATION_TYPE@185..193 + 0: QUERY_KW@185..193 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@193..193 + 4: GRAPHQL_SELECTION_SET@193..208 + 0: (empty) + 1: GRAPHQL_SELECTION_LIST@193..208 + 0: GRAPHQL_BOGUS_SELECTION@193..194 + 0: DOLLAR@193..194 "$" [] [] + 1: GRAPHQL_FIELD@194..205 + 0: GRAPHQL_ALIAS@194..203 + 0: GRAPHQL_NAME@194..201 + 0: GRAPHQL_NAME@194..201 "storyId" [] [] + 1: COLON@201..203 ":" [] [Whitespace(" ")] + 1: GRAPHQL_NAME@203..205 + 0: GRAPHQL_NAME@203..205 "ID" [] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@205..205 + 4: (empty) + 2: GRAPHQL_BOGUS_SELECTION@205..208 + 0: BANG@205..206 "!" [] [] + 1: R_PAREN@206..208 ")" [] [Whitespace(" ")] + 2: (empty) + 7: GRAPHQL_SELECTION_SET@208..241 + 0: L_CURLY@208..209 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@209..239 + 0: GRAPHQL_FIELD@209..239 + 0: (empty) + 1: GRAPHQL_NAME@209..220 + 0: GRAPHQL_NAME@209..220 "likeStory" [Newline("\n"), Whitespace("\t")] [] + 2: GRAPHQL_ARGUMENTS@220..239 + 0: L_PAREN@220..221 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@221..238 + 0: GRAPHQL_ARGUMENT@221..238 + 0: GRAPHQL_NAME@221..228 + 0: GRAPHQL_NAME@221..228 "storyId" [] [] + 1: COLON@228..230 ":" [] [Whitespace(" ")] + 2: GRAPHQL_VARIABLE@230..238 + 0: DOLLAR@230..231 "$" [] [] + 1: GRAPHQL_NAME@231..238 + 0: GRAPHQL_NAME@231..238 "storyId" [] [] + 2: R_PAREN@238..239 ")" [] [] + 3: GRAPHQL_DIRECTIVE_LIST@239..239 + 4: (empty) + 2: R_CURLY@239..241 "}" [Newline("\n")] [] + 8: GRAPHQL_OPERATION_DEFINITION@241..281 + 0: GRAPHQL_OPERATION_TYPE@241..249 + 0: QUERY_KW@241..249 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_VARIABLE_DEFINITIONS@249..255 + 0: L_PAREN@249..250 "(" [] [] + 1: GRAPHQL_VARIABLE_DEFINITION_LIST@250..253 + 0: GRAPHQL_VARIABLE_DEFINITION@250..253 + 0: GRAPHQL_VARIABLE@250..251 + 0: DOLLAR@250..251 "$" [] [] + 1: (empty) + 1: COLON@251..253 ":" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@253..253 + 2: R_PAREN@253..255 ")" [] [Whitespace(" ")] + 3: GRAPHQL_DIRECTIVE_LIST@255..255 + 4: GRAPHQL_SELECTION_SET@255..281 + 0: L_CURLY@255..256 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@256..279 + 0: GRAPHQL_FIELD@256..279 + 0: (empty) + 1: GRAPHQL_NAME@256..267 + 0: GRAPHQL_NAME@256..267 "likeStory" [Newline("\n"), Whitespace("\t")] [] + 2: GRAPHQL_ARGUMENTS@267..279 + 0: L_PAREN@267..268 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@268..278 + 0: GRAPHQL_ARGUMENT@268..278 + 0: GRAPHQL_NAME@268..275 + 0: GRAPHQL_NAME@268..275 "storyId" [] [] + 1: COLON@275..277 ":" [] [Whitespace(" ")] + 2: GRAPHQL_VARIABLE@277..278 + 0: DOLLAR@277..278 "$" [] [] + 1: (empty) + 2: R_PAREN@278..279 ")" [] [] + 3: GRAPHQL_DIRECTIVE_LIST@279..279 + 4: (empty) + 2: R_CURLY@279..281 "}" [Newline("\n")] [] + 9: GRAPHQL_BOGUS_DEFINITION@281..309 + 0: GRAPHQL_OPERATION_TYPE@281..289 + 0: QUERY_KW@281..289 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: GRAPHQL_BOGUS@289..295 + 0: L_PAREN@289..290 "(" [] [] + 1: GRAPHQL_BOGUS@290..293 + 0: GRAPHQL_BOGUS@290..293 + 0: GRAPHQL_NAME@290..291 "a" [] [] + 1: COLON@291..293 ":" [] [Whitespace(" ")] + 2: R_PAREN@293..295 ")" [] [Whitespace(" ")] + 2: GRAPHQL_DIRECTIVE_LIST@295..295 + 3: GRAPHQL_SELECTION_SET@295..309 + 0: L_CURLY@295..296 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@296..307 + 0: GRAPHQL_FIELD@296..307 + 0: (empty) + 1: GRAPHQL_NAME@296..307 + 0: GRAPHQL_NAME@296..307 "likeStory" [Newline("\n"), Whitespace("\t")] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@307..307 + 4: (empty) + 2: R_CURLY@307..309 "}" [Newline("\n")] [] + 10: GRAPHQL_BOGUS_DEFINITION@309..336 + 0: GRAPHQL_OPERATION_TYPE@309..317 + 0: QUERY_KW@309..317 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: GRAPHQL_BOGUS@317..322 + 0: L_PAREN@317..318 "(" [] [] + 1: GRAPHQL_BOGUS@318..322 + 0: GRAPHQL_BOGUS@318..322 + 0: GRAPHQL_NAME@318..319 "a" [] [] + 1: COLON@319..322 ":" [] [Whitespace(" ")] + 2: GRAPHQL_DIRECTIVE_LIST@322..322 + 3: GRAPHQL_SELECTION_SET@322..336 + 0: L_CURLY@322..323 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@323..334 + 0: GRAPHQL_FIELD@323..334 + 0: (empty) + 1: GRAPHQL_NAME@323..334 + 0: GRAPHQL_NAME@323..334 "likeStory" [Newline("\n"), Whitespace("\t")] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@334..334 + 4: (empty) + 2: R_CURLY@334..336 "}" [Newline("\n")] [] + 11: GRAPHQL_BOGUS_DEFINITION@336..363 + 0: GRAPHQL_OPERATION_TYPE@336..344 + 0: QUERY_KW@336..344 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: GRAPHQL_BOGUS@344..349 + 0: L_PAREN@344..345 "(" [] [] + 1: GRAPHQL_BOGUS@345..347 + 0: GRAPHQL_BOGUS@345..347 + 0: COLON@345..347 ":" [] [Whitespace(" ")] + 2: R_PAREN@347..349 ")" [] [Whitespace(" ")] + 2: GRAPHQL_DIRECTIVE_LIST@349..349 + 3: GRAPHQL_SELECTION_SET@349..363 + 0: L_CURLY@349..350 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@350..361 + 0: GRAPHQL_FIELD@350..361 + 0: (empty) + 1: GRAPHQL_NAME@350..361 + 0: GRAPHQL_NAME@350..361 "likeStory" [Newline("\n"), Whitespace("\t")] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@361..361 + 4: (empty) + 2: R_CURLY@361..363 "}" [Newline("\n")] [] + 12: GRAPHQL_BOGUS_DEFINITION@363..389 + 0: GRAPHQL_OPERATION_TYPE@363..371 + 0: QUERY_KW@363..371 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: GRAPHQL_BOGUS@371..375 + 0: L_PAREN@371..372 "(" [] [] + 1: GRAPHQL_BOGUS@372..375 + 0: GRAPHQL_BOGUS@372..375 + 0: COLON@372..375 ":" [] [Whitespace(" ")] + 2: GRAPHQL_DIRECTIVE_LIST@375..375 + 3: GRAPHQL_SELECTION_SET@375..389 + 0: L_CURLY@375..376 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@376..387 + 0: GRAPHQL_FIELD@376..387 + 0: (empty) + 1: GRAPHQL_NAME@376..387 + 0: GRAPHQL_NAME@376..387 "likeStory" [Newline("\n"), Whitespace("\t")] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@387..387 + 4: (empty) + 2: R_CURLY@387..389 "}" [Newline("\n")] [] + 13: GRAPHQL_OPERATION_DEFINITION@389..414 + 0: GRAPHQL_OPERATION_TYPE@389..397 + 0: QUERY_KW@389..397 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_VARIABLE_DEFINITIONS@397..400 + 0: L_PAREN@397..400 "(" [] [Whitespace(" ")] + 1: GRAPHQL_VARIABLE_DEFINITION_LIST@400..400 + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@400..400 + 4: GRAPHQL_SELECTION_SET@400..414 + 0: L_CURLY@400..401 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@401..412 + 0: GRAPHQL_FIELD@401..412 + 0: (empty) + 1: GRAPHQL_NAME@401..412 + 0: GRAPHQL_NAME@401..412 "likeStory" [Newline("\n"), Whitespace("\t")] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@412..412 + 4: (empty) + 2: R_CURLY@412..414 "}" [Newline("\n")] [] + 14: GRAPHQL_OPERATION_DEFINITION@414..451 + 0: GRAPHQL_OPERATION_TYPE@414..422 + 0: QUERY_KW@414..422 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_VARIABLE_DEFINITIONS@422..437 + 0: L_PAREN@422..423 "(" [] [] + 1: GRAPHQL_VARIABLE_DEFINITION_LIST@423..437 + 0: GRAPHQL_VARIABLE_DEFINITION@423..437 + 0: GRAPHQL_VARIABLE@423..431 + 0: DOLLAR@423..424 "$" [] [] + 1: GRAPHQL_NAME@424..431 + 0: GRAPHQL_NAME@424..431 "storyId" [] [] + 1: COLON@431..433 ":" [] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DEFAULT_VALUE@433..435 + 0: EQ@433..435 "=" [] [Whitespace(" ")] + 1: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@435..437 + 0: GRAPHQL_DIRECTIVE@435..437 + 0: AT@435..437 "@" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@437..437 + 4: GRAPHQL_SELECTION_SET@437..451 + 0: L_CURLY@437..438 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@438..449 + 0: GRAPHQL_FIELD@438..449 + 0: (empty) + 1: GRAPHQL_NAME@438..449 + 0: GRAPHQL_NAME@438..449 "likeStory" [Newline("\n"), Whitespace("\t")] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@449..449 + 4: (empty) + 2: R_CURLY@449..451 "}" [Newline("\n")] [] + 15: GRAPHQL_OPERATION_DEFINITION@451..530 + 0: GRAPHQL_OPERATION_TYPE@451..481 + 0: QUERY_KW@451..481 "query" [Newline("\n"), Newline("\n"), Comments("# malformed arguments"), Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_VARIABLE_DEFINITIONS@481..497 + 0: L_PAREN@481..482 "(" [] [] + 1: GRAPHQL_VARIABLE_DEFINITION_LIST@482..495 + 0: GRAPHQL_VARIABLE_DEFINITION@482..495 + 0: GRAPHQL_VARIABLE@482..490 + 0: DOLLAR@482..483 "$" [] [] + 1: GRAPHQL_NAME@483..490 + 0: GRAPHQL_NAME@483..490 "storyId" [] [] + 1: COLON@490..492 ":" [] [Whitespace(" ")] + 2: GRAPHQL_NON_NULL_TYPE@492..495 + 0: GRAPHQL_NAMED_TYPE@492..494 + 0: GRAPHQL_NAME@492..494 + 0: GRAPHQL_NAME@492..494 "ID" [] [] + 1: BANG@494..495 "!" [] [] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@495..495 + 2: R_PAREN@495..497 ")" [] [Whitespace(" ")] + 3: GRAPHQL_DIRECTIVE_LIST@497..497 + 4: GRAPHQL_SELECTION_SET@497..530 + 0: L_CURLY@497..498 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@498..528 + 0: GRAPHQL_FIELD@498..510 + 0: (empty) + 1: GRAPHQL_NAME@498..510 + 0: GRAPHQL_NAME@498..510 "likeStory" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@510..510 + 4: (empty) + 1: GRAPHQL_FIELD@510..519 + 0: GRAPHQL_ALIAS@510..519 + 0: GRAPHQL_NAME@510..517 + 0: GRAPHQL_NAME@510..517 "storyId" [] [] + 1: COLON@517..519 ":" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@519..519 + 4: (empty) + 2: GRAPHQL_BOGUS_SELECTION@519..520 + 0: DOLLAR@519..520 "$" [] [] + 3: GRAPHQL_FIELD@520..527 + 0: (empty) + 1: GRAPHQL_NAME@520..527 + 0: GRAPHQL_NAME@520..527 "storyId" [] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@527..527 + 4: (empty) + 4: GRAPHQL_BOGUS_SELECTION@527..528 + 0: R_PAREN@527..528 ")" [] [] + 2: R_CURLY@528..530 "}" [Newline("\n")] [] + 16: GRAPHQL_OPERATION_DEFINITION@530..586 + 0: GRAPHQL_OPERATION_TYPE@530..538 + 0: QUERY_KW@530..538 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_VARIABLE_DEFINITIONS@538..554 + 0: L_PAREN@538..539 "(" [] [] + 1: GRAPHQL_VARIABLE_DEFINITION_LIST@539..552 + 0: GRAPHQL_VARIABLE_DEFINITION@539..552 + 0: GRAPHQL_VARIABLE@539..547 + 0: DOLLAR@539..540 "$" [] [] + 1: GRAPHQL_NAME@540..547 + 0: GRAPHQL_NAME@540..547 "storyId" [] [] + 1: COLON@547..549 ":" [] [Whitespace(" ")] + 2: GRAPHQL_NON_NULL_TYPE@549..552 + 0: GRAPHQL_NAMED_TYPE@549..551 + 0: GRAPHQL_NAME@549..551 + 0: GRAPHQL_NAME@549..551 "ID" [] [] + 1: BANG@551..552 "!" [] [] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@552..552 + 2: R_PAREN@552..554 ")" [] [Whitespace(" ")] + 3: GRAPHQL_DIRECTIVE_LIST@554..554 + 4: GRAPHQL_SELECTION_SET@554..586 + 0: L_CURLY@554..555 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@555..584 + 0: GRAPHQL_FIELD@555..584 + 0: (empty) + 1: GRAPHQL_NAME@555..566 + 0: GRAPHQL_NAME@555..566 "likeStory" [Newline("\n"), Whitespace("\t")] [] + 2: GRAPHQL_ARGUMENTS@566..584 + 0: L_PAREN@566..567 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@567..584 + 0: GRAPHQL_ARGUMENT@567..584 + 0: GRAPHQL_NAME@567..574 + 0: GRAPHQL_NAME@567..574 "storyId" [] [] + 1: COLON@574..576 ":" [] [Whitespace(" ")] + 2: GRAPHQL_VARIABLE@576..584 + 0: DOLLAR@576..577 "$" [] [] + 1: GRAPHQL_NAME@577..584 + 0: GRAPHQL_NAME@577..584 "storyId" [] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@584..584 + 4: (empty) + 2: R_CURLY@584..586 "}" [Newline("\n")] [] + 17: GRAPHQL_OPERATION_DEFINITION@586..643 + 0: GRAPHQL_OPERATION_TYPE@586..594 + 0: QUERY_KW@586..594 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_VARIABLE_DEFINITIONS@594..611 + 0: L_PAREN@594..595 "(" [] [] + 1: GRAPHQL_VARIABLE_DEFINITION_LIST@595..608 + 0: GRAPHQL_VARIABLE_DEFINITION@595..608 + 0: GRAPHQL_VARIABLE@595..603 + 0: DOLLAR@595..596 "$" [] [] + 1: GRAPHQL_NAME@596..603 + 0: GRAPHQL_NAME@596..603 "storyId" [] [] + 1: COLON@603..605 ":" [] [Whitespace(" ")] + 2: GRAPHQL_NON_NULL_TYPE@605..608 + 0: GRAPHQL_NAMED_TYPE@605..607 + 0: GRAPHQL_NAME@605..607 + 0: GRAPHQL_NAME@605..607 "ID" [] [] + 1: BANG@607..608 "!" [] [] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@608..608 + 2: R_PAREN@608..611 ")" [] [Whitespace(" ")] + 3: GRAPHQL_DIRECTIVE_LIST@611..611 + 4: GRAPHQL_SELECTION_SET@611..643 + 0: L_CURLY@611..612 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@612..641 + 0: GRAPHQL_FIELD@612..624 + 0: (empty) + 1: GRAPHQL_NAME@612..624 + 0: GRAPHQL_NAME@612..624 "likeStory" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@624..624 + 4: (empty) + 1: GRAPHQL_FIELD@624..633 + 0: GRAPHQL_ALIAS@624..633 + 0: GRAPHQL_NAME@624..631 + 0: GRAPHQL_NAME@624..631 "storyId" [] [] + 1: COLON@631..633 ":" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@633..633 + 4: (empty) + 2: GRAPHQL_BOGUS_SELECTION@633..634 + 0: DOLLAR@633..634 "$" [] [] + 3: GRAPHQL_FIELD@634..641 + 0: (empty) + 1: GRAPHQL_NAME@634..641 + 0: GRAPHQL_NAME@634..641 "storyId" [] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@641..641 + 4: (empty) + 2: R_CURLY@641..643 "}" [Newline("\n")] [] + 18: GRAPHQL_OPERATION_DEFINITION@643..692 + 0: GRAPHQL_OPERATION_TYPE@643..651 + 0: QUERY_KW@643..651 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_VARIABLE_DEFINITIONS@651..667 + 0: L_PAREN@651..652 "(" [] [] + 1: GRAPHQL_VARIABLE_DEFINITION_LIST@652..665 + 0: GRAPHQL_VARIABLE_DEFINITION@652..665 + 0: GRAPHQL_VARIABLE@652..660 + 0: DOLLAR@652..653 "$" [] [] + 1: GRAPHQL_NAME@653..660 + 0: GRAPHQL_NAME@653..660 "storyId" [] [] + 1: COLON@660..662 ":" [] [Whitespace(" ")] + 2: GRAPHQL_NON_NULL_TYPE@662..665 + 0: GRAPHQL_NAMED_TYPE@662..664 + 0: GRAPHQL_NAME@662..664 + 0: GRAPHQL_NAME@662..664 "ID" [] [] + 1: BANG@664..665 "!" [] [] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@665..665 + 2: R_PAREN@665..667 ")" [] [Whitespace(" ")] + 3: GRAPHQL_DIRECTIVE_LIST@667..667 + 4: GRAPHQL_SELECTION_SET@667..692 + 0: L_CURLY@667..668 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@668..690 + 0: GRAPHQL_FIELD@668..680 + 0: (empty) + 1: GRAPHQL_NAME@668..680 + 0: GRAPHQL_NAME@668..680 "likeStory" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@680..680 + 4: (empty) + 1: GRAPHQL_FIELD@680..689 + 0: GRAPHQL_ALIAS@680..689 + 0: GRAPHQL_NAME@680..687 + 0: GRAPHQL_NAME@680..687 "storyId" [] [] + 1: COLON@687..689 ":" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@689..689 + 4: (empty) + 2: GRAPHQL_BOGUS_SELECTION@689..690 + 0: DOLLAR@689..690 "$" [] [] + 2: R_CURLY@690..692 "}" [Newline("\n")] [] + 19: GRAPHQL_OPERATION_DEFINITION@692..755 + 0: GRAPHQL_OPERATION_TYPE@692..723 + 0: QUERY_KW@692..723 "query" [Newline("\n"), Newline("\n"), Comments("# malformed directives"), Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_VARIABLE_DEFINITIONS@723..739 + 0: L_PAREN@723..724 "(" [] [] + 1: GRAPHQL_VARIABLE_DEFINITION_LIST@724..737 + 0: GRAPHQL_VARIABLE_DEFINITION@724..737 + 0: GRAPHQL_VARIABLE@724..732 + 0: DOLLAR@724..725 "$" [] [] + 1: GRAPHQL_NAME@725..732 + 0: GRAPHQL_NAME@725..732 "storyId" [] [] + 1: COLON@732..734 ":" [] [Whitespace(" ")] + 2: GRAPHQL_NON_NULL_TYPE@734..737 + 0: GRAPHQL_NAMED_TYPE@734..736 + 0: GRAPHQL_NAME@734..736 + 0: GRAPHQL_NAME@734..736 "ID" [] [] + 1: BANG@736..737 "!" [] [] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@737..737 + 2: R_PAREN@737..739 ")" [] [Whitespace(" ")] + 3: GRAPHQL_DIRECTIVE_LIST@739..741 + 0: GRAPHQL_DIRECTIVE@739..741 + 0: AT@739..741 "@" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 4: GRAPHQL_SELECTION_SET@741..755 + 0: L_CURLY@741..742 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@742..753 + 0: GRAPHQL_FIELD@742..753 + 0: (empty) + 1: GRAPHQL_NAME@742..753 + 0: GRAPHQL_NAME@742..753 "likeStory" [Newline("\n"), Whitespace("\t")] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@753..753 + 4: (empty) + 2: R_CURLY@753..755 "}" [Newline("\n")] [] + 2: EOF@755..756 "" [Newline("\n")] [] ``` ## Diagnostics ``` -operation.graphql:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +operation.graphql:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `}` + + > 1 │ query likeStory } + │ ^ + 2 │ + 3 │ query likeStory + + i Remove } + +operation.graphql:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `query` + + 3 │ query likeStory + 4 │ + > 5 │ query like$Story + │ ^^^^^ + 6 │ + 7 │ # malformed variables + + i Remove query + +operation.graphql:5:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `$` + + 3 │ query likeStory + 4 │ + > 5 │ query like$Story + │ ^ + 6 │ + 7 │ # malformed variables + + i Remove $ + +operation.graphql:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `query` + + 7 │ # malformed variables + > 8 │ query ($storyId: ID! { + │ ^^^^^ + 9 │ likeStory(storyId: $storyId) + 10 │ } + + i Remove query + +operation.graphql:8:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `{` + + 7 │ # malformed variables + > 8 │ query ($storyId: ID! { + │ ^ + 9 │ likeStory(storyId: $storyId) + 10 │ } + + i Remove { + +operation.graphql:12:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `$` + + 10 │ } + 11 │ + > 12 │ query $storyId: ID! { + │ ^ + 13 │ likeStory(storyId: $storyId) + 14 │ } + + i Remove $ + +operation.graphql:12:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a field, a fragment spread, or an inline fragment but instead found '!'. + + 10 │ } + 11 │ + > 12 │ query $storyId: ID! { + │ ^ + 13 │ likeStory(storyId: $storyId) + 14 │ } + + i Expected a field, a fragment spread, or an inline fragment here. + + 10 │ } + 11 │ + > 12 │ query $storyId: ID! { + │ ^ + 13 │ likeStory(storyId: $storyId) + 14 │ } + +operation.graphql:12:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `{` + + 10 │ } + 11 │ + > 12 │ query $storyId: ID! { + │ ^ + 13 │ likeStory(storyId: $storyId) + 14 │ } + + i Remove { + +operation.graphql:16:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `$` + + 14 │ } + 15 │ + > 16 │ query $storyId: ID!) { + │ ^ + 17 │ likeStory(storyId: $storyId) + 18 │ } + + i Remove $ + +operation.graphql:16:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a field, a fragment spread, or an inline fragment but instead found '!)'. + + 14 │ } + 15 │ + > 16 │ query $storyId: ID!) { + │ ^^ + 17 │ likeStory(storyId: $storyId) + 18 │ } + + i Expected a field, a fragment spread, or an inline fragment here. + + 14 │ } + 15 │ + > 16 │ query $storyId: ID!) { + │ ^^ + 17 │ likeStory(storyId: $storyId) + 18 │ } + +operation.graphql:16:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `{` + + 14 │ } + 15 │ + > 16 │ query $storyId: ID!) { + │ ^ + 17 │ likeStory(storyId: $storyId) + 18 │ } + + i Remove { + +operation.graphql:20:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found ':'. + + 18 │ } + 19 │ + > 20 │ query ($: ) { + │ ^ + 21 │ likeStory(storyId: $) + 22 │ } + + i Expected a name here. + + 18 │ } + 19 │ + > 20 │ query ($: ) { + │ ^ + 21 │ likeStory(storyId: $) + 22 │ } + +operation.graphql:20:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type but instead found ')'. + + 18 │ } + 19 │ + > 20 │ query ($: ) { + │ ^ + 21 │ likeStory(storyId: $) + 22 │ } + + i Expected a type here. + + 18 │ } + 19 │ + > 20 │ query ($: ) { + │ ^ + 21 │ likeStory(storyId: $) + 22 │ } + +operation.graphql:21:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found ')'. + + 20 │ query ($: ) { + > 21 │ likeStory(storyId: $) + │ ^ + 22 │ } + 23 │ + + i Expected a name here. + + 20 │ query ($: ) { + > 21 │ likeStory(storyId: $) + │ ^ + 22 │ } + 23 │ + +operation.graphql:24:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a variable definition but instead found 'a:'. + + 22 │ } + 23 │ + > 24 │ query (a: ) { + │ ^^ + 25 │ likeStory + 26 │ } + + i Expected a variable definition here. + + 22 │ } + 23 │ + > 24 │ query (a: ) { + │ ^^ + 25 │ likeStory + 26 │ } + +operation.graphql:28:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a variable definition but instead found 'a:'. + + 26 │ } + 27 │ + > 28 │ query (a: { + │ ^^ + 29 │ likeStory + 30 │ } + + i Expected a variable definition here. + + 26 │ } + 27 │ + > 28 │ query (a: { + │ ^^ + 29 │ likeStory + 30 │ } + +operation.graphql:28:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `{` + + 26 │ } + 27 │ + > 28 │ query (a: { + │ ^ + 29 │ likeStory + 30 │ } + + i Remove { + +operation.graphql:32:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a variable definition but instead found ':'. + + 30 │ } + 31 │ + > 32 │ query (: ) { + │ ^ + 33 │ likeStory + 34 │ } + + i Expected a variable definition here. + + 30 │ } + 31 │ + > 32 │ query (: ) { + │ ^ + 33 │ likeStory + 34 │ } + +operation.graphql:36:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a variable definition but instead found ':'. + + 34 │ } + 35 │ + > 36 │ query (: { + │ ^ + 37 │ likeStory + 38 │ } + + i Expected a variable definition here. + + 34 │ } + 35 │ + > 36 │ query (: { + │ ^ + 37 │ likeStory + 38 │ } + +operation.graphql:36:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `{` + + 34 │ } + 35 │ + > 36 │ query (: { + │ ^ + 37 │ likeStory + 38 │ } + + i Remove { + +operation.graphql:40:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `{` + + 38 │ } + 39 │ + > 40 │ query ( { + │ ^ + 41 │ likeStory + 42 │ } + + i Remove { + +operation.graphql:44:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type but instead found '='. + + 42 │ } + 43 │ + > 44 │ query ($storyId: = @ { + │ ^ + 45 │ likeStory + 46 │ } + + i Expected a type here. + + 42 │ } + 43 │ + > 44 │ query ($storyId: = @ { + │ ^ + 45 │ likeStory + 46 │ } + +operation.graphql:44:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a value but instead found '@'. + + 42 │ } + 43 │ + > 44 │ query ($storyId: = @ { + │ ^ + 45 │ likeStory + 46 │ } + + i Expected a value here. + + 42 │ } + 43 │ + > 44 │ query ($storyId: = @ { + │ ^ + 45 │ likeStory + 46 │ } + +operation.graphql:44:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '{'. + + 42 │ } + 43 │ + > 44 │ query ($storyId: = @ { + │ ^ + 45 │ likeStory + 46 │ } + + i Expected a name here. + + 42 │ } + 43 │ + > 44 │ query ($storyId: = @ { + │ ^ + 45 │ likeStory + 46 │ } + +operation.graphql:50:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '$'. + + 48 │ # malformed arguments + 49 │ query ($storyId: ID!) { + > 50 │ likeStory storyId: $storyId) + │ ^ + 51 │ } + 52 │ + + i Expected a name here. + + 48 │ # malformed arguments + 49 │ query ($storyId: ID!) { + > 50 │ likeStory storyId: $storyId) + │ ^ + 51 │ } + 52 │ + +operation.graphql:50:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a field, a fragment spread, or an inline fragment but instead found ')'. + + 48 │ # malformed arguments + 49 │ query ($storyId: ID!) { + > 50 │ likeStory storyId: $storyId) + │ ^ + 51 │ } + 52 │ + + i Expected a field, a fragment spread, or an inline fragment here. + + 48 │ # malformed arguments + 49 │ query ($storyId: ID!) { + > 50 │ likeStory storyId: $storyId) + │ ^ + 51 │ } + 52 │ + +operation.graphql:55:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `}` + + 53 │ query ($storyId: ID!) { + 54 │ likeStory(storyId: $storyId + > 55 │ } + │ ^ + 56 │ + 57 │ query ($storyId: ID!) { + + i Remove } + +operation.graphql:58:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '$'. + + 57 │ query ($storyId: ID!) { + > 58 │ likeStory storyId: $storyId + │ ^ + 59 │ } + 60 │ + + i Expected a name here. + + 57 │ query ($storyId: ID!) { + > 58 │ likeStory storyId: $storyId + │ ^ + 59 │ } + 60 │ + +operation.graphql:62:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '$'. + + 61 │ query ($storyId: ID!) { + > 62 │ likeStory storyId: $ + │ ^ + 63 │ } + 64 │ + + i Expected a name here. + + 61 │ query ($storyId: ID!) { + > 62 │ likeStory storyId: $ + │ ^ + 63 │ } + 64 │ + +operation.graphql:66:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - × expected `{` but instead the file ends + × Expected a name but instead found '{'. - > 4 │ - │ + 65 │ # malformed directives + > 66 │ query ($storyId: ID!) @ { + │ ^ + 67 │ likeStory + 68 │ } - i the file ends here + i Expected a name here. - > 4 │ - │ + 65 │ # malformed directives + > 66 │ query ($storyId: ID!) @ { + │ ^ + 67 │ likeStory + 68 │ } ``` diff --git a/crates/biome_graphql_parser/tests/graphql_test_suite/err/selection_set.graphql b/crates/biome_graphql_parser/tests/graphql_test_suite/err/selection_set.graphql new file mode 100644 index 000000000000..5c223acc1b96 --- /dev/null +++ b/crates/biome_graphql_parser/tests/graphql_test_suite/err/selection_set.graphql @@ -0,0 +1,79 @@ +{ + hero { + name, + age + +} + +{ + hero(name: "Tony Stark" +} + +{ + hero(name "Tony Stark") + country, + name, + age + } +} + +{ + hero(name: "Tony Stark") { + country, + name, + age, + height(unit FOOT, + } +} + +{ + ironMan: (name: "Tony Stark") +} + +{ + ironMan: hero(name: "Tony Stark" { + country, + firstWife: wife(name: "Pepper"){ + } +} + +{ + ironMan: hero(name: "Tony Stark") @{ + country @, + name, + age + } +} + +# Fragment spread +{ + ... +} + +{ + ... @deprecated +} + +{ + ironMan: (: "Tony Stark") @ { + ... + } +} + +{ + ... { + hero +} + +{ + ... @ + hero + } +} + +{ + ... Hero @ { + name, + age + } +} diff --git a/crates/biome_graphql_parser/tests/graphql_test_suite/err/selection_set.graphql.snap b/crates/biome_graphql_parser/tests/graphql_test_suite/err/selection_set.graphql.snap new file mode 100644 index 000000000000..1ec029adf412 --- /dev/null +++ b/crates/biome_graphql_parser/tests/graphql_test_suite/err/selection_set.graphql.snap @@ -0,0 +1,1451 @@ +--- +source: crates/biome_graphql_parser/tests/spec_test.rs +expression: snapshot +--- +## Input +```graphql +{ + hero { + name, + age + +} + +{ + hero(name: "Tony Stark" +} + +{ + hero(name "Tony Stark") + country, + name, + age + } +} + +{ + hero(name: "Tony Stark") { + country, + name, + age, + height(unit FOOT, + } +} + +{ + ironMan: (name: "Tony Stark") +} + +{ + ironMan: hero(name: "Tony Stark" { + country, + firstWife: wife(name: "Pepper"){ + } +} + +{ + ironMan: hero(name: "Tony Stark") @{ + country @, + name, + age + } +} + +# Fragment spread +{ + ... +} + +{ + ... @deprecated +} + +{ + ironMan: (: "Tony Stark") @ { + ... + } +} + +{ + ... { + hero +} + +{ + ... @ + hero + } +} + +{ + ... Hero @ { + name, + age + } +} + +``` + +## AST + +``` +GraphqlRoot { + bom_token: missing (optional), + definitions: GraphqlDefinitionList [ + GraphqlSelectionSet { + l_curly_token: L_CURLY@0..1 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@1..8 "hero" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@8..9 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@9..17 "name" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@17..23 "age" [Newline("\n"), Whitespace("\t\t")] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@23..26 "}" [Newline("\n"), Newline("\n")] [], + }, + }, + ], + r_curly_token: missing (required), + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@26..29 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@29..35 "hero" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: GraphqlArguments { + l_paren_token: L_PAREN@35..36 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@36..40 "name" [] [], + }, + colon_token: COLON@40..42 ":" [] [Whitespace(" ")], + value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@42..54 "\"Tony Stark\"" [] [], + }, + }, + ], + r_paren_token: missing (required), + }, + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@54..56 "}" [Newline("\n")] [], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@56..59 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@59..65 "hero" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: GraphqlArguments { + l_paren_token: L_PAREN@65..66 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@66..71 "name" [] [Whitespace(" ")], + }, + colon_token: missing (required), + value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@71..83 "\"Tony Stark\"" [] [], + }, + }, + ], + r_paren_token: R_PAREN@83..84 ")" [] [], + }, + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@84..95 "country" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@95..103 "name" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@103..109 "age" [Newline("\n"), Whitespace("\t\t")] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@109..112 "}" [Newline("\n"), Whitespace("\t")] [], + }, + GraphqlBogusDefinition { + items: [ + R_CURLY@112..114 "}" [Newline("\n")] [], + ], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@114..117 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@117..123 "hero" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: GraphqlArguments { + l_paren_token: L_PAREN@123..124 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@124..128 "name" [] [], + }, + colon_token: COLON@128..130 ":" [] [Whitespace(" ")], + value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@130..142 "\"Tony Stark\"" [] [], + }, + }, + ], + r_paren_token: R_PAREN@142..144 ")" [] [Whitespace(" ")], + }, + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@144..145 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@145..156 "country" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@156..164 "name" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@164..171 "age" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@171..180 "height" [Newline("\n"), Whitespace("\t\t")] [], + }, + arguments: GraphqlArguments { + l_paren_token: L_PAREN@180..181 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@181..186 "unit" [] [Whitespace(" ")], + }, + colon_token: missing (required), + value: GraphqlEnumValue { + graphql_name: GraphqlName { + value_token: GRAPHQL_NAME@186..191 "FOOT" [] [Skipped(",")], + }, + }, + }, + ], + r_paren_token: missing (required), + }, + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@191..194 "}" [Newline("\n"), Whitespace("\t")] [], + }, + }, + ], + r_curly_token: R_CURLY@194..196 "}" [Newline("\n")] [], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@196..199 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: GraphqlAlias { + value: GraphqlName { + value_token: GRAPHQL_NAME@199..209 "ironMan" [Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@209..211 ":" [] [Whitespace(" ")], + }, + name: missing (required), + arguments: GraphqlArguments { + l_paren_token: L_PAREN@211..212 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@212..216 "name" [] [], + }, + colon_token: COLON@216..218 ":" [] [Whitespace(" ")], + value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@218..230 "\"Tony Stark\"" [] [], + }, + }, + ], + r_paren_token: R_PAREN@230..231 ")" [] [], + }, + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@231..233 "}" [Newline("\n")] [], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@233..236 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: GraphqlAlias { + value: GraphqlName { + value_token: GRAPHQL_NAME@236..246 "ironMan" [Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@246..248 ":" [] [Whitespace(" ")], + }, + name: GraphqlName { + value_token: GRAPHQL_NAME@248..252 "hero" [] [], + }, + arguments: GraphqlArguments { + l_paren_token: L_PAREN@252..253 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@253..257 "name" [] [], + }, + colon_token: COLON@257..259 ":" [] [Whitespace(" ")], + value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@259..272 "\"Tony Stark\"" [] [Whitespace(" ")], + }, + }, + ], + r_paren_token: missing (required), + }, + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@272..273 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@273..284 "country" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlField { + alias: GraphqlAlias { + value: GraphqlName { + value_token: GRAPHQL_NAME@284..296 "firstWife" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@296..298 ":" [] [Whitespace(" ")], + }, + name: GraphqlName { + value_token: GRAPHQL_NAME@298..302 "wife" [] [], + }, + arguments: GraphqlArguments { + l_paren_token: L_PAREN@302..303 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@303..307 "name" [] [], + }, + colon_token: COLON@307..309 ":" [] [Whitespace(" ")], + value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@309..317 "\"Pepper\"" [] [], + }, + }, + ], + r_paren_token: R_PAREN@317..318 ")" [] [], + }, + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@318..319 "{" [] [], + selections: GraphqlSelectionList [], + r_curly_token: R_CURLY@319..323 "}" [Newline("\n"), Whitespace("\t\t")] [], + }, + }, + ], + r_curly_token: R_CURLY@323..325 "}" [Newline("\n")] [], + }, + }, + ], + r_curly_token: missing (required), + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@325..328 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: GraphqlAlias { + value: GraphqlName { + value_token: GRAPHQL_NAME@328..338 "ironMan" [Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@338..340 ":" [] [Whitespace(" ")], + }, + name: GraphqlName { + value_token: GRAPHQL_NAME@340..344 "hero" [] [], + }, + arguments: GraphqlArguments { + l_paren_token: L_PAREN@344..345 "(" [] [], + arguments: GraphqlArgumentList [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@345..349 "name" [] [], + }, + colon_token: COLON@349..351 ":" [] [Whitespace(" ")], + value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@351..363 "\"Tony Stark\"" [] [], + }, + }, + ], + r_paren_token: R_PAREN@363..365 ")" [] [Whitespace(" ")], + }, + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@365..366 "@" [] [], + name: missing (required), + arguments: missing (optional), + }, + ], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@366..367 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@367..378 "country" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@378..380 "@" [] [Skipped(",")], + name: GraphqlName { + value_token: GRAPHQL_NAME@380..388 "name" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")], + }, + arguments: missing (optional), + }, + ], + selection_set: missing (optional), + }, + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@388..394 "age" [Newline("\n"), Whitespace("\t\t")] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@394..397 "}" [Newline("\n"), Whitespace("\t")] [], + }, + }, + ], + r_curly_token: R_CURLY@397..399 "}" [Newline("\n")] [], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@399..420 "{" [Newline("\n"), Newline("\n"), Comments("# Fragment spread"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlInlineFragment { + dotdotdot_token: DOT3@420..426 "..." [Newline("\n"), Whitespace(" ")] [], + type_condition: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: missing (required), + selections: GraphqlSelectionList [], + r_curly_token: R_CURLY@426..428 "}" [Newline("\n")] [], + }, + }, + ], + r_curly_token: missing (required), + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@428..431 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlInlineFragment { + dotdotdot_token: DOT3@431..438 "..." [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + type_condition: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@438..439 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@439..449 "deprecated" [] [], + }, + arguments: missing (optional), + }, + ], + selection_set: GraphqlSelectionSet { + l_curly_token: missing (required), + selections: GraphqlSelectionList [], + r_curly_token: R_CURLY@449..451 "}" [Newline("\n")] [], + }, + }, + ], + r_curly_token: missing (required), + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@451..454 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlBogusSelection { + items: [ + GraphqlAlias { + value: GraphqlName { + value_token: GRAPHQL_NAME@454..464 "ironMan" [Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@464..466 ":" [] [Whitespace(" ")], + }, + GraphqlBogus { + items: [ + L_PAREN@466..467 "(" [] [], + GraphqlBogus { + items: [ + GraphqlBogus { + items: [ + COLON@467..469 ":" [] [Whitespace(" ")], + GRAPHQL_STRING_LITERAL@469..481 "\"Tony Stark\"" [] [], + ], + }, + ], + }, + R_PAREN@481..483 ")" [] [Whitespace(" ")], + ], + }, + GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@483..485 "@" [] [Whitespace(" ")], + name: missing (required), + arguments: missing (optional), + }, + ], + GraphqlSelectionSet { + l_curly_token: L_CURLY@485..486 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlInlineFragment { + dotdotdot_token: DOT3@486..492 "..." [Newline("\n"), Whitespace("\t\t")] [], + type_condition: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: missing (required), + selections: GraphqlSelectionList [], + r_curly_token: R_CURLY@492..495 "}" [Newline("\n"), Whitespace("\t")] [], + }, + }, + ], + r_curly_token: R_CURLY@495..497 "}" [Newline("\n")] [], + }, + ], + }, + ], + r_curly_token: missing (required), + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@497..500 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlInlineFragment { + dotdotdot_token: DOT3@500..507 "..." [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + type_condition: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: GraphqlSelectionSet { + l_curly_token: L_CURLY@507..508 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@508..515 "hero" [Newline("\n"), Whitespace("\t\t")] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@515..517 "}" [Newline("\n")] [], + }, + }, + ], + r_curly_token: missing (required), + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@517..520 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlInlineFragment { + dotdotdot_token: DOT3@520..527 "..." [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + type_condition: missing (optional), + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@527..528 "@" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@528..535 "hero" [Newline("\n"), Whitespace("\t\t")] [], + }, + arguments: missing (optional), + }, + ], + selection_set: GraphqlSelectionSet { + l_curly_token: missing (required), + selections: GraphqlSelectionList [], + r_curly_token: R_CURLY@535..538 "}" [Newline("\n"), Whitespace("\t")] [], + }, + }, + ], + r_curly_token: R_CURLY@538..540 "}" [Newline("\n")] [], + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@540..543 "{" [Newline("\n"), Newline("\n")] [], + selections: GraphqlSelectionList [ + GraphqlFragmentSpread { + dotdotdot_token: DOT3@543..550 "..." [Newline("\n"), Whitespace("\t")] [Whitespace(" ")], + name: GraphqlName { + value_token: GRAPHQL_NAME@550..555 "Hero" [] [Whitespace(" ")], + }, + directives: GraphqlDirectiveList [ + GraphqlDirective { + at_token: AT@555..557 "@" [] [Whitespace(" ")], + name: missing (required), + arguments: missing (optional), + }, + ], + }, + ], + r_curly_token: missing (required), + }, + GraphqlSelectionSet { + l_curly_token: L_CURLY@557..558 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@558..566 "name" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@566..572 "age" [Newline("\n"), Whitespace("\t\t")] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@572..575 "}" [Newline("\n"), Whitespace("\t")] [], + }, + GraphqlBogusDefinition { + items: [ + R_CURLY@575..577 "}" [Newline("\n")] [], + ], + }, + ], + eof_token: EOF@577..578 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: GRAPHQL_ROOT@0..578 + 0: (empty) + 1: GRAPHQL_DEFINITION_LIST@0..577 + 0: GRAPHQL_SELECTION_SET@0..26 + 0: L_CURLY@0..1 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@1..26 + 0: GRAPHQL_FIELD@1..26 + 0: (empty) + 1: GRAPHQL_NAME@1..8 + 0: GRAPHQL_NAME@1..8 "hero" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@8..8 + 4: GRAPHQL_SELECTION_SET@8..26 + 0: L_CURLY@8..9 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@9..23 + 0: GRAPHQL_FIELD@9..17 + 0: (empty) + 1: GRAPHQL_NAME@9..17 + 0: GRAPHQL_NAME@9..17 "name" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@17..17 + 4: (empty) + 1: GRAPHQL_FIELD@17..23 + 0: (empty) + 1: GRAPHQL_NAME@17..23 + 0: GRAPHQL_NAME@17..23 "age" [Newline("\n"), Whitespace("\t\t")] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@23..23 + 4: (empty) + 2: R_CURLY@23..26 "}" [Newline("\n"), Newline("\n")] [] + 2: (empty) + 1: GRAPHQL_SELECTION_SET@26..56 + 0: L_CURLY@26..29 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@29..54 + 0: GRAPHQL_FIELD@29..54 + 0: (empty) + 1: GRAPHQL_NAME@29..35 + 0: GRAPHQL_NAME@29..35 "hero" [Newline("\n"), Whitespace("\t")] [] + 2: GRAPHQL_ARGUMENTS@35..54 + 0: L_PAREN@35..36 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@36..54 + 0: GRAPHQL_ARGUMENT@36..54 + 0: GRAPHQL_NAME@36..40 + 0: GRAPHQL_NAME@36..40 "name" [] [] + 1: COLON@40..42 ":" [] [Whitespace(" ")] + 2: GRAPHQL_STRING_VALUE@42..54 + 0: GRAPHQL_STRING_LITERAL@42..54 "\"Tony Stark\"" [] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@54..54 + 4: (empty) + 2: R_CURLY@54..56 "}" [Newline("\n")] [] + 2: GRAPHQL_SELECTION_SET@56..112 + 0: L_CURLY@56..59 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@59..109 + 0: GRAPHQL_FIELD@59..84 + 0: (empty) + 1: GRAPHQL_NAME@59..65 + 0: GRAPHQL_NAME@59..65 "hero" [Newline("\n"), Whitespace("\t")] [] + 2: GRAPHQL_ARGUMENTS@65..84 + 0: L_PAREN@65..66 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@66..83 + 0: GRAPHQL_ARGUMENT@66..83 + 0: GRAPHQL_NAME@66..71 + 0: GRAPHQL_NAME@66..71 "name" [] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_STRING_VALUE@71..83 + 0: GRAPHQL_STRING_LITERAL@71..83 "\"Tony Stark\"" [] [] + 2: R_PAREN@83..84 ")" [] [] + 3: GRAPHQL_DIRECTIVE_LIST@84..84 + 4: (empty) + 1: GRAPHQL_FIELD@84..95 + 0: (empty) + 1: GRAPHQL_NAME@84..95 + 0: GRAPHQL_NAME@84..95 "country" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@95..95 + 4: (empty) + 2: GRAPHQL_FIELD@95..103 + 0: (empty) + 1: GRAPHQL_NAME@95..103 + 0: GRAPHQL_NAME@95..103 "name" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@103..103 + 4: (empty) + 3: GRAPHQL_FIELD@103..109 + 0: (empty) + 1: GRAPHQL_NAME@103..109 + 0: GRAPHQL_NAME@103..109 "age" [Newline("\n"), Whitespace("\t\t")] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@109..109 + 4: (empty) + 2: R_CURLY@109..112 "}" [Newline("\n"), Whitespace("\t")] [] + 3: GRAPHQL_BOGUS_DEFINITION@112..114 + 0: R_CURLY@112..114 "}" [Newline("\n")] [] + 4: GRAPHQL_SELECTION_SET@114..196 + 0: L_CURLY@114..117 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@117..194 + 0: GRAPHQL_FIELD@117..194 + 0: (empty) + 1: GRAPHQL_NAME@117..123 + 0: GRAPHQL_NAME@117..123 "hero" [Newline("\n"), Whitespace("\t")] [] + 2: GRAPHQL_ARGUMENTS@123..144 + 0: L_PAREN@123..124 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@124..142 + 0: GRAPHQL_ARGUMENT@124..142 + 0: GRAPHQL_NAME@124..128 + 0: GRAPHQL_NAME@124..128 "name" [] [] + 1: COLON@128..130 ":" [] [Whitespace(" ")] + 2: GRAPHQL_STRING_VALUE@130..142 + 0: GRAPHQL_STRING_LITERAL@130..142 "\"Tony Stark\"" [] [] + 2: R_PAREN@142..144 ")" [] [Whitespace(" ")] + 3: GRAPHQL_DIRECTIVE_LIST@144..144 + 4: GRAPHQL_SELECTION_SET@144..194 + 0: L_CURLY@144..145 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@145..191 + 0: GRAPHQL_FIELD@145..156 + 0: (empty) + 1: GRAPHQL_NAME@145..156 + 0: GRAPHQL_NAME@145..156 "country" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@156..156 + 4: (empty) + 1: GRAPHQL_FIELD@156..164 + 0: (empty) + 1: GRAPHQL_NAME@156..164 + 0: GRAPHQL_NAME@156..164 "name" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@164..164 + 4: (empty) + 2: GRAPHQL_FIELD@164..171 + 0: (empty) + 1: GRAPHQL_NAME@164..171 + 0: GRAPHQL_NAME@164..171 "age" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@171..171 + 4: (empty) + 3: GRAPHQL_FIELD@171..191 + 0: (empty) + 1: GRAPHQL_NAME@171..180 + 0: GRAPHQL_NAME@171..180 "height" [Newline("\n"), Whitespace("\t\t")] [] + 2: GRAPHQL_ARGUMENTS@180..191 + 0: L_PAREN@180..181 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@181..191 + 0: GRAPHQL_ARGUMENT@181..191 + 0: GRAPHQL_NAME@181..186 + 0: GRAPHQL_NAME@181..186 "unit" [] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_ENUM_VALUE@186..191 + 0: GRAPHQL_NAME@186..191 + 0: GRAPHQL_NAME@186..191 "FOOT" [] [Skipped(",")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@191..191 + 4: (empty) + 2: R_CURLY@191..194 "}" [Newline("\n"), Whitespace("\t")] [] + 2: R_CURLY@194..196 "}" [Newline("\n")] [] + 5: GRAPHQL_SELECTION_SET@196..233 + 0: L_CURLY@196..199 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@199..231 + 0: GRAPHQL_FIELD@199..231 + 0: GRAPHQL_ALIAS@199..211 + 0: GRAPHQL_NAME@199..209 + 0: GRAPHQL_NAME@199..209 "ironMan" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@209..211 ":" [] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_ARGUMENTS@211..231 + 0: L_PAREN@211..212 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@212..230 + 0: GRAPHQL_ARGUMENT@212..230 + 0: GRAPHQL_NAME@212..216 + 0: GRAPHQL_NAME@212..216 "name" [] [] + 1: COLON@216..218 ":" [] [Whitespace(" ")] + 2: GRAPHQL_STRING_VALUE@218..230 + 0: GRAPHQL_STRING_LITERAL@218..230 "\"Tony Stark\"" [] [] + 2: R_PAREN@230..231 ")" [] [] + 3: GRAPHQL_DIRECTIVE_LIST@231..231 + 4: (empty) + 2: R_CURLY@231..233 "}" [Newline("\n")] [] + 6: GRAPHQL_SELECTION_SET@233..325 + 0: L_CURLY@233..236 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@236..325 + 0: GRAPHQL_FIELD@236..325 + 0: GRAPHQL_ALIAS@236..248 + 0: GRAPHQL_NAME@236..246 + 0: GRAPHQL_NAME@236..246 "ironMan" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@246..248 ":" [] [Whitespace(" ")] + 1: GRAPHQL_NAME@248..252 + 0: GRAPHQL_NAME@248..252 "hero" [] [] + 2: GRAPHQL_ARGUMENTS@252..272 + 0: L_PAREN@252..253 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@253..272 + 0: GRAPHQL_ARGUMENT@253..272 + 0: GRAPHQL_NAME@253..257 + 0: GRAPHQL_NAME@253..257 "name" [] [] + 1: COLON@257..259 ":" [] [Whitespace(" ")] + 2: GRAPHQL_STRING_VALUE@259..272 + 0: GRAPHQL_STRING_LITERAL@259..272 "\"Tony Stark\"" [] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@272..272 + 4: GRAPHQL_SELECTION_SET@272..325 + 0: L_CURLY@272..273 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@273..323 + 0: GRAPHQL_FIELD@273..284 + 0: (empty) + 1: GRAPHQL_NAME@273..284 + 0: GRAPHQL_NAME@273..284 "country" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@284..284 + 4: (empty) + 1: GRAPHQL_FIELD@284..323 + 0: GRAPHQL_ALIAS@284..298 + 0: GRAPHQL_NAME@284..296 + 0: GRAPHQL_NAME@284..296 "firstWife" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@296..298 ":" [] [Whitespace(" ")] + 1: GRAPHQL_NAME@298..302 + 0: GRAPHQL_NAME@298..302 "wife" [] [] + 2: GRAPHQL_ARGUMENTS@302..318 + 0: L_PAREN@302..303 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@303..317 + 0: GRAPHQL_ARGUMENT@303..317 + 0: GRAPHQL_NAME@303..307 + 0: GRAPHQL_NAME@303..307 "name" [] [] + 1: COLON@307..309 ":" [] [Whitespace(" ")] + 2: GRAPHQL_STRING_VALUE@309..317 + 0: GRAPHQL_STRING_LITERAL@309..317 "\"Pepper\"" [] [] + 2: R_PAREN@317..318 ")" [] [] + 3: GRAPHQL_DIRECTIVE_LIST@318..318 + 4: GRAPHQL_SELECTION_SET@318..323 + 0: L_CURLY@318..319 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@319..319 + 2: R_CURLY@319..323 "}" [Newline("\n"), Whitespace("\t\t")] [] + 2: R_CURLY@323..325 "}" [Newline("\n")] [] + 2: (empty) + 7: GRAPHQL_SELECTION_SET@325..399 + 0: L_CURLY@325..328 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@328..397 + 0: GRAPHQL_FIELD@328..397 + 0: GRAPHQL_ALIAS@328..340 + 0: GRAPHQL_NAME@328..338 + 0: GRAPHQL_NAME@328..338 "ironMan" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@338..340 ":" [] [Whitespace(" ")] + 1: GRAPHQL_NAME@340..344 + 0: GRAPHQL_NAME@340..344 "hero" [] [] + 2: GRAPHQL_ARGUMENTS@344..365 + 0: L_PAREN@344..345 "(" [] [] + 1: GRAPHQL_ARGUMENT_LIST@345..363 + 0: GRAPHQL_ARGUMENT@345..363 + 0: GRAPHQL_NAME@345..349 + 0: GRAPHQL_NAME@345..349 "name" [] [] + 1: COLON@349..351 ":" [] [Whitespace(" ")] + 2: GRAPHQL_STRING_VALUE@351..363 + 0: GRAPHQL_STRING_LITERAL@351..363 "\"Tony Stark\"" [] [] + 2: R_PAREN@363..365 ")" [] [Whitespace(" ")] + 3: GRAPHQL_DIRECTIVE_LIST@365..366 + 0: GRAPHQL_DIRECTIVE@365..366 + 0: AT@365..366 "@" [] [] + 1: (empty) + 2: (empty) + 4: GRAPHQL_SELECTION_SET@366..397 + 0: L_CURLY@366..367 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@367..394 + 0: GRAPHQL_FIELD@367..388 + 0: (empty) + 1: GRAPHQL_NAME@367..378 + 0: GRAPHQL_NAME@367..378 "country" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@378..388 + 0: GRAPHQL_DIRECTIVE@378..388 + 0: AT@378..380 "@" [] [Skipped(",")] + 1: GRAPHQL_NAME@380..388 + 0: GRAPHQL_NAME@380..388 "name" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")] + 2: (empty) + 4: (empty) + 1: GRAPHQL_FIELD@388..394 + 0: (empty) + 1: GRAPHQL_NAME@388..394 + 0: GRAPHQL_NAME@388..394 "age" [Newline("\n"), Whitespace("\t\t")] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@394..394 + 4: (empty) + 2: R_CURLY@394..397 "}" [Newline("\n"), Whitespace("\t")] [] + 2: R_CURLY@397..399 "}" [Newline("\n")] [] + 8: GRAPHQL_SELECTION_SET@399..428 + 0: L_CURLY@399..420 "{" [Newline("\n"), Newline("\n"), Comments("# Fragment spread"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@420..428 + 0: GRAPHQL_INLINE_FRAGMENT@420..428 + 0: DOT3@420..426 "..." [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: GRAPHQL_DIRECTIVE_LIST@426..426 + 3: GRAPHQL_SELECTION_SET@426..428 + 0: (empty) + 1: GRAPHQL_SELECTION_LIST@426..426 + 2: R_CURLY@426..428 "}" [Newline("\n")] [] + 2: (empty) + 9: GRAPHQL_SELECTION_SET@428..451 + 0: L_CURLY@428..431 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@431..451 + 0: GRAPHQL_INLINE_FRAGMENT@431..451 + 0: DOT3@431..438 "..." [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_DIRECTIVE_LIST@438..449 + 0: GRAPHQL_DIRECTIVE@438..449 + 0: AT@438..439 "@" [] [] + 1: GRAPHQL_NAME@439..449 + 0: GRAPHQL_NAME@439..449 "deprecated" [] [] + 2: (empty) + 3: GRAPHQL_SELECTION_SET@449..451 + 0: (empty) + 1: GRAPHQL_SELECTION_LIST@449..449 + 2: R_CURLY@449..451 "}" [Newline("\n")] [] + 2: (empty) + 10: GRAPHQL_SELECTION_SET@451..497 + 0: L_CURLY@451..454 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@454..497 + 0: GRAPHQL_BOGUS_SELECTION@454..497 + 0: GRAPHQL_ALIAS@454..466 + 0: GRAPHQL_NAME@454..464 + 0: GRAPHQL_NAME@454..464 "ironMan" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@464..466 ":" [] [Whitespace(" ")] + 1: GRAPHQL_BOGUS@466..483 + 0: L_PAREN@466..467 "(" [] [] + 1: GRAPHQL_BOGUS@467..481 + 0: GRAPHQL_BOGUS@467..481 + 0: COLON@467..469 ":" [] [Whitespace(" ")] + 1: GRAPHQL_STRING_LITERAL@469..481 "\"Tony Stark\"" [] [] + 2: R_PAREN@481..483 ")" [] [Whitespace(" ")] + 2: GRAPHQL_DIRECTIVE_LIST@483..485 + 0: GRAPHQL_DIRECTIVE@483..485 + 0: AT@483..485 "@" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: GRAPHQL_SELECTION_SET@485..497 + 0: L_CURLY@485..486 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@486..495 + 0: GRAPHQL_INLINE_FRAGMENT@486..495 + 0: DOT3@486..492 "..." [Newline("\n"), Whitespace("\t\t")] [] + 1: (empty) + 2: GRAPHQL_DIRECTIVE_LIST@492..492 + 3: GRAPHQL_SELECTION_SET@492..495 + 0: (empty) + 1: GRAPHQL_SELECTION_LIST@492..492 + 2: R_CURLY@492..495 "}" [Newline("\n"), Whitespace("\t")] [] + 2: R_CURLY@495..497 "}" [Newline("\n")] [] + 2: (empty) + 11: GRAPHQL_SELECTION_SET@497..517 + 0: L_CURLY@497..500 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@500..517 + 0: GRAPHQL_INLINE_FRAGMENT@500..517 + 0: DOT3@500..507 "..." [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_DIRECTIVE_LIST@507..507 + 3: GRAPHQL_SELECTION_SET@507..517 + 0: L_CURLY@507..508 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@508..515 + 0: GRAPHQL_FIELD@508..515 + 0: (empty) + 1: GRAPHQL_NAME@508..515 + 0: GRAPHQL_NAME@508..515 "hero" [Newline("\n"), Whitespace("\t\t")] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@515..515 + 4: (empty) + 2: R_CURLY@515..517 "}" [Newline("\n")] [] + 2: (empty) + 12: GRAPHQL_SELECTION_SET@517..540 + 0: L_CURLY@517..520 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@520..538 + 0: GRAPHQL_INLINE_FRAGMENT@520..538 + 0: DOT3@520..527 "..." [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: GRAPHQL_DIRECTIVE_LIST@527..535 + 0: GRAPHQL_DIRECTIVE@527..535 + 0: AT@527..528 "@" [] [] + 1: GRAPHQL_NAME@528..535 + 0: GRAPHQL_NAME@528..535 "hero" [Newline("\n"), Whitespace("\t\t")] [] + 2: (empty) + 3: GRAPHQL_SELECTION_SET@535..538 + 0: (empty) + 1: GRAPHQL_SELECTION_LIST@535..535 + 2: R_CURLY@535..538 "}" [Newline("\n"), Whitespace("\t")] [] + 2: R_CURLY@538..540 "}" [Newline("\n")] [] + 13: GRAPHQL_SELECTION_SET@540..557 + 0: L_CURLY@540..543 "{" [Newline("\n"), Newline("\n")] [] + 1: GRAPHQL_SELECTION_LIST@543..557 + 0: GRAPHQL_FRAGMENT_SPREAD@543..557 + 0: DOT3@543..550 "..." [Newline("\n"), Whitespace("\t")] [Whitespace(" ")] + 1: GRAPHQL_NAME@550..555 + 0: GRAPHQL_NAME@550..555 "Hero" [] [Whitespace(" ")] + 2: GRAPHQL_DIRECTIVE_LIST@555..557 + 0: GRAPHQL_DIRECTIVE@555..557 + 0: AT@555..557 "@" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 2: (empty) + 14: GRAPHQL_SELECTION_SET@557..575 + 0: L_CURLY@557..558 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@558..572 + 0: GRAPHQL_FIELD@558..566 + 0: (empty) + 1: GRAPHQL_NAME@558..566 + 0: GRAPHQL_NAME@558..566 "name" [Newline("\n"), Whitespace("\t\t")] [Skipped(",")] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@566..566 + 4: (empty) + 1: GRAPHQL_FIELD@566..572 + 0: (empty) + 1: GRAPHQL_NAME@566..572 + 0: GRAPHQL_NAME@566..572 "age" [Newline("\n"), Whitespace("\t\t")] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@572..572 + 4: (empty) + 2: R_CURLY@572..575 "}" [Newline("\n"), Whitespace("\t")] [] + 15: GRAPHQL_BOGUS_DEFINITION@575..577 + 0: R_CURLY@575..577 "}" [Newline("\n")] [] + 2: EOF@577..578 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +selection_set.graphql:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `{` + + 6 │ } + 7 │ + > 8 │ { + │ ^ + 9 │ hero(name: "Tony Stark" + 10 │ } + + i Remove { + +selection_set.graphql:10:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `}` + + 8 │ { + 9 │ hero(name: "Tony Stark" + > 10 │ } + │ ^ + 11 │ + 12 │ { + + i Remove } + +selection_set.graphql:13:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `"Tony Stark"` + + 12 │ { + > 13 │ hero(name "Tony Stark") + │ ^^^^^^^^^^^^ + 14 │ country, + 15 │ name, + + i Remove "Tony Stark" + +selection_set.graphql:18:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a definition but instead found '}'. + + 16 │ age + 17 │ } + > 18 │ } + │ ^ + 19 │ + 20 │ { + + i Expected a definition here. + + 16 │ age + 17 │ } + > 18 │ } + │ ^ + 19 │ + 20 │ { + +selection_set.graphql:25:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `FOOT` + + 23 │ name, + 24 │ age, + > 25 │ height(unit FOOT, + │ ^^^^ + 26 │ } + 27 │ } + + i Remove FOOT + +selection_set.graphql:26:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `}` + + 24 │ age, + 25 │ height(unit FOOT, + > 26 │ } + │ ^ + 27 │ } + 28 │ + + i Remove } + +selection_set.graphql:30:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '('. + + 29 │ { + > 30 │ ironMan: (name: "Tony Stark") + │ ^ + 31 │ } + 32 │ + + i Expected a name here. + + 29 │ { + > 30 │ ironMan: (name: "Tony Stark") + │ ^ + 31 │ } + 32 │ + +selection_set.graphql:34:36 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `{` + + 33 │ { + > 34 │ ironMan: hero(name: "Tony Stark" { + │ ^ + 35 │ country, + 36 │ firstWife: wife(name: "Pepper"){ + + i Remove { + +selection_set.graphql:40:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `{` + + 38 │ } + 39 │ + > 40 │ { + │ ^ + 41 │ ironMan: hero(name: "Tony Stark") @{ + 42 │ country @, + + i Remove { + +selection_set.graphql:41:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '{'. + + 40 │ { + > 41 │ ironMan: hero(name: "Tony Stark") @{ + │ ^ + 42 │ country @, + 43 │ name, + + i Expected a name here. + + 40 │ { + > 41 │ ironMan: hero(name: "Tony Stark") @{ + │ ^ + 42 │ country @, + 43 │ name, + +selection_set.graphql:51:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `}` + + 49 │ { + 50 │ ... + > 51 │ } + │ ^ + 52 │ + 53 │ { + + i Remove } + +selection_set.graphql:53:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `{` + + 51 │ } + 52 │ + > 53 │ { + │ ^ + 54 │ ... @deprecated + 55 │ } + + i Remove { + +selection_set.graphql:55:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `}` + + 53 │ { + 54 │ ... @deprecated + > 55 │ } + │ ^ + 56 │ + 57 │ { + + i Remove } + +selection_set.graphql:57:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `{` + + 55 │ } + 56 │ + > 57 │ { + │ ^ + 58 │ ironMan: (: "Tony Stark") @ { + 59 │ ... + + i Remove { + +selection_set.graphql:58:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '('. + + 57 │ { + > 58 │ ironMan: (: "Tony Stark") @ { + │ ^ + 59 │ ... + 60 │ } + + i Expected a name here. + + 57 │ { + > 58 │ ironMan: (: "Tony Stark") @ { + │ ^ + 59 │ ... + 60 │ } + +selection_set.graphql:58:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an argument but instead found ': "Tony Stark"'. + + 57 │ { + > 58 │ ironMan: (: "Tony Stark") @ { + │ ^^^^^^^^^^^^^^ + 59 │ ... + 60 │ } + + i Expected an argument here. + + 57 │ { + > 58 │ ironMan: (: "Tony Stark") @ { + │ ^^^^^^^^^^^^^^ + 59 │ ... + 60 │ } + +selection_set.graphql:58:31 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '{'. + + 57 │ { + > 58 │ ironMan: (: "Tony Stark") @ { + │ ^ + 59 │ ... + 60 │ } + + i Expected a name here. + + 57 │ { + > 58 │ ironMan: (: "Tony Stark") @ { + │ ^ + 59 │ ... + 60 │ } + +selection_set.graphql:60:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `}` + + 58 │ ironMan: (: "Tony Stark") @ { + 59 │ ... + > 60 │ } + │ ^ + 61 │ } + 62 │ + + i Remove } + +selection_set.graphql:63:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `{` + + 61 │ } + 62 │ + > 63 │ { + │ ^ + 64 │ ... { + 65 │ hero + + i Remove { + +selection_set.graphql:68:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `{` + + 66 │ } + 67 │ + > 68 │ { + │ ^ + 69 │ ... @ + 70 │ hero + + i Remove { + +selection_set.graphql:71:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `}` + + 69 │ ... @ + 70 │ hero + > 71 │ } + │ ^ + 72 │ } + 73 │ + + i Remove } + +selection_set.graphql:75:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found '{'. + + 74 │ { + > 75 │ ... Hero @ { + │ ^ + 76 │ name, + 77 │ age + + i Expected a name here. + + 74 │ { + > 75 │ ... Hero @ { + │ ^ + 76 │ name, + 77 │ age + +selection_set.graphql:79:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a definition but instead found '}'. + + 77 │ age + 78 │ } + > 79 │ } + │ ^ + 80 │ + + i Expected a definition here. + + 77 │ age + 78 │ } + > 79 │ } + │ ^ + 80 │ + +``` diff --git a/crates/biome_graphql_parser/tests/graphql_test_suite/err/type.graphql b/crates/biome_graphql_parser/tests/graphql_test_suite/err/type.graphql new file mode 100644 index 000000000000..15e418428d79 --- /dev/null +++ b/crates/biome_graphql_parser/tests/graphql_test_suite/err/type.graphql @@ -0,0 +1,8 @@ +query ($storyId: !, $comments: [!], $tags: [!]!, $posts: PostInput]!, $input: [InputType!) { + likeStory +} + +query ($storyId: ![, $comments: !], $tags: [[[) { + likeStory +} + diff --git a/crates/biome_graphql_parser/tests/graphql_test_suite/err/type.graphql.snap b/crates/biome_graphql_parser/tests/graphql_test_suite/err/type.graphql.snap new file mode 100644 index 000000000000..15f227f39a4c --- /dev/null +++ b/crates/biome_graphql_parser/tests/graphql_test_suite/err/type.graphql.snap @@ -0,0 +1,560 @@ +--- +source: crates/biome_graphql_parser/tests/spec_test.rs +expression: snapshot +--- +## Input +```graphql +query ($storyId: !, $comments: [!], $tags: [!]!, $posts: PostInput]!, $input: [InputType!) { + likeStory +} + +query ($storyId: ![, $comments: !], $tags: [[[) { + likeStory +} + + +``` + +## AST + +``` +GraphqlRoot { + bom_token: missing (optional), + definitions: GraphqlDefinitionList [ + GraphqlBogusDefinition { + items: [ + GraphqlOperationType { + value_token: QUERY_KW@0..6 "query" [] [Whitespace(" ")], + }, + GraphqlBogus { + items: [ + L_PAREN@6..7 "(" [] [], + GraphqlBogus { + items: [ + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@7..8 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@8..15 "storyId" [] [], + }, + }, + colon_token: COLON@15..17 ":" [] [Whitespace(" ")], + ty: GraphqlNonNullType { + base: missing (required), + excl_token: BANG@17..20 "!" [] [Skipped(","), Whitespace(" ")], + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@20..21 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@21..29 "comments" [] [], + }, + }, + colon_token: COLON@29..31 ":" [] [Whitespace(" ")], + ty: GraphqlListType { + l_brack_token: L_BRACK@31..32 "[" [] [], + element: GraphqlNonNullType { + base: missing (required), + excl_token: BANG@32..33 "!" [] [], + }, + r_brack_token: R_BRACK@33..36 "]" [] [Skipped(","), Whitespace(" ")], + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@36..37 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@37..41 "tags" [] [], + }, + }, + colon_token: COLON@41..43 ":" [] [Whitespace(" ")], + ty: GraphqlNonNullType { + base: GraphqlListType { + l_brack_token: L_BRACK@43..44 "[" [] [], + element: GraphqlNonNullType { + base: missing (required), + excl_token: BANG@44..45 "!" [] [], + }, + r_brack_token: R_BRACK@45..46 "]" [] [], + }, + excl_token: BANG@46..49 "!" [] [Skipped(","), Whitespace(" ")], + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@49..50 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@50..55 "posts" [] [], + }, + }, + colon_token: COLON@55..57 ":" [] [Whitespace(" ")], + ty: GraphqlNamedType { + name: GraphqlName { + value_token: GRAPHQL_NAME@57..66 "PostInput" [] [], + }, + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + GraphqlBogus { + items: [ + R_BRACK@66..67 "]" [] [], + BANG@67..70 "!" [] [Skipped(","), Whitespace(" ")], + ], + }, + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@70..71 "$" [] [], + name: missing (required), + }, + colon_token: missing (required), + ty: missing (required), + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + GraphqlBogus { + items: [ + INPUT_KW@71..76 "input" [] [], + COLON@76..78 ":" [] [Whitespace(" ")], + L_BRACK@78..79 "[" [] [], + GRAPHQL_NAME@79..88 "InputType" [] [], + BANG@88..89 "!" [] [], + ], + }, + ], + }, + R_PAREN@89..91 ")" [] [Whitespace(" ")], + ], + }, + GraphqlDirectiveList [], + GraphqlSelectionSet { + l_curly_token: L_CURLY@91..92 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@92..103 "likeStory" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@103..105 "}" [Newline("\n")] [], + }, + ], + }, + GraphqlBogusDefinition { + items: [ + GraphqlOperationType { + value_token: QUERY_KW@105..113 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + }, + GraphqlBogus { + items: [ + L_PAREN@113..114 "(" [] [], + GraphqlBogus { + items: [ + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@114..115 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@115..122 "storyId" [] [], + }, + }, + colon_token: COLON@122..124 ":" [] [Whitespace(" ")], + ty: GraphqlNonNullType { + base: missing (required), + excl_token: BANG@124..125 "!" [] [], + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + GraphqlBogus { + items: [ + L_BRACK@125..128 "[" [] [Skipped(","), Whitespace(" ")], + ], + }, + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@128..129 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@129..137 "comments" [] [], + }, + }, + colon_token: COLON@137..139 ":" [] [Whitespace(" ")], + ty: GraphqlNonNullType { + base: missing (required), + excl_token: BANG@139..140 "!" [] [], + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + GraphqlBogus { + items: [ + R_BRACK@140..143 "]" [] [Skipped(","), Whitespace(" ")], + ], + }, + GraphqlVariableDefinition { + variable: GraphqlVariable { + dollar_token: DOLLAR@143..144 "$" [] [], + name: GraphqlName { + value_token: GRAPHQL_NAME@144..148 "tags" [] [], + }, + }, + colon_token: COLON@148..150 ":" [] [Whitespace(" ")], + ty: GraphqlListType { + l_brack_token: L_BRACK@150..151 "[" [] [], + element: GraphqlListType { + l_brack_token: L_BRACK@151..152 "[" [] [], + element: GraphqlListType { + l_brack_token: L_BRACK@152..153 "[" [] [], + element: missing (required), + r_brack_token: missing (required), + }, + r_brack_token: missing (required), + }, + r_brack_token: missing (required), + }, + default: missing (optional), + directives: GraphqlDirectiveList [], + }, + ], + }, + R_PAREN@153..155 ")" [] [Whitespace(" ")], + ], + }, + GraphqlDirectiveList [], + GraphqlSelectionSet { + l_curly_token: L_CURLY@155..156 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlField { + alias: missing (optional), + name: GraphqlName { + value_token: GRAPHQL_NAME@156..167 "likeStory" [Newline("\n"), Whitespace("\t")] [], + }, + arguments: missing (optional), + directives: GraphqlDirectiveList [], + selection_set: missing (optional), + }, + ], + r_curly_token: R_CURLY@167..169 "}" [Newline("\n")] [], + }, + ], + }, + ], + eof_token: EOF@169..171 "" [Newline("\n"), Newline("\n")] [], +} +``` + +## CST + +``` +0: GRAPHQL_ROOT@0..171 + 0: (empty) + 1: GRAPHQL_DEFINITION_LIST@0..169 + 0: GRAPHQL_BOGUS_DEFINITION@0..105 + 0: GRAPHQL_OPERATION_TYPE@0..6 + 0: QUERY_KW@0..6 "query" [] [Whitespace(" ")] + 1: GRAPHQL_BOGUS@6..91 + 0: L_PAREN@6..7 "(" [] [] + 1: GRAPHQL_BOGUS@7..89 + 0: GRAPHQL_VARIABLE_DEFINITION@7..20 + 0: GRAPHQL_VARIABLE@7..15 + 0: DOLLAR@7..8 "$" [] [] + 1: GRAPHQL_NAME@8..15 + 0: GRAPHQL_NAME@8..15 "storyId" [] [] + 1: COLON@15..17 ":" [] [Whitespace(" ")] + 2: GRAPHQL_NON_NULL_TYPE@17..20 + 0: (empty) + 1: BANG@17..20 "!" [] [Skipped(","), Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@20..20 + 1: GRAPHQL_VARIABLE_DEFINITION@20..36 + 0: GRAPHQL_VARIABLE@20..29 + 0: DOLLAR@20..21 "$" [] [] + 1: GRAPHQL_NAME@21..29 + 0: GRAPHQL_NAME@21..29 "comments" [] [] + 1: COLON@29..31 ":" [] [Whitespace(" ")] + 2: GRAPHQL_LIST_TYPE@31..36 + 0: L_BRACK@31..32 "[" [] [] + 1: GRAPHQL_NON_NULL_TYPE@32..33 + 0: (empty) + 1: BANG@32..33 "!" [] [] + 2: R_BRACK@33..36 "]" [] [Skipped(","), Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@36..36 + 2: GRAPHQL_VARIABLE_DEFINITION@36..49 + 0: GRAPHQL_VARIABLE@36..41 + 0: DOLLAR@36..37 "$" [] [] + 1: GRAPHQL_NAME@37..41 + 0: GRAPHQL_NAME@37..41 "tags" [] [] + 1: COLON@41..43 ":" [] [Whitespace(" ")] + 2: GRAPHQL_NON_NULL_TYPE@43..49 + 0: GRAPHQL_LIST_TYPE@43..46 + 0: L_BRACK@43..44 "[" [] [] + 1: GRAPHQL_NON_NULL_TYPE@44..45 + 0: (empty) + 1: BANG@44..45 "!" [] [] + 2: R_BRACK@45..46 "]" [] [] + 1: BANG@46..49 "!" [] [Skipped(","), Whitespace(" ")] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@49..49 + 3: GRAPHQL_VARIABLE_DEFINITION@49..66 + 0: GRAPHQL_VARIABLE@49..55 + 0: DOLLAR@49..50 "$" [] [] + 1: GRAPHQL_NAME@50..55 + 0: GRAPHQL_NAME@50..55 "posts" [] [] + 1: COLON@55..57 ":" [] [Whitespace(" ")] + 2: GRAPHQL_NAMED_TYPE@57..66 + 0: GRAPHQL_NAME@57..66 + 0: GRAPHQL_NAME@57..66 "PostInput" [] [] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@66..66 + 4: GRAPHQL_BOGUS@66..70 + 0: R_BRACK@66..67 "]" [] [] + 1: BANG@67..70 "!" [] [Skipped(","), Whitespace(" ")] + 5: GRAPHQL_VARIABLE_DEFINITION@70..71 + 0: GRAPHQL_VARIABLE@70..71 + 0: DOLLAR@70..71 "$" [] [] + 1: (empty) + 1: (empty) + 2: (empty) + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@71..71 + 6: GRAPHQL_BOGUS@71..89 + 0: INPUT_KW@71..76 "input" [] [] + 1: COLON@76..78 ":" [] [Whitespace(" ")] + 2: L_BRACK@78..79 "[" [] [] + 3: GRAPHQL_NAME@79..88 "InputType" [] [] + 4: BANG@88..89 "!" [] [] + 2: R_PAREN@89..91 ")" [] [Whitespace(" ")] + 2: GRAPHQL_DIRECTIVE_LIST@91..91 + 3: GRAPHQL_SELECTION_SET@91..105 + 0: L_CURLY@91..92 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@92..103 + 0: GRAPHQL_FIELD@92..103 + 0: (empty) + 1: GRAPHQL_NAME@92..103 + 0: GRAPHQL_NAME@92..103 "likeStory" [Newline("\n"), Whitespace("\t")] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@103..103 + 4: (empty) + 2: R_CURLY@103..105 "}" [Newline("\n")] [] + 1: GRAPHQL_BOGUS_DEFINITION@105..169 + 0: GRAPHQL_OPERATION_TYPE@105..113 + 0: QUERY_KW@105..113 "query" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: GRAPHQL_BOGUS@113..155 + 0: L_PAREN@113..114 "(" [] [] + 1: GRAPHQL_BOGUS@114..153 + 0: GRAPHQL_VARIABLE_DEFINITION@114..125 + 0: GRAPHQL_VARIABLE@114..122 + 0: DOLLAR@114..115 "$" [] [] + 1: GRAPHQL_NAME@115..122 + 0: GRAPHQL_NAME@115..122 "storyId" [] [] + 1: COLON@122..124 ":" [] [Whitespace(" ")] + 2: GRAPHQL_NON_NULL_TYPE@124..125 + 0: (empty) + 1: BANG@124..125 "!" [] [] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@125..125 + 1: GRAPHQL_BOGUS@125..128 + 0: L_BRACK@125..128 "[" [] [Skipped(","), Whitespace(" ")] + 2: GRAPHQL_VARIABLE_DEFINITION@128..140 + 0: GRAPHQL_VARIABLE@128..137 + 0: DOLLAR@128..129 "$" [] [] + 1: GRAPHQL_NAME@129..137 + 0: GRAPHQL_NAME@129..137 "comments" [] [] + 1: COLON@137..139 ":" [] [Whitespace(" ")] + 2: GRAPHQL_NON_NULL_TYPE@139..140 + 0: (empty) + 1: BANG@139..140 "!" [] [] + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@140..140 + 3: GRAPHQL_BOGUS@140..143 + 0: R_BRACK@140..143 "]" [] [Skipped(","), Whitespace(" ")] + 4: GRAPHQL_VARIABLE_DEFINITION@143..153 + 0: GRAPHQL_VARIABLE@143..148 + 0: DOLLAR@143..144 "$" [] [] + 1: GRAPHQL_NAME@144..148 + 0: GRAPHQL_NAME@144..148 "tags" [] [] + 1: COLON@148..150 ":" [] [Whitespace(" ")] + 2: GRAPHQL_LIST_TYPE@150..153 + 0: L_BRACK@150..151 "[" [] [] + 1: GRAPHQL_LIST_TYPE@151..153 + 0: L_BRACK@151..152 "[" [] [] + 1: GRAPHQL_LIST_TYPE@152..153 + 0: L_BRACK@152..153 "[" [] [] + 1: (empty) + 2: (empty) + 2: (empty) + 2: (empty) + 3: (empty) + 4: GRAPHQL_DIRECTIVE_LIST@153..153 + 2: R_PAREN@153..155 ")" [] [Whitespace(" ")] + 2: GRAPHQL_DIRECTIVE_LIST@155..155 + 3: GRAPHQL_SELECTION_SET@155..169 + 0: L_CURLY@155..156 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@156..167 + 0: GRAPHQL_FIELD@156..167 + 0: (empty) + 1: GRAPHQL_NAME@156..167 + 0: GRAPHQL_NAME@156..167 "likeStory" [Newline("\n"), Whitespace("\t")] [] + 2: (empty) + 3: GRAPHQL_DIRECTIVE_LIST@167..167 + 4: (empty) + 2: R_CURLY@167..169 "}" [Newline("\n")] [] + 2: EOF@169..171 "" [Newline("\n"), Newline("\n")] [] + +``` + +## Diagnostics + +``` +type.graphql:1:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a named type, or a list type but instead found '$'. + + > 1 │ query ($storyId: !, $comments: [!], $tags: [!]!, $posts: PostInput]!, $input: [InputType!) { + │ ^ + 2 │ likeStory + 3 │ } + + i Expected a named type, or a list type here. + + > 1 │ query ($storyId: !, $comments: [!], $tags: [!]!, $posts: PostInput]!, $input: [InputType!) { + │ ^ + 2 │ likeStory + 3 │ } + +type.graphql:1:34 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a named type, or a list type but instead found ']'. + + > 1 │ query ($storyId: !, $comments: [!], $tags: [!]!, $posts: PostInput]!, $input: [InputType!) { + │ ^ + 2 │ likeStory + 3 │ } + + i Expected a named type, or a list type here. + + > 1 │ query ($storyId: !, $comments: [!], $tags: [!]!, $posts: PostInput]!, $input: [InputType!) { + │ ^ + 2 │ likeStory + 3 │ } + +type.graphql:1:46 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a named type, or a list type but instead found ']'. + + > 1 │ query ($storyId: !, $comments: [!], $tags: [!]!, $posts: PostInput]!, $input: [InputType!) { + │ ^ + 2 │ likeStory + 3 │ } + + i Expected a named type, or a list type here. + + > 1 │ query ($storyId: !, $comments: [!], $tags: [!]!, $posts: PostInput]!, $input: [InputType!) { + │ ^ + 2 │ likeStory + 3 │ } + +type.graphql:1:67 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a variable definition but instead found ']!'. + + > 1 │ query ($storyId: !, $comments: [!], $tags: [!]!, $posts: PostInput]!, $input: [InputType!) { + │ ^^ + 2 │ likeStory + 3 │ } + + i Expected a variable definition here. + + > 1 │ query ($storyId: !, $comments: [!], $tags: [!]!, $posts: PostInput]!, $input: [InputType!) { + │ ^^ + 2 │ likeStory + 3 │ } + +type.graphql:1:72 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a name but instead found 'input'. + + > 1 │ query ($storyId: !, $comments: [!], $tags: [!]!, $posts: PostInput]!, $input: [InputType!) { + │ ^^^^^ + 2 │ likeStory + 3 │ } + + i Expected a name here. + + > 1 │ query ($storyId: !, $comments: [!], $tags: [!]!, $posts: PostInput]!, $input: [InputType!) { + │ ^^^^^ + 2 │ likeStory + 3 │ } + +type.graphql:5:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a named type, or a list type but instead found '['. + + 3 │ } + 4 │ + > 5 │ query ($storyId: ![, $comments: !], $tags: [[[) { + │ ^ + 6 │ likeStory + 7 │ } + + i Expected a named type, or a list type here. + + 3 │ } + 4 │ + > 5 │ query ($storyId: ![, $comments: !], $tags: [[[) { + │ ^ + 6 │ likeStory + 7 │ } + +type.graphql:5:34 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a named type, or a list type but instead found ']'. + + 3 │ } + 4 │ + > 5 │ query ($storyId: ![, $comments: !], $tags: [[[) { + │ ^ + 6 │ likeStory + 7 │ } + + i Expected a named type, or a list type here. + + 3 │ } + 4 │ + > 5 │ query ($storyId: ![, $comments: !], $tags: [[[) { + │ ^ + 6 │ likeStory + 7 │ } + +type.graphql:5:47 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type but instead found ')'. + + 3 │ } + 4 │ + > 5 │ query ($storyId: ![, $comments: !], $tags: [[[) { + │ ^ + 6 │ likeStory + 7 │ } + + i Expected a type here. + + 3 │ } + 4 │ + > 5 │ query ($storyId: ![, $comments: !], $tags: [[[) { + │ ^ + 6 │ likeStory + 7 │ } + +``` diff --git a/crates/biome_graphql_parser/tests/graphql_test_suite/err/value.graphql b/crates/biome_graphql_parser/tests/graphql_test_suite/err/value.graphql new file mode 100644 index 000000000000..2dd36a1f5f9c --- /dev/null +++ b/crates/biome_graphql_parser/tests/graphql_test_suite/err/value.graphql @@ -0,0 +1,18 @@ +{ + field_value( + float_value: 1.1.1, + string_value: "string""", + string_value: "string, + boolean_value: truee, + null_value: nulll, + enum_value: ENUM, + list_value: [1, 2, 3, + list_value: 1, 2, 3, + list_value: 1, 2, 3], + object_value: {key: "value" + object_value: {key:} + object_value: {key} + object_value: key} + object_value: { + ) +} diff --git a/crates/biome_graphql_parser/tests/graphql_test_suite/err/value.graphql.snap b/crates/biome_graphql_parser/tests/graphql_test_suite/err/value.graphql.snap new file mode 100644 index 000000000000..325df280e448 --- /dev/null +++ b/crates/biome_graphql_parser/tests/graphql_test_suite/err/value.graphql.snap @@ -0,0 +1,605 @@ +--- +source: crates/biome_graphql_parser/tests/spec_test.rs +expression: snapshot +--- +## Input +```graphql +{ + field_value( + float_value: 1.1.1, + string_value: "string""", + string_value: "string, + boolean_value: truee, + null_value: nulll, + enum_value: ENUM, + list_value: [1, 2, 3, + list_value: 1, 2, 3, + list_value: 1, 2, 3], + object_value: {key: "value" + object_value: {key:} + object_value: {key} + object_value: key} + object_value: { + ) +} + +``` + +## AST + +``` +GraphqlRoot { + bom_token: missing (optional), + definitions: GraphqlDefinitionList [ + GraphqlSelectionSet { + l_curly_token: L_CURLY@0..1 "{" [] [], + selections: GraphqlSelectionList [ + GraphqlBogusSelection { + items: [ + GraphqlName { + value_token: GRAPHQL_NAME@1..14 "field_value" [Newline("\n"), Whitespace("\t")] [], + }, + GraphqlBogus { + items: [ + L_PAREN@14..15 "(" [] [], + GraphqlBogus { + items: [ + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@15..29 "float_value" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@29..31 ":" [] [Whitespace(" ")], + value: missing (required), + }, + GraphqlBogus { + items: [ + ERROR_TOKEN@31..37 "1.1.1" [] [Skipped(",")], + ], + }, + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@37..52 "string_value" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@52..54 ":" [] [Whitespace(" ")], + value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@54..62 "\"string\"" [] [], + }, + }, + GraphqlBogus { + items: [ + GRAPHQL_STRING_LITERAL@62..65 "\"\"" [] [Skipped(",")], + ], + }, + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@65..80 "string_value" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@80..82 ":" [] [Whitespace(" ")], + value: missing (required), + }, + GraphqlBogus { + items: [ + ERROR_TOKEN@82..90 "\"string," [] [], + ], + }, + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@90..106 "boolean_value" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@106..108 ":" [] [Whitespace(" ")], + value: GraphqlEnumValue { + graphql_name: GraphqlName { + value_token: GRAPHQL_NAME@108..114 "truee" [] [Skipped(",")], + }, + }, + }, + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@114..127 "null_value" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@127..129 ":" [] [Whitespace(" ")], + value: GraphqlEnumValue { + graphql_name: GraphqlName { + value_token: GRAPHQL_NAME@129..135 "nulll" [] [Skipped(",")], + }, + }, + }, + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@135..148 "enum_value" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@148..150 ":" [] [Whitespace(" ")], + value: missing (required), + }, + GraphqlBogus { + items: [ + UPPER_ENUM_KW@150..155 "ENUM" [] [Skipped(",")], + ], + }, + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@155..168 "list_value" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@168..170 ":" [] [Whitespace(" ")], + value: GraphqlListValue { + l_brack_token: L_BRACK@170..171 "[" [] [], + elements: GraphqlListValueElementList [ + GraphqlIntValue { + graphql_int_literal_token: GRAPHQL_INT_LITERAL@171..174 "1" [] [Skipped(","), Whitespace(" ")], + }, + GraphqlIntValue { + graphql_int_literal_token: GRAPHQL_INT_LITERAL@174..177 "2" [] [Skipped(","), Whitespace(" ")], + }, + GraphqlIntValue { + graphql_int_literal_token: GRAPHQL_INT_LITERAL@177..179 "3" [] [Skipped(",")], + }, + ], + r_brack_token: missing (required), + }, + }, + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@179..192 "list_value" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@192..194 ":" [] [Whitespace(" ")], + value: GraphqlIntValue { + graphql_int_literal_token: GRAPHQL_INT_LITERAL@194..197 "1" [] [Skipped(","), Whitespace(" ")], + }, + }, + GraphqlBogus { + items: [ + GRAPHQL_INT_LITERAL@197..200 "2" [] [Skipped(","), Whitespace(" ")], + GRAPHQL_INT_LITERAL@200..202 "3" [] [Skipped(",")], + ], + }, + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@202..215 "list_value" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@215..217 ":" [] [Whitespace(" ")], + value: GraphqlIntValue { + graphql_int_literal_token: GRAPHQL_INT_LITERAL@217..220 "1" [] [Skipped(","), Whitespace(" ")], + }, + }, + GraphqlBogus { + items: [ + GRAPHQL_INT_LITERAL@220..223 "2" [] [Skipped(","), Whitespace(" ")], + GRAPHQL_INT_LITERAL@223..224 "3" [] [], + R_BRACK@224..226 "]" [] [Skipped(",")], + ], + }, + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@226..241 "object_value" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@241..243 ":" [] [Whitespace(" ")], + value: GraphqlObjectValue { + l_curly_token: L_CURLY@243..244 "{" [] [], + members: GraphqlObjectValueMemberList [ + GraphqlObjectField { + name: GraphqlName { + value_token: GRAPHQL_NAME@244..247 "key" [] [], + }, + colon_token: COLON@247..249 ":" [] [Whitespace(" ")], + value: GraphqlStringValue { + graphql_string_literal_token: GRAPHQL_STRING_LITERAL@249..256 "\"value\"" [] [], + }, + }, + GraphqlObjectField { + name: GraphqlName { + value_token: GRAPHQL_NAME@256..271 "object_value" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@271..273 ":" [] [Whitespace(" ")], + value: GraphqlObjectValue { + l_curly_token: L_CURLY@273..274 "{" [] [], + members: GraphqlObjectValueMemberList [ + GraphqlObjectField { + name: GraphqlName { + value_token: GRAPHQL_NAME@274..277 "key" [] [], + }, + colon_token: COLON@277..278 ":" [] [], + value: missing (required), + }, + ], + r_curly_token: R_CURLY@278..279 "}" [] [], + }, + }, + GraphqlObjectField { + name: GraphqlName { + value_token: GRAPHQL_NAME@279..294 "object_value" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@294..296 ":" [] [Whitespace(" ")], + value: GraphqlObjectValue { + l_curly_token: L_CURLY@296..297 "{" [] [], + members: GraphqlObjectValueMemberList [ + GraphqlObjectField { + name: GraphqlName { + value_token: GRAPHQL_NAME@297..300 "key" [] [], + }, + colon_token: missing (required), + value: missing (required), + }, + ], + r_curly_token: R_CURLY@300..301 "}" [] [], + }, + }, + GraphqlObjectField { + name: GraphqlName { + value_token: GRAPHQL_NAME@301..316 "object_value" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@316..318 ":" [] [Whitespace(" ")], + value: GraphqlEnumValue { + graphql_name: GraphqlName { + value_token: GRAPHQL_NAME@318..321 "key" [] [], + }, + }, + }, + ], + r_curly_token: R_CURLY@321..322 "}" [] [], + }, + }, + GraphqlArgument { + name: GraphqlName { + value_token: GRAPHQL_NAME@322..337 "object_value" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@337..339 ":" [] [Whitespace(" ")], + value: GraphqlObjectValue { + l_curly_token: L_CURLY@339..340 "{" [] [], + members: GraphqlObjectValueMemberList [], + r_curly_token: missing (required), + }, + }, + ], + }, + R_PAREN@340..343 ")" [Newline("\n"), Whitespace("\t")] [], + ], + }, + GraphqlDirectiveList [], + ], + }, + ], + r_curly_token: R_CURLY@343..345 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@345..346 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: GRAPHQL_ROOT@0..346 + 0: (empty) + 1: GRAPHQL_DEFINITION_LIST@0..345 + 0: GRAPHQL_SELECTION_SET@0..345 + 0: L_CURLY@0..1 "{" [] [] + 1: GRAPHQL_SELECTION_LIST@1..343 + 0: GRAPHQL_BOGUS_SELECTION@1..343 + 0: GRAPHQL_NAME@1..14 + 0: GRAPHQL_NAME@1..14 "field_value" [Newline("\n"), Whitespace("\t")] [] + 1: GRAPHQL_BOGUS@14..343 + 0: L_PAREN@14..15 "(" [] [] + 1: GRAPHQL_BOGUS@15..340 + 0: GRAPHQL_ARGUMENT@15..31 + 0: GRAPHQL_NAME@15..29 + 0: GRAPHQL_NAME@15..29 "float_value" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@29..31 ":" [] [Whitespace(" ")] + 2: (empty) + 1: GRAPHQL_BOGUS@31..37 + 0: ERROR_TOKEN@31..37 "1.1.1" [] [Skipped(",")] + 2: GRAPHQL_ARGUMENT@37..62 + 0: GRAPHQL_NAME@37..52 + 0: GRAPHQL_NAME@37..52 "string_value" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@52..54 ":" [] [Whitespace(" ")] + 2: GRAPHQL_STRING_VALUE@54..62 + 0: GRAPHQL_STRING_LITERAL@54..62 "\"string\"" [] [] + 3: GRAPHQL_BOGUS@62..65 + 0: GRAPHQL_STRING_LITERAL@62..65 "\"\"" [] [Skipped(",")] + 4: GRAPHQL_ARGUMENT@65..82 + 0: GRAPHQL_NAME@65..80 + 0: GRAPHQL_NAME@65..80 "string_value" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@80..82 ":" [] [Whitespace(" ")] + 2: (empty) + 5: GRAPHQL_BOGUS@82..90 + 0: ERROR_TOKEN@82..90 "\"string," [] [] + 6: GRAPHQL_ARGUMENT@90..114 + 0: GRAPHQL_NAME@90..106 + 0: GRAPHQL_NAME@90..106 "boolean_value" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@106..108 ":" [] [Whitespace(" ")] + 2: GRAPHQL_ENUM_VALUE@108..114 + 0: GRAPHQL_NAME@108..114 + 0: GRAPHQL_NAME@108..114 "truee" [] [Skipped(",")] + 7: GRAPHQL_ARGUMENT@114..135 + 0: GRAPHQL_NAME@114..127 + 0: GRAPHQL_NAME@114..127 "null_value" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@127..129 ":" [] [Whitespace(" ")] + 2: GRAPHQL_ENUM_VALUE@129..135 + 0: GRAPHQL_NAME@129..135 + 0: GRAPHQL_NAME@129..135 "nulll" [] [Skipped(",")] + 8: GRAPHQL_ARGUMENT@135..150 + 0: GRAPHQL_NAME@135..148 + 0: GRAPHQL_NAME@135..148 "enum_value" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@148..150 ":" [] [Whitespace(" ")] + 2: (empty) + 9: GRAPHQL_BOGUS@150..155 + 0: UPPER_ENUM_KW@150..155 "ENUM" [] [Skipped(",")] + 10: GRAPHQL_ARGUMENT@155..179 + 0: GRAPHQL_NAME@155..168 + 0: GRAPHQL_NAME@155..168 "list_value" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@168..170 ":" [] [Whitespace(" ")] + 2: GRAPHQL_LIST_VALUE@170..179 + 0: L_BRACK@170..171 "[" [] [] + 1: GRAPHQL_LIST_VALUE_ELEMENT_LIST@171..179 + 0: GRAPHQL_INT_VALUE@171..174 + 0: GRAPHQL_INT_LITERAL@171..174 "1" [] [Skipped(","), Whitespace(" ")] + 1: GRAPHQL_INT_VALUE@174..177 + 0: GRAPHQL_INT_LITERAL@174..177 "2" [] [Skipped(","), Whitespace(" ")] + 2: GRAPHQL_INT_VALUE@177..179 + 0: GRAPHQL_INT_LITERAL@177..179 "3" [] [Skipped(",")] + 2: (empty) + 11: GRAPHQL_ARGUMENT@179..197 + 0: GRAPHQL_NAME@179..192 + 0: GRAPHQL_NAME@179..192 "list_value" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@192..194 ":" [] [Whitespace(" ")] + 2: GRAPHQL_INT_VALUE@194..197 + 0: GRAPHQL_INT_LITERAL@194..197 "1" [] [Skipped(","), Whitespace(" ")] + 12: GRAPHQL_BOGUS@197..202 + 0: GRAPHQL_INT_LITERAL@197..200 "2" [] [Skipped(","), Whitespace(" ")] + 1: GRAPHQL_INT_LITERAL@200..202 "3" [] [Skipped(",")] + 13: GRAPHQL_ARGUMENT@202..220 + 0: GRAPHQL_NAME@202..215 + 0: GRAPHQL_NAME@202..215 "list_value" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@215..217 ":" [] [Whitespace(" ")] + 2: GRAPHQL_INT_VALUE@217..220 + 0: GRAPHQL_INT_LITERAL@217..220 "1" [] [Skipped(","), Whitespace(" ")] + 14: GRAPHQL_BOGUS@220..226 + 0: GRAPHQL_INT_LITERAL@220..223 "2" [] [Skipped(","), Whitespace(" ")] + 1: GRAPHQL_INT_LITERAL@223..224 "3" [] [] + 2: R_BRACK@224..226 "]" [] [Skipped(",")] + 15: GRAPHQL_ARGUMENT@226..322 + 0: GRAPHQL_NAME@226..241 + 0: GRAPHQL_NAME@226..241 "object_value" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@241..243 ":" [] [Whitespace(" ")] + 2: GRAPHQL_OBJECT_VALUE@243..322 + 0: L_CURLY@243..244 "{" [] [] + 1: GRAPHQL_OBJECT_VALUE_MEMBER_LIST@244..321 + 0: GRAPHQL_OBJECT_FIELD@244..256 + 0: GRAPHQL_NAME@244..247 + 0: GRAPHQL_NAME@244..247 "key" [] [] + 1: COLON@247..249 ":" [] [Whitespace(" ")] + 2: GRAPHQL_STRING_VALUE@249..256 + 0: GRAPHQL_STRING_LITERAL@249..256 "\"value\"" [] [] + 1: GRAPHQL_OBJECT_FIELD@256..279 + 0: GRAPHQL_NAME@256..271 + 0: GRAPHQL_NAME@256..271 "object_value" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@271..273 ":" [] [Whitespace(" ")] + 2: GRAPHQL_OBJECT_VALUE@273..279 + 0: L_CURLY@273..274 "{" [] [] + 1: GRAPHQL_OBJECT_VALUE_MEMBER_LIST@274..278 + 0: GRAPHQL_OBJECT_FIELD@274..278 + 0: GRAPHQL_NAME@274..277 + 0: GRAPHQL_NAME@274..277 "key" [] [] + 1: COLON@277..278 ":" [] [] + 2: (empty) + 2: R_CURLY@278..279 "}" [] [] + 2: GRAPHQL_OBJECT_FIELD@279..301 + 0: GRAPHQL_NAME@279..294 + 0: GRAPHQL_NAME@279..294 "object_value" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@294..296 ":" [] [Whitespace(" ")] + 2: GRAPHQL_OBJECT_VALUE@296..301 + 0: L_CURLY@296..297 "{" [] [] + 1: GRAPHQL_OBJECT_VALUE_MEMBER_LIST@297..300 + 0: GRAPHQL_OBJECT_FIELD@297..300 + 0: GRAPHQL_NAME@297..300 + 0: GRAPHQL_NAME@297..300 "key" [] [] + 1: (empty) + 2: (empty) + 2: R_CURLY@300..301 "}" [] [] + 3: GRAPHQL_OBJECT_FIELD@301..321 + 0: GRAPHQL_NAME@301..316 + 0: GRAPHQL_NAME@301..316 "object_value" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@316..318 ":" [] [Whitespace(" ")] + 2: GRAPHQL_ENUM_VALUE@318..321 + 0: GRAPHQL_NAME@318..321 + 0: GRAPHQL_NAME@318..321 "key" [] [] + 2: R_CURLY@321..322 "}" [] [] + 16: GRAPHQL_ARGUMENT@322..340 + 0: GRAPHQL_NAME@322..337 + 0: GRAPHQL_NAME@322..337 "object_value" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@337..339 ":" [] [Whitespace(" ")] + 2: GRAPHQL_OBJECT_VALUE@339..340 + 0: L_CURLY@339..340 "{" [] [] + 1: GRAPHQL_OBJECT_VALUE_MEMBER_LIST@340..340 + 2: (empty) + 2: R_PAREN@340..343 ")" [Newline("\n"), Whitespace("\t")] [] + 2: GRAPHQL_DIRECTIVE_LIST@343..343 + 2: R_CURLY@343..345 "}" [Newline("\n")] [] + 2: EOF@345..346 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +value.graphql:3:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a value but instead found '1.1.1'. + + 1 │ { + 2 │ field_value( + > 3 │ float_value: 1.1.1, + │ ^^^^^ + 4 │ string_value: "string""", + 5 │ string_value: "string, + + i Expected a value here. + + 1 │ { + 2 │ field_value( + > 3 │ float_value: 1.1.1, + │ ^^^^^ + 4 │ string_value: "string""", + 5 │ string_value: "string, + +value.graphql:3:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid fraction part + + 1 │ { + 2 │ field_value( + > 3 │ float_value: 1.1.1, + │ ^ + 4 │ string_value: "string""", + 5 │ string_value: "string, + +value.graphql:4:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an argument but instead found '""'. + + 2 │ field_value( + 3 │ float_value: 1.1.1, + > 4 │ string_value: "string""", + │ ^^ + 5 │ string_value: "string, + 6 │ boolean_value: truee, + + i Expected an argument here. + + 2 │ field_value( + 3 │ float_value: 1.1.1, + > 4 │ string_value: "string""", + │ ^^ + 5 │ string_value: "string, + 6 │ boolean_value: truee, + +value.graphql:5:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Missing closing quote + + 3 │ float_value: 1.1.1, + 4 │ string_value: "string""", + > 5 │ string_value: "string, + │ ^^^^^^^^ + 6 │ boolean_value: truee, + 7 │ null_value: nulll, + +value.graphql:8:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a value but instead found 'ENUM'. + + 6 │ boolean_value: truee, + 7 │ null_value: nulll, + > 8 │ enum_value: ENUM, + │ ^^^^ + 9 │ list_value: [1, 2, 3, + 10 │ list_value: 1, 2, 3, + + i Expected a value here. + + 6 │ boolean_value: truee, + 7 │ null_value: nulll, + > 8 │ enum_value: ENUM, + │ ^^^^ + 9 │ list_value: [1, 2, 3, + 10 │ list_value: 1, 2, 3, + +value.graphql:10:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `]` but instead found `list_value` + + 8 │ enum_value: ENUM, + 9 │ list_value: [1, 2, 3, + > 10 │ list_value: 1, 2, 3, + │ ^^^^^^^^^^ + 11 │ list_value: 1, 2, 3], + 12 │ object_value: {key: "value" + + i Remove list_value + +value.graphql:10:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an argument but instead found '2, 3'. + + 8 │ enum_value: ENUM, + 9 │ list_value: [1, 2, 3, + > 10 │ list_value: 1, 2, 3, + │ ^^^^ + 11 │ list_value: 1, 2, 3], + 12 │ object_value: {key: "value" + + i Expected an argument here. + + 8 │ enum_value: ENUM, + 9 │ list_value: [1, 2, 3, + > 10 │ list_value: 1, 2, 3, + │ ^^^^ + 11 │ list_value: 1, 2, 3], + 12 │ object_value: {key: "value" + +value.graphql:11:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an argument but instead found '2, 3]'. + + 9 │ list_value: [1, 2, 3, + 10 │ list_value: 1, 2, 3, + > 11 │ list_value: 1, 2, 3], + │ ^^^^^ + 12 │ object_value: {key: "value" + 13 │ object_value: {key:} + + i Expected an argument here. + + 9 │ list_value: [1, 2, 3, + 10 │ list_value: 1, 2, 3, + > 11 │ list_value: 1, 2, 3], + │ ^^^^^ + 12 │ object_value: {key: "value" + 13 │ object_value: {key:} + +value.graphql:13:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a value but instead found '}'. + + 11 │ list_value: 1, 2, 3], + 12 │ object_value: {key: "value" + > 13 │ object_value: {key:} + │ ^ + 14 │ object_value: {key} + 15 │ object_value: key} + + i Expected a value here. + + 11 │ list_value: 1, 2, 3], + 12 │ object_value: {key: "value" + > 13 │ object_value: {key:} + │ ^ + 14 │ object_value: {key} + 15 │ object_value: key} + +value.graphql:14:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `}` + + 12 │ object_value: {key: "value" + 13 │ object_value: {key:} + > 14 │ object_value: {key} + │ ^ + 15 │ object_value: key} + 16 │ object_value: { + + i Remove } + +value.graphql:17:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `)` + + 15 │ object_value: key} + 16 │ object_value: { + > 17 │ ) + │ ^ + 18 │ } + 19 │ + + i Remove ) + +``` diff --git a/crates/biome_graphql_syntax/src/lib.rs b/crates/biome_graphql_syntax/src/lib.rs index 02b0072b8d46..af28a7b8e2bf 100644 --- a/crates/biome_graphql_syntax/src/lib.rs +++ b/crates/biome_graphql_syntax/src/lib.rs @@ -62,7 +62,19 @@ impl biome_rowan::SyntaxKind for GraphqlSyntaxKind { } fn to_bogus(&self) -> GraphqlSyntaxKind { - GRAPHQL_BOGUS + match self { + kind if AnyGraphqlDefinition::can_cast(*kind) => GRAPHQL_BOGUS_DEFINITION, + kind if AnyGraphqlSelection::can_cast(*kind) => GRAPHQL_BOGUS_SELECTION, + kind if AnyGraphqlValue::can_cast(*kind) => GRAPHQL_BOGUS_VALUE, + kind if AnyGraphqlType::can_cast(*kind) => GRAPHQL_BOGUS_TYPE, + kind if AnyGraphqlSchemaExtension::can_cast(*kind) => GRAPHQL_BOGUS_EXTENSION, + kind if AnyGraphqlObjectTypeExtension::can_cast(*kind) => GRAPHQL_BOGUS_EXTENSION, + kind if AnyGraphqlInterfaceTypeExtension::can_cast(*kind) => GRAPHQL_BOGUS_EXTENSION, + kind if AnyGraphqlUnionTypeExtension::can_cast(*kind) => GRAPHQL_BOGUS_EXTENSION, + kind if AnyGraphqlEnumTypeExtension::can_cast(*kind) => GRAPHQL_BOGUS_EXTENSION, + kind if AnyGraphqlInputObjectTypeExtension::can_cast(*kind) => GRAPHQL_BOGUS_EXTENSION, + _ => GRAPHQL_BOGUS, + } } #[inline]