1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00

Add nil expression and fix return behavior with nil expression

This commit is contained in:
Étienne Fildadut 2021-04-12 01:10:42 +02:00
parent 6488bef75c
commit b9c6d1d704
10 changed files with 84 additions and 21 deletions

View file

@ -9,8 +9,14 @@ local unpack = table.unpack or unpack
-- returns evaluated value if success
-- returns nil, error if error
local function eval(state, exp)
-- nil
if exp.type == "nil" then
return {
type = "nil",
value = nil
}
-- number
if exp.type == "number" then
elseif exp.type == "number" then
return {
type = "number",
value = exp.value