summaryrefslogtreecommitdiff
path: root/script/parser/grammar.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-14 17:49:33 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-14 17:49:33 +0800
commita00010ff44dff173a6eb5fdd6dc51f47e2b1fbf3 (patch)
tree5197500a32a925a14589765662b90dc373cdce36 /script/parser/grammar.lua
parentf0fd80ee70928ba27775c0fe40de30c7b936bdb0 (diff)
downloadlua-language-server-a00010ff44dff173a6eb5fdd6dc51f47e2b1fbf3.zip
fix #597
Diffstat (limited to 'script/parser/grammar.lua')
-rw-r--r--script/parser/grammar.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/script/parser/grammar.lua b/script/parser/grammar.lua
index 2c046f0e..5120df20 100644
--- a/script/parser/grammar.lua
+++ b/script/parser/grammar.lua
@@ -270,10 +270,10 @@ StringClose <- ']' =eq ']'
]]
grammar 'Number' [[
-Number <- Sp ({} {'-'? NumberDef} {}) -> Number
+Number <- Sp ({} {~ '-'? NumberDef ~} {}) -> Number
NumberSuffix?
ErrNumber?
-NumberDef <- Number16 / Number10
+NumberDef <- Number16 / Integer2 / Number10
NumberSuffix<- ({} {[uU]? [lL] [lL]}) -> FFINumber
/ ({} {[iI]}) -> ImaginaryNumber
ErrNumber <- ({} {([0-9a-zA-Z] / '.')+}) -> UnknownSymbol
@@ -293,6 +293,9 @@ Float16 <- '.' X16+
/ '.' ({} {Word*}) -> MustX16
Float16Exp <- [pP] [+-]? [0-9]+
/ ({} [pP] [+-]? {}) -> MissExponent
+
+Integer2 <- ({} '0' [bB] {[01]+})
+ -> Integer2
]]
grammar 'Name' [[