commit 05d6a89: [Feature] Lua_selectors: Allow table arguments for selectors
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Aug 19 15:56:14 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-08-19 15:31:12 +0100
URL: https://github.com/rspamd/rspamd/commit/05d6a89da9268876ad084829f0f0ac2d117cdb6d
[Feature] Lua_selectors: Allow table arguments for selectors
---
lualib/lua_selectors/init.lua | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lualib/lua_selectors/init.lua b/lualib/lua_selectors/init.lua
index 35049068b..817330598 100644
--- a/lualib/lua_selectors/init.lua
+++ b/lualib/lua_selectors/init.lua
@@ -214,6 +214,9 @@ local function make_grammar()
local dot = l.P(".")
local semicolon = l.P(":")
local obrace = "(" * spc
+ local tbl_obrace = "{" * spc
+ local eqsign = spc * "=" * spc
+ local tbl_ebrace = spc * "}"
local ebrace = spc * ")"
local comma = spc * "," * spc
local sel_separator = spc * l.S";*" * spc
@@ -225,7 +228,9 @@ local function make_grammar()
PROCESSOR = l.Ct(atom * spc * (obrace * l.V("ARG_LIST") * ebrace)^0),
FUNCTION = l.Ct(atom * spc * (obrace * l.V("ARG_LIST") * ebrace)^0),
METHOD = l.Ct(atom / function(e) return '__' .. e end * spc * (obrace * l.V("ARG_LIST") * ebrace)^0),
- ARG_LIST = l.Ct((argument * comma^0)^0)
+ ARG_LIST = l.Ct((l.V("ARG") * comma^0)^0),
+ ARG = l.Cf(tbl_obrace * l.V("NAMED_ARG") * tbl_ebrace, rawset) + argument,
+ NAMED_ARG = (l.Ct("") * l.Cg(argument * eqsign * argument * comma^0)^0),
}
end
More information about the Commits
mailing list