demangle tool
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Fri Apr 10 14:25:30 PDT 2009
Sergey Gromov wrote:
> Thu, 09 Apr 2009 13:40:36 -0700, Andrei Alexandrescu wrote:
>
>> The line wraps are all garbled, but you get the idea: all symbols quoted
>> `like this' have been demangled appropriately. Below is the source of
>> the demangle script:
>>
>> #!/home/andrei/bin/rdmd
>> import std.algorithm, std.demangle, std.getopt, std.stdio;
>>
>> void main(string[] args)
>> {
>> string lSep = "`", rSep = "'";
>> getopt(args, "lsep", &lSep, "rsep", &rSep);
>> foreach (line; stdin.byLine())
>> {
>> auto sym = find(line, lSep);
>> if (!sym.length)
>> {
>> writeln(line);
>> continue;
>> }
>> sym = sym[1 .. $];
>> auto before = line[0 .. $ - sym.length];
>> sym = sym[0 .. $ - find(sym, rSep).length];
>> auto after = line[before.length + sym.length .. $];
>> writeln(before, demangle(sym.idup), after);
>> }
>> }
>
> What happened to the range boolean operations, those
> before/after/whatever? Do you still plan to implement them?
Curiously, I didn't find a need for them in std.algorithm so far. I only
defined sameHead, and that's only to help a little improvement in the
bringToFront algorithm.
Andrei
More information about the Digitalmars-d
mailing list