diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-23 21:33:58 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-23 21:33:58 +0800 |
commit | a4d7980a4d648b2baf54a6adefb1758d037424b3 (patch) | |
tree | bed83bfbf036bc6ffba3e6b58c12f545b5c7259d /server/src/parser/grammar.lua | |
parent | ef7e113a22eebdf6c56b0060c93cdf9df372d3d8 (diff) | |
download | lua-language-server-a4d7980a4d648b2baf54a6adefb1758d037424b3.zip |
修正某些脚本文件解析速度极慢的BUG
Diffstat (limited to 'server/src/parser/grammar.lua')
-rw-r--r-- | server/src/parser/grammar.lua | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua index b5e083e6..00c3dbdb 100644 --- a/server/src/parser/grammar.lua +++ b/server/src/parser/grammar.lua @@ -184,18 +184,18 @@ UnaryList <- NOT / '~' !'=' POWER <- Sp {'^'} -BinaryOp <- {} {'or'} Cut - / {} {'and'} Cut - / {} {'<=' / '>=' / '<'!'<' / '>'!'>' / '~=' / '=='} - / {} {'|'} - / {} {'~'} - / {} {'&'} - / {} {'<<' / '>>'} - / {} {'..'} !'.' - / {} {'+' / '-'} - / {} {'*' / '//' / '/' / '%'} - / {} {'^'} -UnaryOp <- {} {'not' Cut / '#' / '~' / '-'} +BinaryOp <- Sp {} {'or'} Cut + / Sp {} {'and'} Cut + / Sp {} {'<=' / '>=' / '<'!'<' / '>'!'>' / '~=' / '=='} + / Sp {} {'|'} + / Sp {} {'~'} + / Sp {} {'&'} + / Sp {} {'<<' / '>>'} + / Sp {} {'..'} !'.' + / Sp {} {'+' / '-'} + / Sp {} {'*' / '//' / '/' / '%'} + / Sp {} {'^'} +UnaryOp <- Sp {} {'not' Cut / '#' / '~' !'=' / '-' !'-'} PL <- Sp '(' PR <- Sp ')' @@ -290,9 +290,10 @@ DirtyName <- {} -> DirtyName ]] grammar 'Exp' [[ -Exp <- ((Sp (UnaryOp / ExpUnit Sp BinaryOp))+ (Sp ExpUnit / {}->DirtyExp)) +Exp <- (UnUnit (BinaryOp (UnUnit / {} -> DirtyExp))*) -> Exp - / Sp ExpUnit +UnUnit <- ExpUnit + / UnaryOp+ (ExpUnit / {} -> DirtyExp) ExpUnit <- Nil / Boolean / String |