Skip to content

Commit 8d17632

Browse files
committed
refactor: parse custom enum names from @enum payload
1 parent 2aceea0 commit 8d17632

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎scripts/luals-type-parser.lua‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ local FLAG_TAGS = {
447447
package = true,
448448
deprecated = true,
449449
ignore = true,
450-
enum = true,
451450
}
452451

453452
local function parse_tags(tag_items)
@@ -500,6 +499,8 @@ local function parse_tags(tag_items)
500499
append_parsed_tag(tags, parsed.key, payload, parsed.parser)
501500
elseif tag == "generic" then
502501
tags.generic = split_commas(payload)
502+
elseif tag == "enum" then
503+
tags.enum = payload ~= "" and payload or true
503504
elseif FLAG_TAGS[tag] then
504505
tags[tag] = true
505506
elseif tag == "class" then
@@ -1049,9 +1050,13 @@ local function parse(source)
10491050
return false
10501051
end
10511052
local depth = 1 + count_braces(rest)
1053+
local actual_name = enum_tags.enum
1054+
if type(actual_name) ~= "string" or actual_name == "" then
1055+
actual_name = enum_name
1056+
end
10521057
enum_tags.enum = nil
10531058
enum_capture = {
1054-
name = enum_name,
1059+
name = actual_name,
10551060
desc = join_desc(desc_lines),
10561061
lines = { rest },
10571062
depth = depth,

0 commit comments

Comments
 (0)