X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fcompiler%2Fmlp_stat.lua;h=282954edcb3231748a0d3ed305ea1808355208d0;hb=f89b6df86fd333a51edd544bd975069c206067a9;hp=b959d96551bc3908b46d8c9faf7c1c874a35c451;hpb=961cf380f2ff73d9b3ebf55996ca2198326ec077;p=metalua.git diff --git a/src/compiler/mlp_stat.lua b/src/compiler/mlp_stat.lua index b959d96..282954e 100644 --- a/src/compiler/mlp_stat.lua +++ b/src/compiler/mlp_stat.lua @@ -169,11 +169,18 @@ local function assign_or_call_stat_parser (lx) else assert (#e > 0) if #e > 1 then - gg.parse_error (lx, "comma is not a valid statement separator") end + gg.parse_error (lx, + "comma is not a valid statement separator; statement can be ".. + "separated by semicolons, or not separated at all") end if e[1].tag ~= "Call" and e[1].tag ~= "Invoke" then - gg.parse_error (lx, "This expression is of type '%s'; ".. - "only function and method calls make valid statements", - e[1].tag or "") + 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"); end return e[1] end