root
root copied to clipboard
GetCppName: Mangled version of the C++ symbol
Explain what you would like to see improved and how.
The function TMetaUtils::GetCppName
returns a mangled version of the C++ symbol that can be used in C++ as a variable name. It replaces in a string all the characters that are invalid in a C++ variable name by some mangled version.
The core of the code is this switch:
switch(c) {
case '+': repl = "pL"; break;
case '-': repl = "mI"; break;
case '*': repl = "mU"; break;
case '/': repl = "dI"; break;
case '&': repl = "aN"; break;
case '%': repl = "pE"; break;
case '|': repl = "oR"; break;
case '^': repl = "hA"; break;
case '>': repl = "gR"; break;
case '<': repl = "lE"; break;
case '=': repl = "eQ"; break;
case '~': repl = "wA"; break;
case '.': repl = "dO"; break;
case '(': repl = "oP"; break;
case ')': repl = "cP"; break;
case '[': repl = "oB"; break;
case ']': repl = "cB"; break;
case '!': repl = "nO"; break;
case ',': repl = "cO"; break;
case '$': repl = "dA"; break;
case ' ': repl = "sP"; break;
case ':': repl = "cL"; break;
case '"': repl = "dQ"; break;
case '@': repl = "aT"; break;
case '\'': repl = "sQ"; break;
case '\\': repl = "fI"; break;
}
Seems to me a few characters are missing in that switch ie: # ? {} ` ; I found this while working on this PR: https://github.com/root-project/root/pull/15377#pullrequestreview-2029558913
Sorry if I am wrong.