Skip to content

Commit 15b782d

Browse files
committed
fix: use dynamically growing error buffer in ParseScript
1 parent 8d47d39 commit 15b782d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/script_parser.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ using ErrorReport = lexy_ext::_report_error<char*>;
1313

1414
Expected<ScriptFunction> ParseScript(const std::string& script)
1515
{
16-
char error_msgs_buffer[2048];
16+
std::string error_msgs_buffer; // dynamically growing error buffer
1717

1818
auto input = lexy::string_input<lexy::utf8_encoding>(script);
19+
20+
auto reporter = ErrorReport().to(std::back_inserter(error_msgs_buffer));
1921
auto result =
20-
lexy::parse<BT::Grammar::stmt>(input, ErrorReport().to(error_msgs_buffer));
22+
lexy::parse<BT::Grammar::stmt>(input, reporter);
2123
if(result.has_value() && result.error_count() == 0)
2224
{
2325
try

0 commit comments

Comments
 (0)