how to parse a demangled symbol into parse tree or other form
timotheecour
thelastmammoth at gmail.com
Thu Sep 20 23:23:24 PDT 2012
Is there a way to parse a demangled symbol into a parse tree, or
json representation, or other form?
eg:
string
name="std.format.formatValue!(std.array.Appender!(immutable(char)[]).Appender,
TypeInfo_Class,
char).formatValue(std.array.Appender!(immutable(char)[]).Appender,
TypeInfo_Class, ref std.format.FormatSpec!(char).FormatSpec)"
=>
1)
assert(fullyQualifiedNameSymbol(name)="std.format.formatValue");
assert(aritySymbol(name)=3);
2)
better yet, get a parse tree
3)
additionally, dump it to a json string:
{
"name" : "std.format.formatValue",
"template_args" : [...]
...
}
If not, I guess Pegged could be useful.
This is to postprocess unreadable stack traces
More information about the Digitalmars-d-learn
mailing list