diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-11-16 15:32:35 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-11-16 15:32:35 +0000 |
commit | 06062be5ce8e08bf87c28bb0eb0a486fbb26a167 (patch) | |
tree | d9bb2360392f1fa3ecc9e966afc517f98467fd59 /lualib/lua_selectors | |
parent | e1a73af0a8c25968e9e4c3bf6ba91bc94b3249af (diff) | |
download | rspamd-06062be5ce8e08bf87c28bb0eb0a486fbb26a167.tar.gz rspamd-06062be5ce8e08bf87c28bb0eb0a486fbb26a167.zip |
[Minor] Relax arguments grammar for selectors
Diffstat (limited to 'lualib/lua_selectors')
-rw-r--r-- | lualib/lua_selectors/init.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lualib/lua_selectors/init.lua b/lualib/lua_selectors/init.lua index 811c5cd50..22877f513 100644 --- a/lualib/lua_selectors/init.lua +++ b/lualib/lua_selectors/init.lua @@ -243,10 +243,14 @@ local function make_grammar() local utf8_high = l.R("\194\223") * cont + l.R("\224\239") * cont * cont + l.R("\240\244") * cont * cont * cont - local atom = l.C((l.R("az") + l.R("AZ") + l.R("09") + l.S("_-") + utf8_high) ^ 1) + local atom_start = (l.R("az") + l.R("AZ") + l.R("09") + utf8_high) ^ 1 + local atom_end = (l.R("az") + l.R("AZ") + l.R("09") + l.S "-_" + utf8_high) ^ 1 + local atom_mid = (1 - l.S("'\r\n\f\\,)(}{= " .. '"')) ^ 1 + local atom_argument = l.C(atom_start * atom_mid ^ 0 * atom_end ^ 0) -- We allow more characters for the arguments + local atom = l.C(atom_start * atom_end ^ 0) -- We are more strict about selector names itself local singlequoted_string = l.P "'" * l.C(((1 - l.S "'\r\n\f\\") + (l.P '\\' * 1)) ^ 0) * "'" local doublequoted_string = l.P '"' * l.C(((1 - l.S '"\r\n\f\\') + (l.P '\\' * 1)) ^ 0) * '"' - local argument = atom + singlequoted_string + doublequoted_string + local argument = atom_argument + singlequoted_string + doublequoted_string local dot = l.P(".") local semicolon = l.P(":") local obrace = "(" * spc |