From 05d6a89da9268876ad084829f0f0ac2d117cdb6d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 19 Aug 2019 15:31:12 +0100 Subject: [PATCH] [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 -- 2.39.5