From 15b782de7f1530a11d8b8fdd909eec2327ea1efd Mon Sep 17 00:00:00 2001 From: ahuo Date: Wed, 10 Sep 2025 08:49:23 +0000 Subject: [PATCH 1/3] fix: use dynamically growing error buffer in ParseScript --- src/script_parser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/script_parser.cpp b/src/script_parser.cpp index 5bbc62006..19870dfc1 100644 --- a/src/script_parser.cpp +++ b/src/script_parser.cpp @@ -13,11 +13,13 @@ using ErrorReport = lexy_ext::_report_error; Expected ParseScript(const std::string& script) { - char error_msgs_buffer[2048]; + std::string error_msgs_buffer; // dynamically growing error buffer auto input = lexy::string_input(script); + + auto reporter = ErrorReport().to(std::back_inserter(error_msgs_buffer)); auto result = - lexy::parse(input, ErrorReport().to(error_msgs_buffer)); + lexy::parse(input, reporter); if(result.has_value() && result.error_count() == 0) { try From 8890b7f1f9e05b69e2a96858cefbf84fc1cd216a Mon Sep 17 00:00:00 2001 From: ahuo Date: Wed, 10 Sep 2025 09:04:19 +0000 Subject: [PATCH 2/3] style: format code --- src/script_parser.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/script_parser.cpp b/src/script_parser.cpp index 19870dfc1..6c33a58c9 100644 --- a/src/script_parser.cpp +++ b/src/script_parser.cpp @@ -18,8 +18,7 @@ Expected ParseScript(const std::string& script) auto input = lexy::string_input(script); auto reporter = ErrorReport().to(std::back_inserter(error_msgs_buffer)); - auto result = - lexy::parse(input, reporter); + auto result = lexy::parse(input, reporter); if(result.has_value() && result.error_count() == 0) { try From 4df833b5a0ad5363d352bdc3758b2f9df1b0818b Mon Sep 17 00:00:00 2001 From: ahuo Date: Wed, 10 Sep 2025 09:40:41 +0000 Subject: [PATCH 3/3] fix: use dynamically growing error buffer in ValidateScript --- src/script_parser.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/script_parser.cpp b/src/script_parser.cpp index 6c33a58c9..95c629fa2 100644 --- a/src/script_parser.cpp +++ b/src/script_parser.cpp @@ -70,11 +70,12 @@ BT::Expected ParseScriptAndExecute(Ast::Environment& env, const std::string Result ValidateScript(const std::string& script) { - char error_msgs_buffer[2048]; + std::string error_msgs_buffer; // dynamically growing error buffer auto input = lexy::string_input(script); - auto result = - lexy::parse(input, ErrorReport().to(error_msgs_buffer)); + + auto reporter = ErrorReport().to(std::back_inserter(error_msgs_buffer)); + auto result = lexy::parse(input, reporter); if(result.has_value() && result.error_count() == 0) { try