cpp2ffi and generator: add parser:take_lines and use it

This commit is contained in:
Victor Bombi
2020-09-25 14:08:36 +02:00
parent aa5d3646be
commit 5f4aa99a3c
2 changed files with 15 additions and 36 deletions

View File

@@ -936,6 +936,18 @@ function M.Parser()
function par.get_manuals(def)
return par.manuals[def.ov_cimguiname] or par.manuals[def.cimguiname]
end
function par:take_lines(cmd_line,names,compiler)
local pipe,err = io.popen(cmd_line,"r")
if not pipe then
error("could not execute COMPILER "..err)
end
local defines = {}
for line,loca,loca2 in M.location(pipe,names,defines,compiler) do
self:insert(line, tostring(loca)..":"..tostring(loca2))
end
pipe:close()
return defines
end
function par:do_parse()
self:parseItems()
self:gen_structs_and_enums()