Ejemplo n.º 1
0
  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);
  }
Ejemplo n.º 2
0
 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();
 }