mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-11 12:18:30 +01:00
new parser move templates in struct detection to parseItems
This commit is contained in:
@@ -894,6 +894,14 @@ function M.Parser()
|
|||||||
for j,child in ipairs(it.childs) do
|
for j,child in ipairs(it.childs) do
|
||||||
child.parent = it
|
child.parent = it
|
||||||
end
|
end
|
||||||
|
if it.re_name == "struct_re" then
|
||||||
|
local typename = it.item:match("%s*template%s*<%s*typename%s*(%S+)%s*>")
|
||||||
|
local stname = it.item:match("struct%s+(%S+)")
|
||||||
|
if typename then -- it is a struct template
|
||||||
|
self.typenames = self.typenames or {}
|
||||||
|
self.typenames[stname] = typename
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return itsarr
|
return itsarr
|
||||||
@@ -936,9 +944,7 @@ function M.Parser()
|
|||||||
if it.re_name == "function_re" or it.re_name == "functionD_re" then
|
if it.re_name == "function_re" or it.re_name == "functionD_re" then
|
||||||
self:parseFunction("",it.item,nil,it.locat)
|
self:parseFunction("",it.item,nil,it.locat)
|
||||||
elseif it.re_name == "namespace_re" then
|
elseif it.re_name == "namespace_re" then
|
||||||
--local nsp = it.item:match("%b{}"):sub(2,-2)
|
|
||||||
local namespace = it.item:match("namespace%s+(%S+)")
|
local namespace = it.item:match("namespace%s+(%S+)")
|
||||||
--local nspparr,itemsnsp = parseItems(nsp,false,it.locat)
|
|
||||||
local nspparr = it.childs
|
local nspparr = it.childs
|
||||||
for insp,itnsp in ipairs(nspparr) do
|
for insp,itnsp in ipairs(nspparr) do
|
||||||
if itnsp.re_name == "function_re" or itnsp.re_name == "functionD_re" then
|
if itnsp.re_name == "function_re" or itnsp.re_name == "functionD_re" then
|
||||||
@@ -946,15 +952,7 @@ function M.Parser()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif it.re_name == "struct_re" then
|
elseif it.re_name == "struct_re" then
|
||||||
--check template struct
|
|
||||||
local typename = it.item:match("%s*template%s*<%s*typename%s*(%S+)%s*>")
|
|
||||||
--local nsp = it.item:match("%b{}"):sub(2,-2)
|
|
||||||
local stname = it.item:match("struct%s+(%S+)")
|
local stname = it.item:match("struct%s+(%S+)")
|
||||||
if typename then -- it is a struct template
|
|
||||||
self.typenames = self.typenames or {}
|
|
||||||
self.typenames[stname] = typename
|
|
||||||
end
|
|
||||||
--local nspparr,itemsnsp = parseItems(nsp,false,it.locat)
|
|
||||||
local nspparr = it.childs
|
local nspparr = it.childs
|
||||||
for insp,itnsp in ipairs(nspparr) do
|
for insp,itnsp in ipairs(nspparr) do
|
||||||
if itnsp.re_name == "function_re" or itnsp.re_name == "functionD_re" then
|
if itnsp.re_name == "function_re" or itnsp.re_name == "functionD_re" then
|
||||||
@@ -964,8 +962,6 @@ function M.Parser()
|
|||||||
local embededst = itnsp.item:match("struct%s+(%S+)")
|
local embededst = itnsp.item:match("struct%s+(%S+)")
|
||||||
self.embeded_structs[embededst] = stname.."::"..embededst
|
self.embeded_structs[embededst] = stname.."::"..embededst
|
||||||
print("embeded_structs",embededst)
|
print("embeded_structs",embededst)
|
||||||
--local nsp2 = strip_end(itnsp.item:match("%b{}"):sub(2,-2))
|
|
||||||
--local itemsemarr,itemsem = parseItems(nsp2,false,itnsp.locat)
|
|
||||||
local itemsemarr = itnsp.childs
|
local itemsemarr = itnsp.childs
|
||||||
--assert(not itemsem.struct_re,"two level embed struct")
|
--assert(not itemsem.struct_re,"two level embed struct")
|
||||||
for iemb,itemb in ipairs(itemsemarr) do
|
for iemb,itemb in ipairs(itemsemarr) do
|
||||||
|
Reference in New Issue
Block a user