Fix for lua parsing of long strings/table literals.

This commit is contained in:
Bruce Hill 2018-01-18 16:44:11 -08:00
parent f91d06d9fa
commit 6021f04490
2 changed files with 4 additions and 0 deletions

View File

@ -1120,6 +1120,8 @@ do
local key_str = key_lua.expr:match([=[["']([a-zA-Z_][a-zA-Z0-9_]*)['"]]=])
if key_str then
insert(items, tostring(key_str) .. "=" .. tostring(value_lua.expr))
elseif key_lua.expr:sub(1, 1) == "[" then
insert(items, "[ " .. tostring(key_lua.expr) .. "]=" .. tostring(value_lua.expr))
else
insert(items, "[" .. tostring(key_lua.expr) .. "]=" .. tostring(value_lua.expr))
end

View File

@ -739,6 +739,8 @@ class NomsuCompiler
key_str = key_lua.expr\match([=[["']([a-zA-Z_][a-zA-Z0-9_]*)['"]]=])
if key_str
insert items, "#{key_str}=#{value_lua.expr}"
elseif key_lua.expr\sub(1,1) == "["
insert items, "[ #{key_lua.expr}]=#{value_lua.expr}"
else
insert items, "[#{key_lua.expr}]=#{value_lua.expr}"
return expr:@@comma_separated_items("{", items, "}")