Skip to content
Snippets Groups Projects
Commit 5c030c10 authored by Sergey Bronnikov's avatar Sergey Bronnikov Committed by Igor Munkin
Browse files

test/fuzz: fix errors "ambiguous syntax"

Running of automatically generated Lua programs sometimes failed
with an error like "ambiguous syntax (function call x new statement)"
(0.3%). The patch fixes these errors.

NO_CHANGELOG=testing
NO_DOC=testing
NO_TEST=testing
parent 0d6e34b0
No related branches found
No related tags found
No related merge requests found
......@@ -452,7 +452,15 @@ PROTO_TOSTRING(LastStatement, laststat)
break;
}
if (!laststat_str.empty() && laststat.has_semicolon())
/*
* Add a semicolon when last statement is not empty
* to avoid errors like:
*
* <preamble.lua>
* (nil):Name0()
* (nil)() -- ambiguous syntax (function call x new statement) near '('
*/
if (!laststat_str.empty())
laststat_str += "; ";
return laststat_str;
......@@ -522,8 +530,15 @@ PROTO_TOSTRING(Statement, stat)
break;
}
if (stat.has_semicolon())
stat_str += "; ";
/*
* Always add a semicolon regardless of grammar
* to avoid errors like:
*
* <preamble.lua>
* (nil):Name0()
* (nil)() -- ambiguous syntax (function call x new statement) near '('
*/
stat_str += "; ";
return stat_str;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment