From 2c6f0f9bf83f9a44c466aaf0d45ed9f8eab6c117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sat, 25 Jun 2022 20:13:42 +0800 Subject: resolve #1226 semicolons and parentheses can be used in `DocTable` --- script/parser/luadoc.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'script/parser') 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('}') -- cgit v1.2.3