diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-26 17:17:39 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-26 17:17:39 +0800 |
commit | 8a37a08d8610602295486e8a60b1938ac5df6092 (patch) | |
tree | 676900c81f75a41288a29afb5c10866ddb69bba8 /server | |
parent | 3702ece04522631c6e62a5ff99140e682b76cfca (diff) | |
download | lua-language-server-8a37a08d8610602295486e8a60b1938ac5df6092.zip |
更新语法解析
Diffstat (limited to 'server')
-rw-r--r-- | server/src/parser/grammar.lua | 25 | ||||
-rw-r--r-- | server/test/completion/init.lua | 12 |
2 files changed, 24 insertions, 13 deletions
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua index 2da20161..2cbc6d34 100644 --- a/server/src/parser/grammar.lua +++ b/server/src/parser/grammar.lua @@ -357,7 +357,7 @@ FuncArg <- PL {} ArgList {} NeedPR / {} {} -> MissPL Nothing {} FunctionBody<- FUNCTION FuncArg LabelStart - (!END Action)* + (Emmy / !END Action)* LabelEnd NeedEnd @@ -371,8 +371,7 @@ Emmy <- '---@' ]] grammar 'Action' [[ -Action <- Emmy - / Sp (CrtAction / UnkAction) +Action <- Sp (CrtAction / UnkAction) CrtAction <- Semicolon / Do / Break @@ -403,7 +402,7 @@ SimpleList <- (Simple (COMMA Simple)*) Do <- Sp ({} DO DoBody NeedEnd {}) -> Do -DoBody <- (!END Action)* +DoBody <- (Emmy / !END Action)* -> DoBody Break <- BREAK ({} Semicolon* AfterBreak?) @@ -432,15 +431,15 @@ IfBody <- IfHead (ElsePart -> ElseBlock)? NeedEnd IfPart <- IF DirtyExp THEN - {} (!ELSEIF !ELSE !END Action)* {} + {} (Emmy / !ELSEIF !ELSE !END Action)* {} / IF DirtyExp {}->MissThen {} {} ElseIfPart <- ELSEIF DirtyExp THEN - {} (!ELSE !ELSEIF !END Action)* {} + {} (Emmy / !ELSE !ELSEIF !END Action)* {} / ELSEIF DirtyExp {}->MissThen {} {} ElsePart <- ELSE - {} (!END Action)* {} + {} (Emmy / !END Action)* {} For <- Loop / In / FOR @@ -449,7 +448,7 @@ Loop <- Sp ({} LoopBody {}) -> Loop LoopBody <- FOR LoopStart LoopFinish LoopStep NeedDo BreakStart - (!END Action)* + (Emmy / !END Action)* BreakEnd NeedEnd LoopStart <- MustName ASSIGN DirtyExp @@ -462,7 +461,7 @@ In <- Sp ({} InBody {}) -> In InBody <- FOR InNameList NeedIn ExpList NeedDo BreakStart - (!END Action)* + (Emmy / !END Action)* BreakEnd NeedEnd InNameList <- &IN DirtyName @@ -472,7 +471,7 @@ While <- Sp ({} WhileBody {}) -> While WhileBody <- WHILE DirtyExp NeedDo BreakStart - (!END Action)* + (Emmy / !END Action)* BreakEnd NeedEnd @@ -480,7 +479,7 @@ Repeat <- Sp ({} RepeatBody {}) -> Repeat RepeatBody <- REPEAT BreakStart - (!UNTIL Action)* + (Emmy / !UNTIL Action)* BreakEnd NeedUntil DirtyExp @@ -503,7 +502,7 @@ NamedFunction FunctionNamedBody <- FUNCTION FuncName FuncArg LabelStart - (!END Action)* + (Emmy / !END Action)* LabelEnd NeedEnd FuncName <- (MustName (DOT MustName)* FuncMethod?) @@ -593,7 +592,7 @@ EmmySee <- MustEmmyName '#' MustEmmyName grammar 'Lua' [[ Lua <- Head? LabelStart - Action* -> Lua + (Emmy / Action)* -> Lua LabelEnd Sp Head <- '#' (!%nl .)* diff --git a/server/test/completion/init.lua b/server/test/completion/init.lua index aa310d30..eb30d9a0 100644 --- a/server/test/completion/init.lua +++ b/server/test/completion/init.lua @@ -930,3 +930,15 @@ function f($) kind = CompletionItemKind.Interface, }, } + +TEST [[ +local function f() + ---@t$ +end +]] +{ + { + label = 'type', + kind = CompletionItemKind.Keyword, + } +} |