lualoader: position hyphens at the beginning of character classes
According to the Lua 5.4 manual section 6.4.1 ("Patterns"), the interaction between ranges and classes is not defined and hyphens must be specified at either the beginning or the end of a set if they are not escaped. Move all such occurrences to the beginning. Reported-by: _parv (twitter) MFC-after: 3 days
This commit is contained in:
parent
e027e24bfa
commit
b24872cf7b
@ -62,10 +62,10 @@ local MSG_FAILSYN_EOLESC = "Stray escape at end of line"
|
|||||||
local MSG_FAILSYN_EOLVAR = "Unescaped $ at end of line"
|
local MSG_FAILSYN_EOLVAR = "Unescaped $ at end of line"
|
||||||
local MSG_FAILSYN_BADVAR = "Malformed variable expression at position '%d'"
|
local MSG_FAILSYN_BADVAR = "Malformed variable expression at position '%d'"
|
||||||
|
|
||||||
local MODULEEXPR = '([%w-_]+)'
|
local MODULEEXPR = '([-%w_]+)'
|
||||||
local QVALEXPR = '"(.*)"'
|
local QVALEXPR = '"(.*)"'
|
||||||
local QVALREPL = QVALEXPR:gsub('%%', '%%%%')
|
local QVALREPL = QVALEXPR:gsub('%%', '%%%%')
|
||||||
local WORDEXPR = "([%w%d-][%w%d-_.]*)"
|
local WORDEXPR = "([-%w%d][-%w%d_.]*)"
|
||||||
local WORDREPL = WORDEXPR:gsub('%%', '%%%%')
|
local WORDREPL = WORDEXPR:gsub('%%', '%%%%')
|
||||||
|
|
||||||
-- Entries that should never make it into the environment; each one should have
|
-- Entries that should never make it into the environment; each one should have
|
||||||
@ -182,7 +182,7 @@ local function processEnvVar(value)
|
|||||||
-- Skip the $
|
-- Skip the $
|
||||||
vinit = i + 1
|
vinit = i + 1
|
||||||
vdelim = nil
|
vdelim = nil
|
||||||
vpat = "^([%w][%w%d-_.]*)"
|
vpat = "^([%w][-%w%d_.]*)"
|
||||||
end
|
end
|
||||||
|
|
||||||
local name = value:match(vpat, vinit)
|
local name = value:match(vpat, vinit)
|
||||||
@ -346,7 +346,7 @@ local function getBlacklist()
|
|||||||
return blacklist
|
return blacklist
|
||||||
end
|
end
|
||||||
|
|
||||||
for mod in blacklist_str:gmatch("[;, ]?([%w-_]+)[;, ]?") do
|
for mod in blacklist_str:gmatch("[;, ]?([-%w_]+)[;, ]?") do
|
||||||
blacklist[mod] = true
|
blacklist[mod] = true
|
||||||
end
|
end
|
||||||
return blacklist
|
return blacklist
|
||||||
|
Loading…
Reference in New Issue
Block a user