code: protected String production(final Parse p, final boolean includePunctuation) {
      final StringBuilder production = new StringBuilder(20);
      production.append(p.getType()).append("->");
      final Parse[] children = ShiftReduceParser
          .collapsePunctuation(p.getChildren(), this.punctSet);
      for (int ci = 0; ci < children.length; ci++) {
        production.append(children[ci].getType());
        if (ci + 1 != children.length) {
          production.append(",");
          final Collection<Parse> nextPunct = children[ci]
              .getNextPunctuationSet();
          if (includePunctuation && nextPunct != null) {
            // TODO: make sure multiple punctuation comes out the same
            for (final Parse punct : nextPunct) {
              production.append(punct.getType()).append(",");
            }
          }
        }
      }
      return production.toString();
    }
docs: Generates a string representing the grammar rule production that the
  specified parse is starting. The rule is of the form p.type -&gt;
  c.children[0..n].type.
  
  @param p
  The parse which stats teh production.
  @param includePunctuation
  Whether punctuation should be included in the production.
  @return a string representing the grammar rule production that the
  specified parse is starting.