diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-11-17 14:22:04 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-11-17 14:22:04 +0800 |
commit | db0c04a5f59ecdb7c57610f6abb56f6407551b60 (patch) | |
tree | 0299776aca183490a79820adda3afa15f73fc888 /server-beta/src/parser | |
parent | 1f6d6ef0e134659ab55ed0ad5d380676a5983cd9 (diff) | |
download | lua-language-server-db0c04a5f59ecdb7c57610f6abb56f6407551b60.zip |
更新语法解析
Diffstat (limited to 'server-beta/src/parser')
-rw-r--r-- | server-beta/src/parser/ast.lua | 10 | ||||
-rw-r--r-- | server-beta/src/parser/grammar.lua | 4 |
2 files changed, 13 insertions, 1 deletions
diff --git a/server-beta/src/parser/ast.lua b/server-beta/src/parser/ast.lua index ff5a6ae1..c5303796 100644 --- a/server-beta/src/parser/ast.lua +++ b/server-beta/src/parser/ast.lua @@ -661,6 +661,16 @@ local Defs = { end return e end, + SubBinary = function (op, symb) + if symb then + return op, symb + end + PushError { + type = 'MISS_EXP', + start = op.start, + finish = op.finish, + } + end, Binary = function (first, op, second, ...) if not first then return second diff --git a/server-beta/src/parser/grammar.lua b/server-beta/src/parser/grammar.lua index b64f6277..48e2f86e 100644 --- a/server-beta/src/parser/grammar.lua +++ b/server-beta/src/parser/grammar.lua @@ -297,8 +297,10 @@ DirtyName <- {} -> DirtyName ]] grammar 'Exp' [[ -Exp <- (UnUnit (BinaryOp UnUnit / BinaryOp->None MissExp)*) +Exp <- (UnUnit BinUnit*) -> Binary +BinUnit <- (BinaryOp UnUnit?) + -> SubBinary UnUnit <- ExpUnit / (UnaryOp+ (ExpUnit / MissExp)) -> Unary |