From eacadd5e10725b426644f34bc864e33d5c40e30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e?= Date: Thu, 13 Apr 2023 11:51:43 +0200 Subject: [PATCH] chore(parser): remove recursion in field parsing, fixes #514 (#519) --- crates/apollo-compiler/src/database/ast.rs | 14 ++++-- .../0001_annonymous_operation_definition.txt | 2 +- ...2_multiple_named_operation_definitions.txt | 2 +- .../ok/0010_operation_with_defined_fields.txt | 2 +- ...agment_spreads_in_fragment_definitions.txt | 2 +- .../test_data/ok/0012_introspection_query.txt | 2 +- ...eration_with_used_variable_in_fragment.txt | 2 +- ..._same_variables_in_multiple_operations.txt | 2 +- .../ok/0017_variables_are_input_types.txt | 2 +- .../test_data/ok/0018_non_clashing_names.txt | 2 +- .../ok/0020_merge_identical_fields.txt | 2 +- ..._merge_identical_fields_with_arguments.txt | 2 +- .../0022_merge_differing_fields_and_args.txt | 2 +- .../ok/0024_used_variables_in_directives.txt | 2 +- .../test_data/ok/0025_unique_directives.txt | 2 +- .../test_data/ok/0026_type_introspection.txt | 2 +- .../0027_typename_introspection_in_object.txt | 2 +- .../0028_typename_introspection_in_union.txt | 2 +- .../0029_used_variable_in_list_and_input.txt | 2 +- .../src/parser/grammar/document.rs | 4 ++ .../apollo-parser/src/parser/grammar/field.rs | 24 +--------- .../src/parser/grammar/selection.rs | 44 +++++++++++++------ crates/apollo-parser/src/parser/mod.rs | 4 +- ..._definition_with_invalid_fragment_name.txt | 2 +- ...definition_with_invalid_type_condition.txt | 2 +- ...incorrect_definition_and_selection_set.txt | 2 +- ...squished_between_two_valid_definitions.txt | 2 +- ...31_argument_with_erronous_string_value.txt | 2 +- ...erminated_string_value_in_object_value.txt | 2 +- .../0042_document_with_incorrect_token.txt | 2 +- .../parser/err/0046_incomplete_spreads.txt | 2 +- .../parser/ok/0002_selection_simple.txt | 2 +- .../parser/ok/0003_selection_with_fields.txt | 2 +- ...election_with_fields_aliases_arguments.txt | 2 +- .../0005_selection_with_inline_fragments.txt | 2 +- .../0006_selection_with_fragment_spread.txt | 2 +- .../parser/ok/0012_fragment_definition.txt | 2 +- ...agment_definition_with_fragment_spread.txt | 2 +- .../ok/0020_operation_type_definition.txt | 2 +- ...eration_type_definition_with_arguments.txt | 2 +- ...finition_with_arguments_and_directives.txt | 2 +- .../test_data/parser/ok/0030_values.txt | 2 +- .../parser/ok/0031_variables_with_default.txt | 2 +- ...rthand_followed_by_fragment_definition.txt | 2 +- .../parser/ok/0035_query_with_variables.txt | 2 +- ...ses_variable_definition_with_list_type.txt | 2 +- ...n_type_definition_with_inline_fragment.txt | 2 +- .../ok/0039_variable_with_directives.txt | 2 +- 48 files changed, 90 insertions(+), 86 deletions(-) diff --git a/crates/apollo-compiler/src/database/ast.rs b/crates/apollo-compiler/src/database/ast.rs index e6df0c1de..37e5760ca 100644 --- a/crates/apollo-compiler/src/database/ast.rs +++ b/crates/apollo-compiler/src/database/ast.rs @@ -93,7 +93,9 @@ mod tests { let schema = r#" query { Q1 { - url + url { + hostname + } } } "#; @@ -104,7 +106,7 @@ mod tests { assert_eq!(ast.recursion_limit().high, 2); assert_eq!(ast.errors().len(), 1); - assert_eq!(ast.document().definitions().count(), 2); + assert_eq!(ast.document().definitions().count(), 1); } #[test] @@ -112,7 +114,11 @@ mod tests { let schema = r#" query { Q1 { - url + Q2 { + Q3 { + url + } + } } } "#; @@ -184,7 +190,7 @@ mod tests { assert_eq!(ast.errors().len(), 1); assert_eq!( ast.errors().next(), - Some(&apollo_parser::Error::limit("parser limit(3) reached", 61)) + Some(&apollo_parser::Error::limit("parser limit(3) reached", 121)) ); } diff --git a/crates/apollo-compiler/test_data/ok/0001_annonymous_operation_definition.txt b/crates/apollo-compiler/test_data/ok/0001_annonymous_operation_definition.txt index fa9861b96..85288325d 100644 --- a/crates/apollo-compiler/test_data/ok/0001_annonymous_operation_definition.txt +++ b/crates/apollo-compiler/test_data/ok/0001_annonymous_operation_definition.txt @@ -61,4 +61,4 @@ - IDENT@79..85 "String" - WHITESPACE@85..86 "\n" - R_CURLY@86..87 "}" -recursion limit: 4096, high: 4 +recursion limit: 4096, high: 2 diff --git a/crates/apollo-compiler/test_data/ok/0002_multiple_named_operation_definitions.txt b/crates/apollo-compiler/test_data/ok/0002_multiple_named_operation_definitions.txt index a0e51080a..34fc706d7 100644 --- a/crates/apollo-compiler/test_data/ok/0002_multiple_named_operation_definitions.txt +++ b/crates/apollo-compiler/test_data/ok/0002_multiple_named_operation_definitions.txt @@ -128,4 +128,4 @@ - WHITESPACE@214..215 "\n" - R_CURLY@215..216 "}" - WHITESPACE@216..217 "\n" -recursion limit: 4096, high: 6 +recursion limit: 4096, high: 3 diff --git a/crates/apollo-compiler/test_data/ok/0010_operation_with_defined_fields.txt b/crates/apollo-compiler/test_data/ok/0010_operation_with_defined_fields.txt index 5b77302f6..76a1c34ba 100644 --- a/crates/apollo-compiler/test_data/ok/0010_operation_with_defined_fields.txt +++ b/crates/apollo-compiler/test_data/ok/0010_operation_with_defined_fields.txt @@ -214,4 +214,4 @@ - DIRECTIVE_LOCATIONS@413..429 - DIRECTIVE_LOCATION@413..429 - FIELD_DEFINITION_KW@413..429 "FIELD_DEFINITION" -recursion limit: 4096, high: 6 +recursion limit: 4096, high: 2 diff --git a/crates/apollo-compiler/test_data/ok/0011_fragment_spreads_in_fragment_definitions.txt b/crates/apollo-compiler/test_data/ok/0011_fragment_spreads_in_fragment_definitions.txt index f126601d5..be221eee8 100644 --- a/crates/apollo-compiler/test_data/ok/0011_fragment_spreads_in_fragment_definitions.txt +++ b/crates/apollo-compiler/test_data/ok/0011_fragment_spreads_in_fragment_definitions.txt @@ -143,4 +143,4 @@ - WHITESPACE@204..205 "\n" - R_CURLY@205..206 "}" - WHITESPACE@206..207 "\n" -recursion limit: 4096, high: 3 +recursion limit: 4096, high: 2 diff --git a/crates/apollo-compiler/test_data/ok/0012_introspection_query.txt b/crates/apollo-compiler/test_data/ok/0012_introspection_query.txt index 9282982dd..6ba1f251c 100644 --- a/crates/apollo-compiler/test_data/ok/0012_introspection_query.txt +++ b/crates/apollo-compiler/test_data/ok/0012_introspection_query.txt @@ -477,4 +477,4 @@ - R_CURLY@1262..1263 "}" - WHITESPACE@1263..1264 "\n" - R_CURLY@1264..1265 "}" -recursion limit: 4096, high: 31 +recursion limit: 4096, high: 8 diff --git a/crates/apollo-compiler/test_data/ok/0013_operation_with_used_variable_in_fragment.txt b/crates/apollo-compiler/test_data/ok/0013_operation_with_used_variable_in_fragment.txt index c964a7b5a..6ae55370b 100644 --- a/crates/apollo-compiler/test_data/ok/0013_operation_with_used_variable_in_fragment.txt +++ b/crates/apollo-compiler/test_data/ok/0013_operation_with_used_variable_in_fragment.txt @@ -231,4 +231,4 @@ - IDENT@429..432 "Int" - WHITESPACE@432..433 "\n" - R_CURLY@433..434 "}" -recursion limit: 4096, high: 5 +recursion limit: 4096, high: 2 diff --git a/crates/apollo-compiler/test_data/ok/0016_same_variables_in_multiple_operations.txt b/crates/apollo-compiler/test_data/ok/0016_same_variables_in_multiple_operations.txt index 5f4c3190e..c549ffb60 100644 --- a/crates/apollo-compiler/test_data/ok/0016_same_variables_in_multiple_operations.txt +++ b/crates/apollo-compiler/test_data/ok/0016_same_variables_in_multiple_operations.txt @@ -186,4 +186,4 @@ - BANG@369..370 "!" - WHITESPACE@370..371 "\n" - R_CURLY@371..372 "}" -recursion limit: 4096, high: 4 +recursion limit: 4096, high: 2 diff --git a/crates/apollo-compiler/test_data/ok/0017_variables_are_input_types.txt b/crates/apollo-compiler/test_data/ok/0017_variables_are_input_types.txt index 515fa8302..f425e91ba 100644 --- a/crates/apollo-compiler/test_data/ok/0017_variables_are_input_types.txt +++ b/crates/apollo-compiler/test_data/ok/0017_variables_are_input_types.txt @@ -300,4 +300,4 @@ - IDENT@591..598 "Boolean" - WHITESPACE@598..599 "\n" - R_CURLY@599..600 "}" -recursion limit: 4096, high: 4 +recursion limit: 4096, high: 2 diff --git a/crates/apollo-compiler/test_data/ok/0018_non_clashing_names.txt b/crates/apollo-compiler/test_data/ok/0018_non_clashing_names.txt index 628821c2a..4b20f878e 100644 --- a/crates/apollo-compiler/test_data/ok/0018_non_clashing_names.txt +++ b/crates/apollo-compiler/test_data/ok/0018_non_clashing_names.txt @@ -110,4 +110,4 @@ - WHITESPACE@201..202 "\n" - R_CURLY@202..203 "}" - WHITESPACE@203..204 "\n" -recursion limit: 4096, high: 3 +recursion limit: 4096, high: 2 diff --git a/crates/apollo-compiler/test_data/ok/0020_merge_identical_fields.txt b/crates/apollo-compiler/test_data/ok/0020_merge_identical_fields.txt index 29d1490c7..237423631 100644 --- a/crates/apollo-compiler/test_data/ok/0020_merge_identical_fields.txt +++ b/crates/apollo-compiler/test_data/ok/0020_merge_identical_fields.txt @@ -147,4 +147,4 @@ - WHITESPACE@317..318 "\n" - R_CURLY@318..319 "}" - WHITESPACE@319..320 "\n" -recursion limit: 4096, high: 3 +recursion limit: 4096, high: 2 diff --git a/crates/apollo-compiler/test_data/ok/0021_merge_identical_fields_with_arguments.txt b/crates/apollo-compiler/test_data/ok/0021_merge_identical_fields_with_arguments.txt index 8a166fa4a..b615cf121 100644 --- a/crates/apollo-compiler/test_data/ok/0021_merge_identical_fields_with_arguments.txt +++ b/crates/apollo-compiler/test_data/ok/0021_merge_identical_fields_with_arguments.txt @@ -238,4 +238,4 @@ - WHITESPACE@590..591 "\n" - R_CURLY@591..592 "}" - WHITESPACE@592..593 "\n" -recursion limit: 4096, high: 3 +recursion limit: 4096, high: 2 diff --git a/crates/apollo-compiler/test_data/ok/0022_merge_differing_fields_and_args.txt b/crates/apollo-compiler/test_data/ok/0022_merge_differing_fields_and_args.txt index a3a497145..7ce6f56cd 100644 --- a/crates/apollo-compiler/test_data/ok/0022_merge_differing_fields_and_args.txt +++ b/crates/apollo-compiler/test_data/ok/0022_merge_differing_fields_and_args.txt @@ -541,4 +541,4 @@ - WHITESPACE@979..980 "\n" - R_CURLY@980..981 "}" - WHITESPACE@981..982 "\n" -recursion limit: 4096, high: 3 +recursion limit: 4096, high: 2 diff --git a/crates/apollo-compiler/test_data/ok/0024_used_variables_in_directives.txt b/crates/apollo-compiler/test_data/ok/0024_used_variables_in_directives.txt index e65d0174b..1a114becd 100644 --- a/crates/apollo-compiler/test_data/ok/0024_used_variables_in_directives.txt +++ b/crates/apollo-compiler/test_data/ok/0024_used_variables_in_directives.txt @@ -281,4 +281,4 @@ - WHITESPACE@503..504 "\n" - R_CURLY@504..505 "}" - WHITESPACE@505..506 "\n" -recursion limit: 4096, high: 2 +recursion limit: 4096, high: 1 diff --git a/crates/apollo-compiler/test_data/ok/0025_unique_directives.txt b/crates/apollo-compiler/test_data/ok/0025_unique_directives.txt index f164a8a83..8cde270ec 100644 --- a/crates/apollo-compiler/test_data/ok/0025_unique_directives.txt +++ b/crates/apollo-compiler/test_data/ok/0025_unique_directives.txt @@ -88,4 +88,4 @@ - WHITESPACE@164..165 "\n" - R_CURLY@165..166 "}" - WHITESPACE@166..167 "\n" -recursion limit: 4096, high: 4 +recursion limit: 4096, high: 1 diff --git a/crates/apollo-compiler/test_data/ok/0026_type_introspection.txt b/crates/apollo-compiler/test_data/ok/0026_type_introspection.txt index 0c08214fb..aa8792158 100644 --- a/crates/apollo-compiler/test_data/ok/0026_type_introspection.txt +++ b/crates/apollo-compiler/test_data/ok/0026_type_introspection.txt @@ -113,4 +113,4 @@ - R_CURLY@210..211 "}" - WHITESPACE@211..212 "\n" - R_CURLY@212..213 "}" -recursion limit: 4096, high: 10 +recursion limit: 4096, high: 4 diff --git a/crates/apollo-compiler/test_data/ok/0027_typename_introspection_in_object.txt b/crates/apollo-compiler/test_data/ok/0027_typename_introspection_in_object.txt index f62c70b35..7fb23e2c3 100644 --- a/crates/apollo-compiler/test_data/ok/0027_typename_introspection_in_object.txt +++ b/crates/apollo-compiler/test_data/ok/0027_typename_introspection_in_object.txt @@ -72,4 +72,4 @@ - IDENT@123..133 "__typename" - WHITESPACE@133..134 "\n" - R_CURLY@134..135 "}" -recursion limit: 4096, high: 3 +recursion limit: 4096, high: 1 diff --git a/crates/apollo-compiler/test_data/ok/0028_typename_introspection_in_union.txt b/crates/apollo-compiler/test_data/ok/0028_typename_introspection_in_union.txt index 5f9b81654..8890d1b06 100644 --- a/crates/apollo-compiler/test_data/ok/0028_typename_introspection_in_union.txt +++ b/crates/apollo-compiler/test_data/ok/0028_typename_introspection_in_union.txt @@ -152,4 +152,4 @@ - R_CURLY@289..290 "}" - WHITESPACE@290..291 "\n" - R_CURLY@291..292 "}" -recursion limit: 4096, high: 4 +recursion limit: 4096, high: 2 diff --git a/crates/apollo-compiler/test_data/ok/0029_used_variable_in_list_and_input.txt b/crates/apollo-compiler/test_data/ok/0029_used_variable_in_list_and_input.txt index 5b8f631d6..0b3b67bd9 100644 --- a/crates/apollo-compiler/test_data/ok/0029_used_variable_in_list_and_input.txt +++ b/crates/apollo-compiler/test_data/ok/0029_used_variable_in_list_and_input.txt @@ -214,4 +214,4 @@ - WHITESPACE@300..301 "\n" - R_CURLY@301..302 "}" - WHITESPACE@302..303 "\n" -recursion limit: 4096, high: 4 +recursion limit: 4096, high: 2 diff --git a/crates/apollo-parser/src/parser/grammar/document.rs b/crates/apollo-parser/src/parser/grammar/document.rs index 2ec289e72..756aa54da 100644 --- a/crates/apollo-parser/src/parser/grammar/document.rs +++ b/crates/apollo-parser/src/parser/grammar/document.rs @@ -14,6 +14,10 @@ pub(crate) fn document(p: &mut Parser) { let doc = p.start_node(SyntaxKind::DOCUMENT); while let Some(node) = p.peek() { + if p.recursion_limit.limited() { + break; + } + match node { TokenKind::StringValue => { let def = p.peek_data_n(2).unwrap(); diff --git a/crates/apollo-parser/src/parser/grammar/field.rs b/crates/apollo-parser/src/parser/grammar/field.rs index 97924fab9..f9a9903c8 100644 --- a/crates/apollo-parser/src/parser/grammar/field.rs +++ b/crates/apollo-parser/src/parser/grammar/field.rs @@ -10,16 +10,7 @@ use crate::{ /// *Field*: /// Alias? Name Arguments? Directives? SelectionSet? pub(crate) fn field(p: &mut Parser) { - // We need to enforce recursion limits to prevent - // excessive resource consumption or (more seriously) - // stack overflows. - p.recursion_limit.consume(); - if p.recursion_limit.limited() { - p.limit_err(format!("parser limit({}) reached", p.recursion_limit.limit)); - return; - } - - let guard = p.start_node(SyntaxKind::FIELD); + let _guard = p.start_node(SyntaxKind::FIELD); if let Some(TokenKind::Name) = p.peek() { if let Some(T![:]) = p.peek_n(2) { @@ -41,19 +32,6 @@ pub(crate) fn field(p: &mut Parser) { if let Some(T!['{']) = p.peek() { selection::selection_set(p); } - - match p.peek() { - Some(TokenKind::Name) => { - guard.finish_node(); - - field(p) - } - - Some(T!['}']) => { - guard.finish_node(); - } - _ => guard.finish_node(), - } } /// See: https://spec.graphql.org/October2021/#FieldsDefinition diff --git a/crates/apollo-parser/src/parser/grammar/selection.rs b/crates/apollo-parser/src/parser/grammar/selection.rs index d9b4e2836..2e9df78f2 100644 --- a/crates/apollo-parser/src/parser/grammar/selection.rs +++ b/crates/apollo-parser/src/parser/grammar/selection.rs @@ -312,7 +312,9 @@ query SomeQuery( let schema = r#" query { Q1 { - url + Q2 { + url + } } } "#; @@ -322,7 +324,7 @@ query SomeQuery( assert_eq!(ast.recursion_limit().high, 2); assert_eq!(ast.errors().len(), 1); - assert_eq!(ast.document().definitions().count(), 2); + assert_eq!(ast.document().definitions().count(), 1); } #[test] @@ -330,7 +332,9 @@ query SomeQuery( let schema = r#" query { Q1 { - url + Q2 { + url + } } } "#; @@ -338,7 +342,7 @@ query SomeQuery( let ast = parser.parse(); - assert_eq!(ast.recursion_limit().high, 4); + assert_eq!(ast.recursion_limit().high, 3); assert_eq!(ast.errors().len(), 0); assert_eq!(ast.document().definitions().count(), 1); } @@ -347,9 +351,13 @@ query SomeQuery( fn it_errors_when_selection_set_recursion_limit_is_exceeded_with_inline_fragment() { let schema = r#" query { - ... on Page { - price - name + Q1 { + Q2 { + ... on Page { + price + name + } + } } } "#; @@ -366,8 +374,12 @@ query SomeQuery( fn it_errors_when_selection_set_recursion_limit_is_exceeded_fragment_spread() { let schema = r#" query { - product { - ...Page + Q1 { + Q2 { + product { + ...Page + } + } } } "#; @@ -377,7 +389,7 @@ query SomeQuery( assert_eq!(ast.recursion_limit().high, 3); assert_eq!(ast.errors().len(), 1); - assert_eq!(ast.document().definitions().count(), 1); + assert_eq!(dbg!(ast.document()).definitions().count(), 1); } #[test] @@ -403,7 +415,7 @@ query SomeQuery( assert_eq!(ast.recursion_limit().high, 2); assert_eq!(ast.errors().len(), 1); - assert_eq!(ast.document().definitions().count(), 4); + assert_eq!(ast.document().definitions().count(), 1); } #[test] @@ -411,7 +423,13 @@ query SomeQuery( let schema = r#" query { Q1 { - url + Q2 { + Q3 { + Q4 { + Q5 { url } + } + } + } }, } "#; @@ -419,7 +437,7 @@ query SomeQuery( let ast = parser.parse(); - assert_eq!(ast.recursion_limit().high, 4); + assert_eq!(ast.recursion_limit().high, 6); assert_eq!(ast.errors().len(), 0); assert_eq!(ast.document().definitions().count(), 1); } diff --git a/crates/apollo-parser/src/parser/mod.rs b/crates/apollo-parser/src/parser/mod.rs index 1af9de611..4a49d48d7 100644 --- a/crates/apollo-parser/src/parser/mod.rs +++ b/crates/apollo-parser/src/parser/mod.rs @@ -495,7 +495,7 @@ mod tests { let parser = Parser::new(source).recursion_limit(3).token_limit(200); let ast = parser.parse(); let errors = ast.errors().collect::>(); - assert_eq!(errors, &[&Error::limit("parser limit(3) reached", 61),]); + assert_eq!(errors, &[&Error::limit("parser limit(3) reached", 121),]); } #[test] @@ -522,8 +522,6 @@ mod tests { ); assert_eq!(errors.next(), None); - // TODO(@goto-bus-stop) the comment is positioned wrong: - // https://github.com/apollographql/apollo-rs/issues/362 let tree = expect![[r##" DOCUMENT@0..113 WHITESPACE@0..13 "\n " diff --git a/crates/apollo-parser/test_data/parser/err/0007_fragment_definition_with_invalid_fragment_name.txt b/crates/apollo-parser/test_data/parser/err/0007_fragment_definition_with_invalid_fragment_name.txt index 1057c6a14..0a6170641 100644 --- a/crates/apollo-parser/test_data/parser/err/0007_fragment_definition_with_invalid_fragment_name.txt +++ b/crates/apollo-parser/test_data/parser/err/0007_fragment_definition_with_invalid_fragment_name.txt @@ -25,4 +25,4 @@ - WHITESPACE@34..35 "\n" - R_CURLY@35..36 "}" - ERROR@9:11 "Fragment Name cannot be 'on'" on -recursion limit: 4096, high: 2 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/err/0008_fragment_definition_with_invalid_type_condition.txt b/crates/apollo-parser/test_data/parser/err/0008_fragment_definition_with_invalid_type_condition.txt index 46349a993..1c968f378 100644 --- a/crates/apollo-parser/test_data/parser/err/0008_fragment_definition_with_invalid_type_condition.txt +++ b/crates/apollo-parser/test_data/parser/err/0008_fragment_definition_with_invalid_type_condition.txt @@ -26,4 +26,4 @@ - WHITESPACE@44..45 "\n" - R_CURLY@45..46 "}" - ERROR@22:26 "exptected 'on'" User -recursion limit: 4096, high: 2 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/err/0025_document_with_incorrect_definition_and_selection_set.txt b/crates/apollo-parser/test_data/parser/err/0025_document_with_incorrect_definition_and_selection_set.txt index a7cc2373c..f778af145 100644 --- a/crates/apollo-parser/test_data/parser/err/0025_document_with_incorrect_definition_and_selection_set.txt +++ b/crates/apollo-parser/test_data/parser/err/0025_document_with_incorrect_definition_and_selection_set.txt @@ -15,4 +15,4 @@ - WHITESPACE@39..40 "\n" - R_CURLY@40..41 "}" - ERROR@0:14 "expected definition" uasdf21230jkdw -recursion limit: 4096, high: 3 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/err/0026_invalid_definition_squished_between_two_valid_definitions.txt b/crates/apollo-parser/test_data/parser/err/0026_invalid_definition_squished_between_two_valid_definitions.txt index 0ac9a057e..543e57172 100644 --- a/crates/apollo-parser/test_data/parser/err/0026_invalid_definition_squished_between_two_valid_definitions.txt +++ b/crates/apollo-parser/test_data/parser/err/0026_invalid_definition_squished_between_two_valid_definitions.txt @@ -56,4 +56,4 @@ - WHITESPACE@138..139 "\n" - R_CURLY@139..140 "}" - ERROR@99:113 "expected definition" uasdf21230jkdw -recursion limit: 4096, high: 3 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/err/0031_argument_with_erronous_string_value.txt b/crates/apollo-parser/test_data/parser/err/0031_argument_with_erronous_string_value.txt index 6a181fcf9..a17c9b83a 100644 --- a/crates/apollo-parser/test_data/parser/err/0031_argument_with_erronous_string_value.txt +++ b/crates/apollo-parser/test_data/parser/err/0031_argument_with_erronous_string_value.txt @@ -18,4 +18,4 @@ - R_CURLY@15..16 "}" - ERROR@13:25 "unexpected escaped character" "\string ID" - ERROR@25:26 "expected a valid Value" ) -recursion limit: 4096, high: 2 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/err/0035_unterminated_string_value_in_object_value.txt b/crates/apollo-parser/test_data/parser/err/0035_unterminated_string_value_in_object_value.txt index d331ee904..529032b22 100644 --- a/crates/apollo-parser/test_data/parser/err/0035_unterminated_string_value_in_object_value.txt +++ b/crates/apollo-parser/test_data/parser/err/0035_unterminated_string_value_in_object_value.txt @@ -56,4 +56,4 @@ - ERROR@116:116 "expected }" EOF - ERROR@116:116 "expected R_PAREN, got EOF" EOF - ERROR@116:116 "expected R_CURLY, got EOF" EOF -recursion limit: 4096, high: 2 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/err/0042_document_with_incorrect_token.txt b/crates/apollo-parser/test_data/parser/err/0042_document_with_incorrect_token.txt index 99349b967..da833fb36 100644 --- a/crates/apollo-parser/test_data/parser/err/0042_document_with_incorrect_token.txt +++ b/crates/apollo-parser/test_data/parser/err/0042_document_with_incorrect_token.txt @@ -42,4 +42,4 @@ - R_CURLY@82..83 "}" - ERROR@0:1 "expected a StringValue, Name or OperationDefinition" @ - ERROR@49:50 "expected a StringValue, Name or OperationDefinition" } -recursion limit: 4096, high: 3 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/err/0046_incomplete_spreads.txt b/crates/apollo-parser/test_data/parser/err/0046_incomplete_spreads.txt index 125aefcc1..7321aa3f4 100644 --- a/crates/apollo-parser/test_data/parser/err/0046_incomplete_spreads.txt +++ b/crates/apollo-parser/test_data/parser/err/0046_incomplete_spreads.txt @@ -16,4 +16,4 @@ - R_CURLY@15..16 "}" - WHITESPACE@16..17 "\n" - ERROR@10:13 "expected an Inline Fragment or a Fragment Spread" ... -recursion limit: 4096, high: 3 \ No newline at end of file +recursion limit: 4096, high: 2 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0002_selection_simple.txt b/crates/apollo-parser/test_data/parser/ok/0002_selection_simple.txt index 8424269a7..382112bee 100644 --- a/crates/apollo-parser/test_data/parser/ok/0002_selection_simple.txt +++ b/crates/apollo-parser/test_data/parser/ok/0002_selection_simple.txt @@ -12,4 +12,4 @@ - IDENT@14..23 "faveSnack" - WHITESPACE@23..24 "\n" - R_CURLY@24..25 "}" -recursion limit: 4096, high: 3 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0003_selection_with_fields.txt b/crates/apollo-parser/test_data/parser/ok/0003_selection_with_fields.txt index 8c18bb5c7..028edd124 100644 --- a/crates/apollo-parser/test_data/parser/ok/0003_selection_with_fields.txt +++ b/crates/apollo-parser/test_data/parser/ok/0003_selection_with_fields.txt @@ -56,4 +56,4 @@ - IDENT@168..177 "faveSnack" - WHITESPACE@177..178 "\n" - R_CURLY@178..179 "}" -recursion limit: 4096, high: 13 \ No newline at end of file +recursion limit: 4096, high: 4 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0004_selection_with_fields_aliases_arguments.txt b/crates/apollo-parser/test_data/parser/ok/0004_selection_with_fields_aliases_arguments.txt index 2a4f24b0a..d9e6bb1de 100644 --- a/crates/apollo-parser/test_data/parser/ok/0004_selection_with_fields_aliases_arguments.txt +++ b/crates/apollo-parser/test_data/parser/ok/0004_selection_with_fields_aliases_arguments.txt @@ -71,4 +71,4 @@ - R_PAREN@199..200 ")" - WHITESPACE@200..201 "\n" - R_CURLY@201..202 "}" -recursion limit: 4096, high: 13 \ No newline at end of file +recursion limit: 4096, high: 4 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0005_selection_with_inline_fragments.txt b/crates/apollo-parser/test_data/parser/ok/0005_selection_with_inline_fragments.txt index 885feb1a4..a394dcb97 100644 --- a/crates/apollo-parser/test_data/parser/ok/0005_selection_with_inline_fragments.txt +++ b/crates/apollo-parser/test_data/parser/ok/0005_selection_with_inline_fragments.txt @@ -40,4 +40,4 @@ - R_CURLY@88..89 "}" - WHITESPACE@89..90 "\n" - R_CURLY@90..91 "}" -recursion limit: 4096, high: 4 \ No newline at end of file +recursion limit: 4096, high: 2 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0006_selection_with_fragment_spread.txt b/crates/apollo-parser/test_data/parser/ok/0006_selection_with_fragment_spread.txt index 2b2b4d81d..7a87568d9 100644 --- a/crates/apollo-parser/test_data/parser/ok/0006_selection_with_fragment_spread.txt +++ b/crates/apollo-parser/test_data/parser/ok/0006_selection_with_fragment_spread.txt @@ -113,4 +113,4 @@ - WHITESPACE@207..208 "\n" - R_CURLY@208..209 "}" - WHITESPACE@209..210 "\n" -recursion limit: 4096, high: 3 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0012_fragment_definition.txt b/crates/apollo-parser/test_data/parser/ok/0012_fragment_definition.txt index b3f9c2bae..bbcad5754 100644 --- a/crates/apollo-parser/test_data/parser/ok/0012_fragment_definition.txt +++ b/crates/apollo-parser/test_data/parser/ok/0012_fragment_definition.txt @@ -45,4 +45,4 @@ - R_PAREN@80..81 ")" - WHITESPACE@81..82 "\n" - R_CURLY@82..83 "}" -recursion limit: 4096, high: 4 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0013_fragment_definition_with_fragment_spread.txt b/crates/apollo-parser/test_data/parser/ok/0013_fragment_definition_with_fragment_spread.txt index ac1b2d168..31521db56 100644 --- a/crates/apollo-parser/test_data/parser/ok/0013_fragment_definition_with_fragment_spread.txt +++ b/crates/apollo-parser/test_data/parser/ok/0013_fragment_definition_with_fragment_spread.txt @@ -31,4 +31,4 @@ - IDENT@55..73 "standardProfilePic" - WHITESPACE@73..74 "\n" - R_CURLY@74..75 "}" -recursion limit: 4096, high: 3 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0020_operation_type_definition.txt b/crates/apollo-parser/test_data/parser/ok/0020_operation_type_definition.txt index a050b34e3..bb302c336 100644 --- a/crates/apollo-parser/test_data/parser/ok/0020_operation_type_definition.txt +++ b/crates/apollo-parser/test_data/parser/ok/0020_operation_type_definition.txt @@ -51,4 +51,4 @@ - IDENT@113..117 "lion" - WHITESPACE@117..118 "\n" - R_CURLY@118..119 "}" -recursion limit: 4096, high: 8 \ No newline at end of file +recursion limit: 4096, high: 3 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0021_operation_type_definition_with_arguments.txt b/crates/apollo-parser/test_data/parser/ok/0021_operation_type_definition_with_arguments.txt index 14b1e2ed3..fc9596d1c 100644 --- a/crates/apollo-parser/test_data/parser/ok/0021_operation_type_definition_with_arguments.txt +++ b/crates/apollo-parser/test_data/parser/ok/0021_operation_type_definition_with_arguments.txt @@ -41,4 +41,4 @@ - IDENT@65..70 "treat" - WHITESPACE@70..71 "\n" - R_CURLY@71..72 "}" -recursion limit: 4096, high: 3 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0022_operation_type_definition_with_arguments_and_directives.txt b/crates/apollo-parser/test_data/parser/ok/0022_operation_type_definition_with_arguments_and_directives.txt index 66b5fd516..0f619bc63 100644 --- a/crates/apollo-parser/test_data/parser/ok/0022_operation_type_definition_with_arguments_and_directives.txt +++ b/crates/apollo-parser/test_data/parser/ok/0022_operation_type_definition_with_arguments_and_directives.txt @@ -53,4 +53,4 @@ - IDENT@86..91 "treat" - WHITESPACE@91..92 "\n" - R_CURLY@92..93 "}" -recursion limit: 4096, high: 3 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0030_values.txt b/crates/apollo-parser/test_data/parser/ok/0030_values.txt index b9254f762..db09e15f6 100644 --- a/crates/apollo-parser/test_data/parser/ok/0030_values.txt +++ b/crates/apollo-parser/test_data/parser/ok/0030_values.txt @@ -83,4 +83,4 @@ - R_PAREN@111..112 ")" - WHITESPACE@112..113 "\n" - R_CURLY@113..114 "}" -recursion limit: 4096, high: 2 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0031_variables_with_default.txt b/crates/apollo-parser/test_data/parser/ok/0031_variables_with_default.txt index 3fd9b08eb..e5b5f72d1 100644 --- a/crates/apollo-parser/test_data/parser/ok/0031_variables_with_default.txt +++ b/crates/apollo-parser/test_data/parser/ok/0031_variables_with_default.txt @@ -50,4 +50,4 @@ - IDENT@66..72 "animal" - WHITESPACE@72..73 "\n" - R_CURLY@73..74 "}" -recursion limit: 4096, high: 2 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0034_query_shorthand_followed_by_fragment_definition.txt b/crates/apollo-parser/test_data/parser/ok/0034_query_shorthand_followed_by_fragment_definition.txt index 00d39d846..06ba42eb4 100644 --- a/crates/apollo-parser/test_data/parser/ok/0034_query_shorthand_followed_by_fragment_definition.txt +++ b/crates/apollo-parser/test_data/parser/ok/0034_query_shorthand_followed_by_fragment_definition.txt @@ -37,4 +37,4 @@ - IDENT@62..66 "name" - WHITESPACE@66..67 "\n" - R_CURLY@67..68 "}" -recursion limit: 4096, high: 3 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0035_query_with_variables.txt b/crates/apollo-parser/test_data/parser/ok/0035_query_with_variables.txt index e34f299d6..1862c0781 100644 --- a/crates/apollo-parser/test_data/parser/ok/0035_query_with_variables.txt +++ b/crates/apollo-parser/test_data/parser/ok/0035_query_with_variables.txt @@ -27,4 +27,4 @@ - IDENT@27..31 "name" - WHITESPACE@31..32 "\n" - R_CURLY@32..33 "}" -recursion limit: 4096, high: 2 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0036_parses_variable_definition_with_list_type.txt b/crates/apollo-parser/test_data/parser/ok/0036_parses_variable_definition_with_list_type.txt index 258e66de7..67b6aecef 100644 --- a/crates/apollo-parser/test_data/parser/ok/0036_parses_variable_definition_with_list_type.txt +++ b/crates/apollo-parser/test_data/parser/ok/0036_parses_variable_definition_with_list_type.txt @@ -44,4 +44,4 @@ - R_PAREN@57..58 ")" - WHITESPACE@58..59 "\n" - R_CURLY@59..60 "}" -recursion limit: 4096, high: 3 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0037_operation_type_definition_with_inline_fragment.txt b/crates/apollo-parser/test_data/parser/ok/0037_operation_type_definition_with_inline_fragment.txt index c2f3d0ccd..d391e863c 100644 --- a/crates/apollo-parser/test_data/parser/ok/0037_operation_type_definition_with_inline_fragment.txt +++ b/crates/apollo-parser/test_data/parser/ok/0037_operation_type_definition_with_inline_fragment.txt @@ -105,4 +105,4 @@ - R_CURLY@190..191 "}" - WHITESPACE@191..192 "\n" - R_CURLY@192..193 "}" -recursion limit: 4096, high: 4 \ No newline at end of file +recursion limit: 4096, high: 2 \ No newline at end of file diff --git a/crates/apollo-parser/test_data/parser/ok/0039_variable_with_directives.txt b/crates/apollo-parser/test_data/parser/ok/0039_variable_with_directives.txt index 381f98d8c..a77fa5e74 100644 --- a/crates/apollo-parser/test_data/parser/ok/0039_variable_with_directives.txt +++ b/crates/apollo-parser/test_data/parser/ok/0039_variable_with_directives.txt @@ -66,4 +66,4 @@ - IDENT@103..109 "animal" - WHITESPACE@109..110 "\n" - R_CURLY@110..111 "}" -recursion limit: 4096, high: 2 \ No newline at end of file +recursion limit: 4096, high: 1 \ No newline at end of file