diff --git a/LANGUAGE.md b/LANGUAGE.md index 9e87c3b..97842a7 100644 --- a/LANGUAGE.md +++ b/LANGUAGE.md @@ -881,6 +881,8 @@ This only works on strings: `a ; b`: evaluate a, discard its result, then evaluate b. Returns the result of b. +`a;`: evaluate a, discard its result, returns nil. + `a : b`: evaluate a and b, returns a new pair with a as key and b as value. `a :: b`: evaluate a and b, returns a new typed value with a as value and b as type. diff --git a/parser/common.lua b/parser/common.lua index a1a84a3..3bb6185 100644 --- a/parser/common.lua +++ b/parser/common.lua @@ -46,6 +46,7 @@ common = { "_^_", "_._", "_!_", -- suffix unop + "_;", "_!", -- special "()", diff --git a/parser/expression.lua b/parser/expression.lua index dc58f59..7884566 100644 --- a/parser/expression.lua +++ b/parser/expression.lua @@ -31,7 +31,7 @@ local prefix_unops_prio = { [12] = { "&" } } local suffix_unops_prio = { - [1] = {}, + [1] = { ";" }, [2] = {}, [3] = {}, [4] = {}, diff --git a/stdlib/functions.lua b/stdlib/functions.lua index b408c48..adcb1ab 100644 --- a/stdlib/functions.lua +++ b/stdlib/functions.lua @@ -7,6 +7,10 @@ lua_functions = { mode = "raw", value = function(a, b) return b end }, + ["_;(a)"] = { + mode = "raw", + value = function(a) return { type = "nil", value = nil } end + }, -- comparaison ["_==_(a, b)"] = { mode = "raw",