mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
LunaCON: fix mistranslation of CON "else { if" to Lua "elseif".
When encountering a non-empty statement inside braces, emit "do" ... "end". git-svn-id: https://svn.eduke32.com/eduke32@3840 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
e0a373893a
commit
f0ed046a98
2 changed files with 17 additions and 1 deletions
|
@ -3086,7 +3086,7 @@ local Grammar = Pat{
|
|||
* sp1 * Var("single_stmt") * (lpeg.Cc(nil) / on.while_end),
|
||||
|
||||
stmt_common = Keyw("{") * sp1 * "}" / "" -- space separation of commands in CON is for a reason!
|
||||
+ Keyw("{") * sp1 * lpeg.Ct(stmt_list) * sp1 * "}"
|
||||
+ lpeg.Ct(Keyw("{")/"do" * sp1 * stmt_list * sp1 * (Keyw("}")/"end"))
|
||||
+ con_inner_command + Var("switch_stmt") + lpeg.Ct(Var("while_stmt")),
|
||||
|
||||
single_stmt = Stmt( lone_else^-1 * (Var("stmt_common") + Var("if_stmt")) ),
|
||||
|
|
16
polymer/eduke32/source/lunatic/test/else_brace_if.con
Normal file
16
polymer/eduke32/source/lunatic/test/else_brace_if.con
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
actor 1890 1
|
||||
// The following "else { if" must not be translated to an "elseif".
|
||||
ifcount 1 nullop else
|
||||
{
|
||||
ifvare 0 0
|
||||
spawn 1
|
||||
else
|
||||
spawn 2
|
||||
|
||||
ifvare 1 1
|
||||
spawn 3
|
||||
else ifvare 1 2
|
||||
spawn 4
|
||||
}
|
||||
enda
|
Loading…
Reference in a new issue