diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-10-10 22:15:21 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-10-10 22:15:21 +0800 |
commit | 046b6785bc62ad8f8b0b95f18cf9cf39fa3bd346 (patch) | |
tree | 0f1c491db66b3f112e3af99e6ac777c01d2c985f /src/parser | |
parent | 1ea77b03f7e976843b3816ff6a55e2997705124d (diff) | |
download | lua-language-server-046b6785bc62ad8f8b0b95f18cf9cf39fa3bd346.zip |
匹配第一个词
Diffstat (limited to 'src/parser')
-rw-r--r-- | src/parser/grammar.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/parser/grammar.lua b/src/parser/grammar.lua index eedbd8da..6f2f9d0a 100644 --- a/src/parser/grammar.lua +++ b/src/parser/grammar.lua @@ -185,7 +185,7 @@ Float16 <- ('.' X16*)? ([pP] [+-]? [1-9]? [0-9]*)? ]] grammar 'Name' [[ -Name <- Sp [a-zA-Z_] [a-zA-Z0-9_]* +Name <- Sp ({} {[a-zA-Z_] [a-zA-Z0-9_]*}) -> Name ]] grammar 'Exp' [[ @@ -233,16 +233,20 @@ TableField <- NewIndex / NewField / Exp NewIndex <- BL Exp BR ASSIGN Exp NewField <- Name ASSIGN Exp -Function <- FUNCTION PL ArgList? PR +Function <- FUNCTION FuncName? PL ArgList? PR (!END Action)* END +FuncName <- FuncPrefix (FuncSuffix)* +FuncPrefix <- Name +FuncSuffix <- DOT Name + / COLON Name -- 纯占位,修改了 `relabel.lua` 使重复定义不抛错 Action <- !. . ]] grammar 'Action' [[ -Action <- SEMICOLON / Do / Break / Return / Label / GoTo / If / For / While / Repeat / Set / Call +Action <- SEMICOLON / Do / Break / Return / Label / GoTo / If / For / While / Repeat / Set / Local / Function / Call ExpList <- Exp (COMMA Exp)* @@ -291,6 +295,9 @@ Repeat <- REPEAT Set <- LOCAL Name ASSIGN Exp / Simple ASSIGN Exp +Local <- LOCAL Function + / LOCAL (Sp {} Name) -> LocalVar + Call <- Prefix (Suffix)* ]] |