diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2024-06-07 12:05:21 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2024-06-07 12:05:21 -0300 |
commit | 2751039739e5357beb8e858a25e21e2bc0344fe8 (patch) | |
tree | 77c9aea48a47bc4ef113df851562d18129bb4771 /src/cratera/compiler.lua | |
parent | d865925d050f13e1097721d2b1f3ae352b49c484 (diff) |
Fix strange misplaced semicolon issue
FIXME: rewrite the compiler, properly
Diffstat (limited to 'src/cratera/compiler.lua')
-rw-r--r-- | src/cratera/compiler.lua | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/cratera/compiler.lua b/src/cratera/compiler.lua index cb0681f..6b188ef 100644 --- a/src/cratera/compiler.lua +++ b/src/cratera/compiler.lua @@ -169,7 +169,9 @@ defs[parser.FALLBACK] = function(state, token) -- keep going i = i - 3 elseif results[i-2] == TK.FUNCTION then -- we're in funcname - find_statement = false -- don't even bother with : handling + -- funcname is of the form Name {'.' Name} ':' + -- TODO how can we parse 'function Foo:[Bar].Baz()'... + find_statement = false break else -- found start of statement @@ -381,19 +383,17 @@ defs[parser.FALLBACK] = function(state, token) results.n = results.n + 1 end -- inject cratera - table.insert(results, pos, ')') table.insert(results, pos, CRATERA_FUNCTION) - table.insert(results, pos, '(') -- check for potential prefixexp and correct for it - if is_tk(results, pos-1, ']') or - is_tk(results, pos-1, '}') or - is_tk(results, pos-1, ')') or - results[pos-2] == TK.NAME or - results[pos-2] == TK.STRING then - table.insert(results, pos, ';') - results.n = results.n + 1 - end - results.n = results.n + 3 + --if is_tk(results, pos-1, ']') or + -- is_tk(results, pos-1, '}') or + -- is_tk(results, pos-1, ')') or + -- results[pos-2] == TK.NAME or + -- results[pos-2] == TK.STRING then + -- table.insert(results, pos, ' ') + -- results.n = results.n + 1 + --end + results.n = results.n + 1 -- tag it so we know to insert a ')' to close our '(' -- and to handle '(' ')' (no argument) calls -- we add the tag before TK.STRING/'{'/',' |