From f41d7aa401e7393f84a45766fd6e8ec0cbe759aa Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 5 Mar 2024 12:36:32 +0100 Subject: [PATCH] Address PR feedback --- crates/codegen/grammar/src/parser_definition.rs | 4 ++-- .../language/definition/src/model/non_terminals/field.rs | 3 +++ crates/codegen/language/internal_macros/src/derive/spanned.rs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/codegen/grammar/src/parser_definition.rs b/crates/codegen/grammar/src/parser_definition.rs index 8f1bf3c0ab..39aeb8f731 100644 --- a/crates/codegen/grammar/src/parser_definition.rs +++ b/crates/codegen/grammar/src/parser_definition.rs @@ -59,8 +59,8 @@ impl Visitable for TriviaParserDefinitionRef { /// For ambiguous syntaxes this needs to be set to at least N, where N /// is the token lookahead required to disambiguate the syntax. /// -// By default, we assume no lookahead is required to recover from -// unrecognized body between delimiters. +// By default, we assume no lookahead (0) is required to recover from +// unrecognized body between delimiters, so it's always triggered. #[derive(Clone, Debug, Default)] pub struct DelimitedRecoveryTokenThreshold(pub u8); diff --git a/crates/codegen/language/definition/src/model/non_terminals/field.rs b/crates/codegen/language/definition/src/model/non_terminals/field.rs index 96236e8dcf..3318099dee 100644 --- a/crates/codegen/language/definition/src/model/non_terminals/field.rs +++ b/crates/codegen/language/definition/src/model/non_terminals/field.rs @@ -18,6 +18,9 @@ pub struct FieldDelimiters { /// How many tokens have to be matched to trigger the error recovery. /// For ambiguous syntaxes this needs to be set to at least N, where N /// is the token lookahead required to disambiguate the syntax. + /// + /// By default, we assume no lookahead (0) is required to recover from + /// unrecognized body between delimiters, so it's always triggered. pub tokens_matched_acceptance_threshold: Option, } diff --git a/crates/codegen/language/internal_macros/src/derive/spanned.rs b/crates/codegen/language/internal_macros/src/derive/spanned.rs index 5358569296..79e1a4b7eb 100644 --- a/crates/codegen/language/internal_macros/src/derive/spanned.rs +++ b/crates/codegen/language/internal_macros/src/derive/spanned.rs @@ -159,7 +159,7 @@ fn get_spanned_type(input: Type) -> Type { } // External types should also be wrapped in 'Spanned': - "bool" | "u8" | "char" | "PathBuf" | "String" | "Version" => { + "bool" | "char" | "PathBuf" | "String" | "u8" | "Version" => { parse_quote! { crate::internals::Spanned<#input> }