mark position of table self assigns to not confuse linter

This commit is contained in:
leaf corcoran 2015-02-28 11:52:14 -08:00
parent 2d5dd107d4
commit 09a2a5c545
3 changed files with 5 additions and 5 deletions

View File

@ -167,7 +167,7 @@ do
local sc = self.statement_compilers
self.statement_compilers = setmetatable({
assign = function(block, node)
local _, names, values = unpack(node)
local names = node[2]
for _index_0 = 1, #names do
local _continue_0 = false
repeat

View File

@ -76,7 +76,7 @@ class LinterBlock extends Block
sc = @statement_compilers
@statement_compilers = setmetatable {
assign: (block, node) ->
_, names, values = unpack node
names = node[2]
-- extract the names to be declared
for name in *names
-- don't include autogenerated names

View File

@ -277,8 +277,8 @@ local function check_lua_string(str, pos, right, left)
end
-- :name in table literal
local function self_assign(name)
return {{"key_literal", name}, name}
local function self_assign(name, pos)
return {{"key_literal", name}, {"ref", name, [-1] = pos}}
end
local err_msg = "Failed to parse:%s\n [%d] >> %s"
@ -552,7 +552,7 @@ local build_grammar = wrap_env(function()
op"*" + op"^" +
Ct(NameList) * (sym"=" * Ct(ExpListLow))^-1) / mark"export",
KeyValue = (sym":" * -SomeSpace * Name) / self_assign + Ct((KeyName + sym"[" * Exp * sym"]" + DoubleString + SingleString) * symx":" * (Exp + TableBlock)),
KeyValue = (sym":" * -SomeSpace * Name * lpeg.Cp()) / self_assign + Ct((KeyName + sym"[" * Exp * sym"]" + DoubleString + SingleString) * symx":" * (Exp + TableBlock)),
KeyValueList = KeyValue * (sym"," * KeyValue)^0,
KeyValueLine = CheckIndent * KeyValueList * sym","^-1,