Skip to content

@klickverbot /ddemangle.d
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Demangles D symbol names found in standard input.
import core.demangle;
import std.ascii;
import std.stdio;
void main() {
foreach (line; stdin.byLine(File.KeepTerminator.yes)) {
size_t lastWritten;
bool hadUnderscore;
bool inSymbol;
foreach (i, char c; line) {
if (!inSymbol && hadUnderscore && c == 'D') {
inSymbol = true;
write(line[lastWritten .. (i - 1)]);
lastWritten = i - 1;
} else if (inSymbol && !(isAlphaNum(c) || c == '_')) {
inSymbol = false;
write(demangle(line[lastWritten .. i]));
lastWritten = i;
}
hadUnderscore = (c == '_');
}
auto rest = line[lastWritten .. $];
if (inSymbol) {
write(demangle(rest));
} else {
write(rest);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.