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 local sc = self.statement_compilers
self.statement_compilers = setmetatable({ self.statement_compilers = setmetatable({
assign = function(block, node) assign = function(block, node)
local _, names, values = unpack(node) local names = node[2]
for _index_0 = 1, #names do for _index_0 = 1, #names do
local _continue_0 = false local _continue_0 = false
repeat repeat

View File

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

View File

@ -277,8 +277,8 @@ local function check_lua_string(str, pos, right, left)
end end
-- :name in table literal -- :name in table literal
local function self_assign(name) local function self_assign(name, pos)
return {{"key_literal", name}, name} return {{"key_literal", name}, {"ref", name, [-1] = pos}}
end end
local err_msg = "Failed to parse:%s\n [%d] >> %s" local err_msg = "Failed to parse:%s\n [%d] >> %s"
@ -552,7 +552,7 @@ local build_grammar = wrap_env(function()
op"*" + op"^" + op"*" + op"^" +
Ct(NameList) * (sym"=" * Ct(ExpListLow))^-1) / mark"export", 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, KeyValueList = KeyValue * (sym"," * KeyValue)^0,
KeyValueLine = CheckIndent * KeyValueList * sym","^-1, KeyValueLine = CheckIndent * KeyValueList * sym","^-1,