mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-18 15:08:31 +01:00
solve union with comments #241
This commit is contained in:
@@ -346,7 +346,7 @@ local function getRE()
|
||||
return res,resN
|
||||
end
|
||||
local function isLeaf(re)
|
||||
return (re ~= "typedef_st_re" and re ~= "struct_re" and re~="namespace_re" and re~="class_re")
|
||||
return (re ~= "typedef_st_re" and re ~= "struct_re" and re~="namespace_re" and re~="class_re" and re~="union_re")
|
||||
end
|
||||
M.getRE = getRE
|
||||
--takes preprocesed file in table cdefsor and returns items
|
||||
@@ -1322,6 +1322,7 @@ function M.Parser()
|
||||
ini = e + 1
|
||||
i,e,a = txt:find(reg,ini)
|
||||
end
|
||||
table.insert(txtclean,txt:sub(ini,-1))
|
||||
return table.concat(txtclean)
|
||||
end
|
||||
function par:parseItems()
|
||||
@@ -1375,6 +1376,7 @@ function M.Parser()
|
||||
print("end cleaning ------------------------------",nn)
|
||||
txt = table.concat(txtclean)
|
||||
end
|
||||
--save_data("./preparse"..tostring(self):gsub("table: ","")..".c",txt)
|
||||
--]]
|
||||
self.itemsarr = par:parseItemsR2(txt)
|
||||
itemsarr = self.itemsarr
|
||||
@@ -1448,8 +1450,9 @@ function M.Parser()
|
||||
return ""
|
||||
end --here we avoid empty structs
|
||||
for j,it in ipairs(itlist) do
|
||||
if (it.re_name == "vardef_re" or it.re_name == "functype_re" or it.re_name == "union_re") then
|
||||
if (it.re_name == "vardef_re" or it.re_name == "functype_re") then -- or it.re_name == "union_re") then
|
||||
if not (it.re_name == "vardef_re" and it.item:match"static") then --skip static variables
|
||||
|
||||
local it2 = it.item --:gsub("<([%w_]+)>","_%1") --templates
|
||||
--local ttype,template = it.item:match("([^%s,%(%)]+)%s*<(.+)>")
|
||||
local ttype,template,te,code2 = check_template(it2) --it.item:match"([^%s,%(%)]+)%s*<(.+)>"
|
||||
@@ -1475,6 +1478,15 @@ function M.Parser()
|
||||
table.insert(outtab,it2)
|
||||
table.insert(commtab,{above=it.prevcomments,sameline=it.comments})--it.comments or "")
|
||||
end
|
||||
elseif it.re_name == "union_re" then
|
||||
local com = ""
|
||||
for _,ch in ipairs(it.childs) do
|
||||
com = com .. (ch.comments or "")
|
||||
end
|
||||
local item = clean_comments(it.item)
|
||||
table.insert(outtab,item)
|
||||
com = (com ~= "") and com or nil
|
||||
table.insert(commtab,{above=it.prevcomments,sameline=com})
|
||||
elseif it.re_name == "struct_re" then
|
||||
--check if has declaration
|
||||
local decl = it.item:match"%b{}%s*([^%s}{]+)%s*;"
|
||||
|
Reference in New Issue
Block a user