fix string escapes

This commit is contained in:
Redo 2022-11-01 20:58:59 -06:00
parent 50183f0aff
commit a09fdcbf2b

View File

@ -180,6 +180,8 @@ local function evaluateExpression(expr)
return eval
end
local function preprocessCode(code)
code = "\n"..code.."\n"
local curscope = ""
local codet = {}
local wordt = {}
@ -340,12 +342,14 @@ local function prefixCode(code, fn) -- fix strings, add line numbers
elseif c=="\"" then state = "code"
else outn(c:byte()) end
elseif state=="stringesc" then
out(stringEscapes[c] or error("invalid escape "..c)); state = "string";
outn(string.byte(stringEscapes[c] or error("invalid escape "..c))); state = "string";
end
end
assert(#bracestack==0, "unclosed brace")
local code2 = table.concat(outt)
print(code2)
return code2
end
local function fixFilename(fn)