Oops, added "$" to ensure keywords with suffixes don't get changed.

This commit is contained in:
Bruce Hill 2018-09-18 17:41:36 -07:00
parent 884368593d
commit d11f9bc5d3
3 changed files with 11 additions and 11 deletions

View File

@ -13,10 +13,10 @@ test:
"on magenta":45, "on cyan":46, "on white":47 "on magenta":45, "on cyan":46, "on white":47
for %name = %colornum in %colors: for %name = %colornum in %colors:
with {%escapecode:"\027[\(%colornum)m"}: %colornum = "\%colornum"
run "\ (=lua "COMPILE_ACTIONS").%name = (..)
..compile [\%name] to (..) [%nomsu, %tree] -> (..)
Lua value (quote \(quote %escapecode)) Lua value "'\\027[\(%colornum)m'"
compile [\%name %text] to (..) (=lua "COMPILE_ACTIONS")."\%name 1" = (..)
Lua value "\\ [%nomsu, %tree, %text] -> (..)
..(\\(quote \(quote %escapecode))..\\(%text as lua expr).."\\27[0m")"" Lua value "('\\027[\(%colornum)m'..\(%text as lua expr)..'\\027[0m')"

View File

@ -134,7 +134,7 @@ local string2 = {
if match(str, "^_*[abdefgilnortuw][aefhilnoru][acdefiklnoprstu]*$") then if match(str, "^_*[abdefgilnortuw][aefhilnoru][acdefiklnoprstu]*$") then
for _index_0 = 1, #lua_keywords do for _index_0 = 1, #lua_keywords do
local kw = lua_keywords[_index_0] local kw = lua_keywords[_index_0]
if match(str, ("^_*" .. kw)) then if match(str, ("^_*" .. kw .. "$")) then
str = "_" .. str str = "_" .. str
end end
end end
@ -145,7 +145,7 @@ local string2 = {
if match(str, "^_+[abdefgilnortuw][aefhilnoru][acdefiklnoprstu]*$") then if match(str, "^_+[abdefgilnortuw][aefhilnoru][acdefiklnoprstu]*$") then
for _index_0 = 1, #lua_keywords do for _index_0 = 1, #lua_keywords do
local kw = lua_keywords[_index_0] local kw = lua_keywords[_index_0]
if match(str, ("^_+" .. kw)) then if match(str, ("^_+" .. kw .. "$")) then
str = str:sub(2, -1) str = str:sub(2, -1)
end end
end end

View File

@ -67,7 +67,7 @@ string2 = {
-- This pattern is guaranteed to match all keywords, but also matches some other stuff. -- This pattern is guaranteed to match all keywords, but also matches some other stuff.
if match str, "^_*[abdefgilnortuw][aefhilnoru][acdefiklnoprstu]*$" if match str, "^_*[abdefgilnortuw][aefhilnoru][acdefiklnoprstu]*$"
for kw in *lua_keywords for kw in *lua_keywords
if match str, ("^_*"..kw) if match str, ("^_*"..kw.."$")
str = "_"..str str = "_"..str
return str return str
@ -77,7 +77,7 @@ string2 = {
-- This pattern is guaranteed to match all keywords, but also matches some other stuff. -- This pattern is guaranteed to match all keywords, but also matches some other stuff.
if match str, "^_+[abdefgilnortuw][aefhilnoru][acdefiklnoprstu]*$" if match str, "^_+[abdefgilnortuw][aefhilnoru][acdefiklnoprstu]*$"
for kw in *lua_keywords for kw in *lua_keywords
if match str, ("^_+"..kw) if match str, ("^_+"..kw.."$")
str = str\sub(2,-1) str = str\sub(2,-1)
str = gsub(str, "^_(_*%d.*)", "%1") str = gsub(str, "^_(_*%d.*)", "%1")
str = gsub(str, "_", " ") str = gsub(str, "_", " ")