Dump start description as well when writing a regex dump

This commit is contained in:
Maxime Coste 2018-11-04 12:01:29 +11:00
parent 4ac7df3842
commit b4571bd172

View File

@ -1130,6 +1130,24 @@ String dump_regex(const CompiledRegex& program)
res += "match\n"; res += "match\n";
} }
} }
auto dump_start_desc = [&](CompiledRegex::StartDesc& desc, StringView name) {
res += name + " start desc: [";
for (size_t c = 0; c < CompiledRegex::StartDesc::count; ++c)
{
if (desc.map[c])
{
if (c < 32)
res += format("<0x{}>", Hex{c});
else
res += (char)c;
}
}
res += "]\n";
};
if (program.forward_start_desc)
dump_start_desc(*program.forward_start_desc, "forward");
if (program.backward_start_desc)
dump_start_desc(*program.backward_start_desc, "backward");
return res; return res;
} }