X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fcompiler%2Fmlp_stat.lua;fp=src%2Fcompiler%2Fmlp_stat.lua;h=c6edad170388cd004499347b0a4128981e8d940a;hb=1a5ae8e02ecebd932bf80e13b4a34614de60316f;hp=282954edcb3231748a0d3ed305ea1808355208d0;hpb=9fb02f017150c2613b4290f4be675eb4d888923f;p=metalua.git diff --git a/src/compiler/mlp_stat.lua b/src/compiler/mlp_stat.lua index 282954e..c6edad1 100644 --- a/src/compiler/mlp_stat.lua +++ b/src/compiler/mlp_stat.lua @@ -174,13 +174,15 @@ local function assign_or_call_stat_parser (lx) "separated by semicolons, or not separated at all") end if e[1].tag ~= "Call" and e[1].tag ~= "Invoke" then local typename - if e[1].tag == 'Id' then typename = "an identifier" - elseif e[1].tag == 'Op' then typename = "an arithmetic operation" - else typename = "of type '"..(e[1].tag or "".."'" end - - gg.parse_error (lx, "This expression is " .. typename .. - "; only function and method call expressions ".. - "can be used as statements"); + if e[1].tag == 'Id' then + typename = '("'..e[1][1]..'") is an identifier' + elseif e[1].tag == 'Op' then + typename = "is an arithmetic operation" + else typename = "is of type '"..(e[1].tag or "").."'" end + + gg.parse_error (lx, "This expression " .. typename .. + "; a statement was expected, and only function and method call ".. + "expressions can be used as statements"); end return e[1] end