aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_selectors
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-19 15:31:12 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-19 15:31:12 +0100
commit05d6a89da9268876ad084829f0f0ac2d117cdb6d (patch)
tree1584f5f4cc7db1964138890c4486d130865e6b67 /lualib/lua_selectors
parentfd1a18558f1f467d05059b9dc6cf6af52dc22594 (diff)
downloadrspamd-05d6a89da9268876ad084829f0f0ac2d117cdb6d.tar.gz
rspamd-05d6a89da9268876ad084829f0f0ac2d117cdb6d.zip
[Feature] Lua_selectors: Allow table arguments for selectors
Diffstat (limited to 'lualib/lua_selectors')
-rw-r--r--lualib/lua_selectors/init.lua7
1 files changed, 6 insertions, 1 deletions
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