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

Move anselme code into its own directory

This commit is contained in:
Étienne Fildadut 2023-12-29 18:41:06 +01:00
parent 404e7dd56e
commit 5dd971ff8f
179 changed files with 603 additions and 579 deletions

View file

@ -0,0 +1,42 @@
local ast = require("anselme.ast")
local Boolean, ArgumentTuple = ast.Boolean, ast.ArgumentTuple
return {
{
"_==_", "(a, b)",
function(state, a, b)
if a.mutable ~= b.mutable then return Boolean:new(false)
elseif a.mutable then
return Boolean:new(a == b)
else
return Boolean:new(a:hash() == b:hash())
end
end
},
{
"!_", "(a)",
function(state, a)
return Boolean:new(not a:truthy())
end
},
{
"_&_", "(left, right)",
function(state, left, right)
if left:truthy() then
return right:call(state, ArgumentTuple:new())
else
return left
end
end
},
{
"_|_", "(left, right)",
function(state, left, right)
if left:truthy() then
return left
else
return right:call(state, ArgumentTuple:new())
end
end
},
}