code: public String toRule(boolean escapeUnprintable) {
         // int i;
  
          StringBuffer rule = new StringBuffer();
  
          // Accumulate special characters (and non-specials following them)
          // into quoteBuf.  Append quoteBuf, within single quotes, when
          // a non-quoted element must be inserted.
          StringBuffer quoteBuf = new StringBuffer();
  
          // Do not emit the braces '{' '}' around the pattern if there
          // is neither anteContext nor postContext.
          boolean emitBraces =
              (anteContext != null) || (postContext != null);
  
          // Emit start anchor
          if ((flags & ANCHOR_START) != 0) {
              rule.append('^');
          }
  
          // Emit the input pattern
          Utility.appendToRule(rule, anteContext, escapeUnprintable, quoteBuf);
  
          if (emitBraces) {
              Utility.appendToRule(rule, '{', true, escapeUnprintable, quoteBuf);
          }
  
          Utility.appendToRule(rule, key, escapeUnprintable, quoteBuf);
  
          if (emitBraces) {
              Utility.appendToRule(rule, '}', true, escapeUnprintable, quoteBuf);
          }
  
          Utility.appendToRule(rule, postContext, escapeUnprintable, quoteBuf);
  
          // Emit end anchor
          if ((flags & ANCHOR_END) != 0) {
              rule.append('$');
          }
  
          Utility.appendToRule(rule, " > ", true, escapeUnprintable, quoteBuf);
  
          // Emit the output pattern
  
          Utility.appendToRule(rule, output.toReplacerPattern(escapeUnprintable),
                       true, escapeUnprintable, quoteBuf);
  
          Utility.appendToRule(rule, ';', true, escapeUnprintable, quoteBuf);
  
          return rule.toString();
      }
docs: Create a source string that represents this rule.  Append it to the
  given string.