Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
logAstRecursively(value, pre, str) {
if (value === undefined) {
str += "undefined";
return str;
} else if (value.tokenType) {
str += getTokenConstructor(value).tokenName;
return str;
}
str += value.name;
if (value.children && value.children.length > 0) {
let nextPre = pre + " |";
for (let child of value.children) {
str += "\n" + nextPre + "__";
str = this.logAstRecursively(child, nextPre, str);
}
str += "\n" + pre;
}
return str;
}
getTokenName(tokenInstance){
let constr = getTokenConstructor(tokenInstance);
return constr.tokenName;
}