private String nodeName(Node node) {
if (node instanceof Start || node instanceof EOF) {
return node.getClass().getSimpleName();
} else if (node instanceof Token) {
Token token = (Token) node;
String tokenType = token.getClass().getSimpleName().substring(1);
return tokenType + " [line:" + token.getLine() + ",pos:" + token.getPos() + "] \""
+ escape(token.getText()) + "\"";
} else {
// Turn PSomeProduction, AConcreteSomeProduction
// Into SomeProduction, Concrete
String p = node.getClass().getSuperclass().getSimpleName().substring(1);
String a = node.getClass().getSimpleName().substring(1);