protected void serialize_set(Set<?> set, PrintWriter p, int level)
	{
		if(!this.setliterals)
		{
			// output a tuple instead of a set-literal
			serialize_tuple(set, p, level);
			return;
		}
		
		if(set.size()>0)
		{
			p.print("{");
			Collection<?> output = set;
			if(this.indent)
			{
				// try to sort the set
				Set<?> outputset = set;
				try {
					outputset = new TreeSet<Object>(set);
				} catch (ClassCastException x) {
					// ignore unsortable elements
				}
				output = outputset;
			}
			serialize_sequence_elements(output, false, p, level+1);
	
			if(this.indent)
			{
				for(int i=0; i<level; ++i)
					p.print("  ");
			}
			p.print("}");
		}
		else
		{
			// empty set literal doesn't exist, replace with empty tuple
			serialize_tuple(Collections.EMPTY_LIST, p, level+1);
		}
	}