diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-10 09:49:46 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-10 09:49:46 +0800 |
commit | 1e07791ab99b76f5f2b01b1ad1d470272cd662ae (patch) | |
tree | ad9cbebe1157dca314f4f6421a3ad800f84ea07f /server/src | |
parent | ccdf6ab348809be38e7e8257941f7d1208486ce9 (diff) | |
download | lua-language-server-1e07791ab99b76f5f2b01b1ad1d470272cd662ae.zip |
更新LuaParser
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/parser/ast.lua | 9 | ||||
-rw-r--r-- | server/src/parser/grammar.lua | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua index 508252ae..8bb12959 100644 --- a/server/src/parser/ast.lua +++ b/server/src/parser/ast.lua @@ -298,12 +298,15 @@ local Defs = { start = pos-1, finish = pos, } - return '' + return char end return string_char(tonumber(char, 16)) end, CharUtf8 = function (pos, char) - if State.Version ~= 'Lua 5.3' and State.Version ~= 'Lua 5.4' then + if State.Version ~= 'Lua 5.3' + and State.Version ~= 'Lua 5.4' + and State.Version ~= 'LuaJIT' + then pushError { type = 'ERR_ESC', start = pos-3, @@ -425,8 +428,8 @@ local Defs = { version = State.Version, } } - State.LastNumber[1] = 0 end + State.LastNumber[1] = 0 end, Name = function (start, str, finish) local isKeyWord diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua index 656f98da..d0a2baaf 100644 --- a/server/src/parser/grammar.lua +++ b/server/src/parser/grammar.lua @@ -255,10 +255,11 @@ StringClose <- ']' =eq ']' grammar 'Number' [[ Number <- Sp ({} {NumberDef} {}) -> Number NumberSuffix? + ErrNumber? NumberDef <- Number16 / Number10 NumberSuffix<- ({} {[uU]? [lL] [lL]}) -> FFINumber / ({} {[iI]}) -> ImaginaryNumber - / ({} {([0-9a-zA-Z] / '.')+}) -> UnknownSymbol +ErrNumber <- ({} {([0-9a-zA-Z] / '.')+}) -> UnknownSymbol Number10 <- Float10 Float10Exp? / Integer10 Float10? Float10Exp? |