diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-05-19 15:10:21 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-05-19 15:10:21 +0100 |
commit | 3e684cd1590504ef6509edf75db59a9b7cda219d (patch) | |
tree | 5a2b35e8da47962dc6db55f7abef083598dc317b /lualib/lua_selectors | |
parent | 1cf0d5687baf976760681b0db6eed754555ca89b (diff) | |
download | rspamd-3e684cd1590504ef6509edf75db59a9b7cda219d.tar.gz rspamd-3e684cd1590504ef6509edf75db59a9b7cda219d.zip |
[Minor] Allow utf8 identifiers in the selectors
Diffstat (limited to 'lualib/lua_selectors')
-rw-r--r-- | lualib/lua_selectors/init.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lualib/lua_selectors/init.lua b/lualib/lua_selectors/init.lua index e971e14c3..1d49f4e5d 100644 --- a/lualib/lua_selectors/init.lua +++ b/lualib/lua_selectors/init.lua @@ -216,7 +216,11 @@ end local function make_grammar() local l = require "lpeg" local spc = l.S(" \t\n")^0 - local atom = l.C((l.R("az") + l.R("AZ") + l.R("09") + l.S("_-"))^1) + local cont = l.R("\128\191") -- continuation byte + 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 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 |