summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-11-02 15:08:07 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-11-02 15:08:07 +0800
commitd7e96432ccd7f736c0f269ccca68cf4b840927db (patch)
tree4553b30cfdba02b603e9ed73edbdbca0fd9c3525
parent310b96f3e4b285a3a8422745ab01a32ca144e91a (diff)
downloadlua-language-server-d7e96432ccd7f736c0f269ccca68cf4b840927db.zip
resolve #747 `LuaDoc` supports unicode
-rw-r--r--changelog.md1
-rw-r--r--script/parser/luadoc.lua6
-rw-r--r--test/type_inference/init.lua5
3 files changed, 9 insertions, 3 deletions
diff --git a/changelog.md b/changelog.md
index 1bf21c38..12830ff8 100644
--- a/changelog.md
+++ b/changelog.md
@@ -4,6 +4,7 @@
* `NEW` setting `Lua.runtime.pathStrict`
* `NEW` add supports of `lovr`
* `NEW` file encoding supports `utf16le` and `utf16be`
+* `CHG` `LuaDoc` supports unicode
* `CHG` no longer asks to trust plugin in VSCode, because VSCode already provides the workspace trust feature
* `CHG` skip huge files (>= 10 MB)
* `FIX` [#778](https://github.com/sumneko/lua-language-server/issues/778)
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index e21e7c19..2682e2d4 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -10,9 +10,8 @@ local Parser = re.compile([[
Main <- (Token / Sp)*
Sp <- %s+
X16 <- [a-fA-F0-9]
-Word <- [a-zA-Z0-9_]
Token <- Integer / Name / String / Symbol
-Name <- ({} {[a-zA-Z_0-9] [a-zA-Z0-9_.*-]*} {})
+Name <- ({} {%name} {})
-> Name
Integer <- ({} {[0-9]+} !'.' {})
-> Integer
@@ -45,7 +44,7 @@ EChar <- 'a' -> ea
/ ('z' (%nl / %s)*) -> ''
/ ('x' {X16 X16}) -> Char16
/ ([0-9] [0-9]? [0-9]?) -> Char10
- / ('u{' {Word*} '}') -> CharUtf8
+ / ('u{' {X16*} '}') -> CharUtf8
Symbol <- ({} {
[:|,<>()?+#`{}]
/ '[]'
@@ -63,6 +62,7 @@ Symbol <- ({} {
er = '\r',
et = '\t',
ev = '\v',
+ name = (m.R('az', 'AZ', '09', '\x80\xff') + m.S('_')) * (m.R('az', 'AZ', '__', '09', '\x80\xff') + m.S('_.*-'))^0,
Char10 = function (char)
char = tonumber(char)
if not char or char < 0 or char > 255 then
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index ac300fcb..135f6749 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -925,3 +925,8 @@ local emit = {}
emit:on("died", function (<?i?>)
end)
]]
+
+TEST '👍' [[
+---@class 👍
+local <?x?>
+]]