diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-01-07 10:19:24 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-01-07 10:19:24 +0800 |
commit | de63af45054e742806f6f4cc78e2819b12c364e6 (patch) | |
tree | 5551e1b50f8ed12f32dc9b72bcbb028990d7cede /server/src | |
parent | a55bc60e412ac97ca90d4dc4f13c15f58b0a6cdb (diff) | |
download | lua-language-server-de63af45054e742806f6f4cc78e2819b12c364e6.zip |
跳过动作
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/core/vm.lua | 4 | ||||
-rw-r--r-- | server/src/parser/ast.lua | 3 | ||||
-rw-r--r-- | server/src/parser/grammar.lua | 8 |
3 files changed, 12 insertions, 3 deletions
diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua index 36a8f21b..a17727d6 100644 --- a/server/src/core/vm.lua +++ b/server/src/core/vm.lua @@ -1383,6 +1383,10 @@ function mt:doLocalFunction(action) end function mt:doAction(action) + if not action then + -- Skip + return + end local tp = action.type if tp == 'do' then self:doDo(action) diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua index d08db694..993a4914 100644 --- a/server/src/parser/ast.lua +++ b/server/src/parser/ast.lua @@ -379,6 +379,9 @@ local defs = { Nothing = function () return nil end, + Skip = function () + return false + end, Set = function (keys, values) return { type = 'set', diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua index 133ffbbd..6dfbeed6 100644 --- a/server/src/parser/grammar.lua +++ b/server/src/parser/grammar.lua @@ -75,8 +75,8 @@ end local function errorpos(pos, err) return { type = 'UNKNOWN', - start = pos, - finish = pos, + start = pos or 0, + finish = pos or 0, err = err, } end @@ -351,7 +351,7 @@ Set <- END grammar 'Action' [[ Action <- Sp (CrtAction / UnkAction) -CrtAction <- SEMICOLON +CrtAction <- Semicolon / Do / Break / Return @@ -372,6 +372,8 @@ UnkAction <- ({} {Word+}) / ({} {. (!Sps !CrtAction .)*}) -> UnknownSymbol +Semicolon <- SEMICOLON + -> Skip SimpleList <- (Simple (COMMA Simple)*) -> List |