stats.lua: page 4 (keys): detect single-quotes

This commit is contained in:
Avi Halachmi (:avih) 2021-07-28 13:43:57 +03:00 committed by avih
parent 9f6cbf3a4d
commit 8b1930fbd6
1 changed files with 2 additions and 2 deletions

View File

@ -386,10 +386,10 @@ local name_prefixes = {
-- It's decent in practice, and worst case is "incorrect" subject.
local function cmd_subject(cmd)
cmd = cmd:gsub(";.*", ""):gsub("%-", "_") -- only first cmd, s/-/_/
local TOKEN = '^%s*"?([%w_!]*)' -- captures+ends before a (maybe) final "
local TOKEN = '^%s*["\']?([%w_!]*)' -- captures+ends before (maybe) final "
local tok, sname, subw
repeat tok, cmd = cmd:match(TOKEN .. '"?(.*)')
repeat tok, cmd = cmd:match(TOKEN .. '["\']?(.*)')
until not cmd_prefixes[tok]
-- tok is the 1st non-generic command/property name token, cmd is the rest