tango.core.tools.Demangler

D symbol name demangling
Attempts to demangle D symbols generated by the DMD frontend. (Which is not always technically possible.)

A sample program demangling the names passed as arguments.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module demangle;
import tango.core.tools.Demangler;
import tango.io.Stdout;

void usage(){
    Stdout("demangle [--help] [--level 0-9] mangledName1 [mangledName2...]").newline;
}

int main(const(char)[][]args){
    uint start=1;
    if (args.length>1) {
        if (args[start]=="--help"){
            usage();
            ++start;
        }
        if (args[start]=="--level"){
            ++start;
            if (args.length==start || args[start].length!=1 || args[start][0]<'0' || 
                args[start][0]>'9') {
                Stdout("invalid level '")((args.length==start)?"*missing*":args[start])
                    ("' (must be 0-9)").newline;
                usage();
                return 2;
            }
            demangler.verbosity=args[start+1][0]-'0';
            ++start;
        }
    } else {
        usage();
        return 0;
    }
    foreach (n;args[start..$]){
        Stdout(demangler.demangle(n)).newline;
    }
    return 0;
}

License:

tango license, apache 2.0

Authors:

Zygfryd (aka Hxal), Fawzi
Demangler demangler [static] ΒΆ
The default demangler.