diff options
-rw-r--r-- | server/locale/en-US/script.lni | 1 | ||||
-rw-r--r-- | server/locale/zh-CN/script.lni | 1 | ||||
-rw-r--r-- | server/src/parser/ast.lua | 11 |
3 files changed, 12 insertions, 1 deletions
diff --git a/server/locale/en-US/script.lni b/server/locale/en-US/script.lni index e73661e5..f56b8024 100644 --- a/server/locale/en-US/script.lni +++ b/server/locale/en-US/script.lni @@ -60,6 +60,7 @@ PARSER_REDEFINE_LABEL = 'Label `{label}` already defined.' PARSER_UNSUPPORT_SYMBOL = '{version} does not support this grammar.' PARSER_UNEXPECT_DOTS = 'Cannot use `...` outside a vararg function.' PARSER_UNKNOWN_TAG = 'Unknown tag.' +PARSER_MULTI_TAG = 'Dose not support multi tags.' SYMBOL_ANONYMOUS = '<Anonymous>' diff --git a/server/locale/zh-CN/script.lni b/server/locale/zh-CN/script.lni index 16e52552..2b5d33e1 100644 --- a/server/locale/zh-CN/script.lni +++ b/server/locale/zh-CN/script.lni @@ -60,6 +60,7 @@ PARSER_REDEFINE_LABEL = '标签`{label}`重复定义。' PARSER_UNSUPPORT_SYMBOL = '{version} 不支持该符号。' PARSER_UNEXPECT_DOTS = '`...`只能在不定参函数中使用。' PARSER_UNKNOWN_TAG = '不支持的标签。' +PARSER_MULTI_TAG = '只能设置一个标签。' SYMBOL_ANONYMOUS = '<匿名函数>' diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua index 130f497c..ab3bcae0 100644 --- a/server/src/parser/ast.lua +++ b/server/src/parser/ast.lua @@ -841,7 +841,7 @@ local Defs = { return nil end local tags = {...} - for _, tag in ipairs(tags) do + for i, tag in ipairs(tags) do if State.Version ~= 'Lua 5.4' then pushError { type = 'UNSUPPORT_SYMBOL', @@ -861,6 +861,15 @@ local Defs = { tag = tag[1], } } + elseif i > 1 then + pushError { + type = 'MULTI_TAG', + start = tag.start, + finish = tag.finish, + info = { + tag = tag[1], + } + } end end return tags |