Found this bug while parsing the Vulkan headers, here's the minimal repro, modified from example code:
dofile("xml.lua")
dofile("handler.lua")
---Recursivelly prints a table
--@param tb The table to be printed
--@param level Only internally used to indent the print.
function printable(tb, level)
level = level or 1
local spaces = string.rep(' ', level*2)
for k,v in pairs(tb) do
if type(v) ~= "table" then
print(spaces .. k..'='..v)
else
print(spaces .. k)
level = level + 1
printable(v, level)
end
end
end
xmltext = [[ <param><type>VkFramebuffer</type>* <name>pFramebuffer</name></param> ]]
--Instantiate the object the states the XML file as a Lua table
local xmlhandler = simpleTreeHandler()
--Instantiate the object that parses the XML to a Lua table
local xmlparser = xmlParser(xmlhandler)
xmlparser:parse(xmltext)
--Recursivelly prints the table
printable(xmlhandler.root)
Your XML is malformed. You must remove the * after the tag.
This is a very basic parser that doesn't validate your XML.
It just expects that you provide a valid one.
Found this bug while parsing the Vulkan headers, here's the minimal repro, modified from example code:
Output using Lua 5.1:
param=*