Example #1
0
 public static void toString(StringBuilder sb, ParseNode node, boolean hiddenToo) {
   for (Object child : node._children) {
     if (child instanceof ParseNode) {
       toString(sb, (ParseNode) child, hiddenToo);
     } else if (child instanceof Token) {
       Token token = (Token) child;
       if (hiddenToo || token.getChannel() != token.HIDDEN_CHANNEL) {
         sb.append(token.getText());
       }
     }
   }
 }
Example #2
0
 public String toParsedString() {
   StringBuilder sb = new StringBuilder();
   toString(sb, this, false);
   return sb.toString();
 }
Example #3
0
 public String toOriginalString() {
   StringBuilder sb = new StringBuilder();
   toString(sb, this, true);
   return sb.toString();
 }