add pipe, lambda shorts

This commit is contained in:
Dmitriy Pleshevskiy 2024-04-20 16:51:00 +03:00
parent 6f94ad4a53
commit 278cd32830
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2

20
lib.nix
View file

@ -119,8 +119,8 @@ let
local = expr: spaceBetween [ kw_local expr ];
set = variable: value: join " = " [ (raw variable) value ];
func = fnName: params: body:
(concatLines
func' = fnName: params: body:
(spaceBetween
([
(concat [
(spaceBetween [ kw_function (validFuncName fnName) ])
@ -130,7 +130,10 @@ let
++ body
++ [ kw_end ])
);
lambda = func "";
func = fnName: params: body:
func' fnName params (concatLines body);
lambda = func' "";
lambda0 = lambda [ ];
return = expr: spaceBetween ([ kw_return expr ]);
return_void = return null;
@ -195,8 +198,13 @@ in
inherit toLua;
inherit LuaNil;
inherit raw join concat concatLines pipe;
inherit namedField call require local set func ifelse if';
inherit raw join concat concatLines;
inherit pipe pipe1;
inherit namedField require local set ifelse if';
inherit call call0 call1;
inherit func lambda lambda0;
inherit op;
inherit eq ne gt lt gte lte;
@ -208,8 +216,6 @@ in
# useful aliases
var = raw;
vars = map raw;
inherit call0 call1;
inherit lambda;
inherit validString;
}