Пример #1
0
    public IValue visitMap(IMap o) throws IOException {
      append('(');
      tab();
      boolean indent = checkIndent(o);
      indent(indent);
      Iterator<IValue> mapIterator = o.iterator();
      if (mapIterator.hasNext()) {
        IValue key = mapIterator.next();
        key.accept(this);
        append(':');
        o.get(key).accept(this);

        while (mapIterator.hasNext()) {
          append(',');
          indent(indent);
          key = mapIterator.next();
          key.accept(this);
          append(':');
          o.get(key).accept(this);
        }
      }
      untab();
      indent(indent);
      append(')');

      return o;
    }
Пример #2
0
 public void write(IValue value, java.io.Writer stream) throws IOException {
   try {
     value.accept(new Writer(stream, indent, tabSize));
   } finally {
     stream.flush();
   }
 }