diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-01-18 16:44:11 -0800 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-01-18 16:44:32 -0800 |
| commit | 6021f044907a0a85cf02f38e95093e8d64395bb5 (patch) | |
| tree | 2b23a4e58b360c2573f6356d96199a8cb56cd6c2 | |
| parent | f91d06d9fa567b26a098ff26a0339afdd5daa778 (diff) | |
Fix for lua parsing of long strings/table literals.
| -rw-r--r-- | nomsu.lua | 2 | ||||
| -rwxr-xr-x | nomsu.moon | 2 |
2 files changed, 4 insertions, 0 deletions
@@ -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 @@ -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, "}") |
