mirror of
https://github.com/cimgui/cimgui.git
synced 2026-05-13 12:31:18 +01:00
cpp2ffi: add code for function()=delete, parse_enum_values for (type)number
This commit is contained in:
@@ -229,12 +229,16 @@ local function parse_enum_value(value, allenums,dontpost)
|
|||||||
------------precedence order (hope not ())
|
------------precedence order (hope not ())
|
||||||
--delete (int)
|
--delete (int)
|
||||||
value = value:gsub("%(int%)","")
|
value = value:gsub("%(int%)","")
|
||||||
|
value = value:gsub("%(%w+%)","")
|
||||||
--first drop outer ()
|
--first drop outer ()
|
||||||
value = value:gsub("^(%()",""):gsub("(%))$","")
|
value = value:gsub("^(%()",""):gsub("(%))$","")
|
||||||
assert(not value:match("[%(%)]"),value)
|
assert(not value:match("[%(%)]"),value)
|
||||||
|
|
||||||
|
local numval = tonumber(value)
|
||||||
|
if numval then return numval end
|
||||||
|
|
||||||
local several,seps = strsplit(value,"([<>&|~%+%-]+)")
|
local several,seps = strsplit(value,"([<>&|~%+%-]+)")
|
||||||
--M.prtable(value,several,seps)
|
--M.prtable("ccc",value,tonumber(value),several,seps)
|
||||||
assert(#seps+1==#several)
|
assert(#seps+1==#several)
|
||||||
|
|
||||||
local i = 1
|
local i = 1
|
||||||
@@ -293,7 +297,7 @@ local function parse_enum_value(value, allenums,dontpost)
|
|||||||
--M.prtable("allenums",allenums)
|
--M.prtable("allenums",allenums)
|
||||||
end
|
end
|
||||||
assert(#seps==0)
|
assert(#seps==0)
|
||||||
assert(type(several[1])=="number" or type(several[1])=="cdata")
|
assert(type(several[1])=="number" or type(several[1])=="cdata",type(several[1]))
|
||||||
--converst 1ULL to "1ULL"
|
--converst 1ULL to "1ULL"
|
||||||
if type(several[1])=="cdata" then several[1] = tostring(several[1]) end
|
if type(several[1])=="cdata" then several[1] = tostring(several[1]) end
|
||||||
return several[1]
|
return several[1]
|
||||||
@@ -343,7 +347,7 @@ local function getRE()
|
|||||||
local res = {
|
local res = {
|
||||||
function_re = "^([^;{}]+%b()[\n%s]*;)%s*",
|
function_re = "^([^;{}]+%b()[\n%s]*;)%s*",
|
||||||
function_re = "^([^;{}=]+%b()[\n%s%w]*;)", --const at the end
|
function_re = "^([^;{}=]+%b()[\n%s%w]*;)", --const at the end
|
||||||
function_re = "^([^;{}=]+%b()[\n%s%w%(%)_]*;)", --attribute(deprecated)
|
function_re = "^([^;{}=]+%b()[\n%s=%w%(%)_]*;)", --attribute(deprecated)
|
||||||
--we need to skip = as function because of "var = f()" initialization in struct fields
|
--we need to skip = as function because of "var = f()" initialization in struct fields
|
||||||
-- but we don want operator== to appear as a var and as we should skip this kind of function solution is:
|
-- but we don want operator== to appear as a var and as we should skip this kind of function solution is:
|
||||||
operator_re = "^([^;{}]+operator[^;{}]+%b()[\n%s%w%(%)_]*;)",
|
operator_re = "^([^;{}]+operator[^;{}]+%b()[\n%s%w%(%)_]*;)",
|
||||||
@@ -745,10 +749,12 @@ local function parseFunction(self,stname,itt,namespace,locat)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local ret = line:match("([^%(%):,]+[%*%s])%s?~?[_%w]+%b()")
|
local ret = line:match("([^%(%):,]+[%*%s])%s?~?[_%w]+%b()")
|
||||||
--local ret = line:match("(.+[%*%s])%s?~?[_%w]+%b()")
|
--local ret = line:match("(.+[%*%s])%s?~?[_%w]+%b()")
|
||||||
--local funcname, args = line:match("(~?[_%w]+)%s*(%b())")
|
--local funcname, args = line:match("(~?[_%w]+)%s*(%b())")
|
||||||
local funcname, args, extraconst = line:match("(~?[_%w]+)%s*(%b())(.*)")
|
local funcname, args, extraconst = line:match("(~?[_%w]+)%s*(%b())(.*)")
|
||||||
|
if extraconst == "=delete;" then return end
|
||||||
extraconst = extraconst:match("const")
|
extraconst = extraconst:match("const")
|
||||||
|
|
||||||
if not args then
|
if not args then
|
||||||
|
|||||||
Reference in New Issue
Block a user