From 6021f044907a0a85cf02f38e95093e8d64395bb5 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 18 Jan 2018 16:44:11 -0800 Subject: [PATCH] Fix for lua parsing of long strings/table literals. --- nomsu.lua | 2 ++ nomsu.moon | 2 ++ 2 files changed, 4 insertions(+) diff --git a/nomsu.lua b/nomsu.lua index eb193de..911ac29 100644 --- a/nomsu.lua +++ b/nomsu.lua @@ -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 diff --git a/nomsu.moon b/nomsu.moon index d9f0c1d..07f1384 100755 --- a/nomsu.moon +++ b/nomsu.moon @@ -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, "}")