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:
parent
6488bef75c
commit
b9c6d1d704
10 changed files with 84 additions and 21 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue