fix string escapes
This commit is contained in:
parent
50183f0aff
commit
a09fdcbf2b
@ -180,6 +180,8 @@ local function evaluateExpression(expr)
|
|||||||
return eval
|
return eval
|
||||||
end
|
end
|
||||||
local function preprocessCode(code)
|
local function preprocessCode(code)
|
||||||
|
code = "\n"..code.."\n"
|
||||||
|
|
||||||
local curscope = ""
|
local curscope = ""
|
||||||
local codet = {}
|
local codet = {}
|
||||||
local wordt = {}
|
local wordt = {}
|
||||||
@ -340,12 +342,14 @@ local function prefixCode(code, fn) -- fix strings, add line numbers
|
|||||||
elseif c=="\"" then state = "code"
|
elseif c=="\"" then state = "code"
|
||||||
else outn(c:byte()) end
|
else outn(c:byte()) end
|
||||||
elseif state=="stringesc" then
|
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
|
||||||
end
|
end
|
||||||
assert(#bracestack==0, "unclosed brace")
|
assert(#bracestack==0, "unclosed brace")
|
||||||
local code2 = table.concat(outt)
|
local code2 = table.concat(outt)
|
||||||
|
|
||||||
|
print(code2)
|
||||||
|
|
||||||
return code2
|
return code2
|
||||||
end
|
end
|
||||||
local function fixFilename(fn)
|
local function fixFilename(fn)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user