diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-25 20:13:42 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-25 20:13:42 +0800 |
commit | 2c6f0f9bf83f9a44c466aaf0d45ed9f8eab6c117 (patch) | |
tree | 96b11b2863b0a1e10158e6ad6cc5df3b8fb74716 /script | |
parent | 7b809496a5a4be6a182d715b264493cb39c98674 (diff) | |
download | lua-language-server-2c6f0f9bf83f9a44c466aaf0d45ed9f8eab6c117.zip |
resolve #1226
semicolons and parentheses can be used in `DocTable`
Diffstat (limited to 'script')
-rw-r--r-- | script/parser/luadoc.lua | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index fdf7718c..06cd5511 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -50,7 +50,7 @@ EChar <- 'a' -> ea / ([0-9] [0-9]? [0-9]?) -> Char10 / ('u{' {X16*} '}') -> CharUtf8 Symbol <- ({} { - [:|,<>()?+#{}] + [:|,;<>()?+#{}] / '[]' / '...' / '[' @@ -286,6 +286,11 @@ local function parseTable(parent) } do + local needCloseParen + if checkToken('symbol', '(', 1) then + nextToken() + needCloseParen = true + end field.name = parseName('doc.field.name', field) or parseIndexField('doc.field.name', field) if not field.name then @@ -312,10 +317,14 @@ local function parseTable(parent) break end field.finish = getFinish() + if needCloseParen then + nextSymbolOrError ')' + end end typeUnit.fields[#typeUnit.fields+1] = field - if checkToken('symbol', ',', 1) then + if checkToken('symbol', ',', 1) + or checkToken('symbol', ';', 1) then nextToken() else nextSymbolOrError('}') |