fix string escapes
This commit is contained in:
parent
50183f0aff
commit
a09fdcbf2b
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user