cpp2ffi: function_re: avoid confusion with asignment, templated args: allow several, add not processed info

This commit is contained in:
Victor Bombi
2020-08-31 09:15:37 +02:00
parent a68f4a93ae
commit 4630f434ea

View File

@@ -256,7 +256,7 @@ M.copyfile = copyfile
local function getRE()
local res = {
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
struct_re = "^([^;{}]-struct[^;{}]-%b{}[%s%w_%(%)]*;)",
enum_re = "^([^;{}]-enum[^;{}]-%b{}[%s%w_%(%)]*;)",
union_re = "^([^;{}]-union[^;{}]-%b{}[%s%w_%(%)]*;)",
@@ -463,7 +463,8 @@ local function parseFunction(self,stname,lineorig,namespace,locat)
--for _,ttype in ipairs(self.templatedTypes) do
--local template = argscsinpars:match(ttype.."%s*<(.+)>")
--TODO several diferent templates
local ttype,template = argscsinpars:match("([^%s,%(%)]+)%s*<(.+)>")
local ttype,template = argscsinpars:match("([^%s,%(%)]+)%s*<(.-)>")
--print("ttype,template",ttype,template)
local te=""
if template then
if self.typenames[stname] ~= template then --rule out template typename
@@ -995,6 +996,9 @@ function M.Parser()
end
elseif it.re_name == "struct_re" then
table.insert(self.inerstructs,it)
else
print(it.re_name,"not processed")
M.prtable(it)
end
end
--final