private String debugHiddenBefore(AST ast) { if (!(ast instanceof antlr.CommonASTWithHiddenTokens)) { return ""; } antlr.CommonHiddenStreamToken parent = ((antlr.CommonASTWithHiddenTokens) ast).getHiddenBefore(); if (parent == null) { return ""; } antlr.CommonHiddenStreamToken child = null; do { child = parent; parent = child.getHiddenBefore(); } while (parent != null); return debugHiddenTokens(child); }
private String debugHiddenTokens(antlr.CommonHiddenStreamToken t) { final StringBuilder sb = new StringBuilder(); for (; t != null; t = filter.getHiddenAfter(t)) { if (sb.length() == 0) { sb.append("["); } sb.append(t.getText().replace("\n", "\\n")); } if (sb.length() > 0) { sb.append("]"); } return sb.toString(); }