<commit_before>package wycs.io;

import java.io.*;
import java.util.*;

import static wybs.lang.SyntaxError.*;
import wybs.util.Pair;
import wycs.lang.*;
import wycs.lang.Expr.Quantifier;

public class WycsFilePrinter {
	public static final String INDENT = "  ";
	
	private PrintWriter out;
	
	public WycsFilePrinter(OutputStream writer) throws UnsupportedEncodingException {
		this(new OutputStreamWriter(writer,"UTF-8"));		
	}
	
	public WycsFilePrinter(Writer writer) {
		this.out = new PrintWriter(writer);		
	}
	
	public void write(WycsFile wf) {
		for(WycsFile.Declaration d : wf.declarations()) {
			write(wf, d);
			out.println();
		}
		out.flush();
	}	
	
	private void write(WycsFile wf, WycsFile.Declaration s) {
		if(s instanceof WycsFile.Function) {
			write(wf,(WycsFile.Function)s);
		} else if(s instanceof WycsFile.Define) {
			write(wf,(WycsFile.Define)s);
		} else if(s instanceof WycsFile.Assert) {
			write(wf,(WycsFile.Assert)s);
		} else if(s instanceof WycsFile.Import) {
			write(wf,(WycsFile.Import)s);
		} else {
			internalFailure("unknown statement encountered " + s,
					wf.filename(), s);
		}
		out.println();
	}
	
	public void write(WycsFile.Import s) {
		String str = s.filter.toString();
		str = str.replace('/', '.');
		if (s.name == null) {
			out.print("import " + str);<commit_msg>WYCS: making some slow progress.<commit_after>package wycs.io;

import java.io.*;
import java.util.*;

import static wybs.lang.SyntaxError.*;
import wybs.util.Pair;
import wycs.lang.*;
import wycs.lang.Expr.Quantifier;

public class WycsFilePrinter {
	public static final String INDENT = "  ";
	
	private PrintWriter out;
	
	public WycsFilePrinter(OutputStream writer) throws UnsupportedEncodingException {
		this(new OutputStreamWriter(writer,"UTF-8"));		
	}
	
	public WycsFilePrinter(Writer writer) {
		this.out = new PrintWriter(writer);		
	}
	
	public void write(WycsFile wf) {
		for(WycsFile.Declaration d : wf.declarations()) {
			write(wf, d);
			out.println();
		}
		out.flush();
	}	
	
	private void write(WycsFile wf, WycsFile.Declaration s) {
		if(s instanceof WycsFile.Function) {
			write(wf,(WycsFile.Function)s);
		} else if(s instanceof WycsFile.Define) {
			write(wf,(WycsFile.Define)s);
		} else if(s instanceof WycsFile.Assert) {
			write(wf,(WycsFile.Assert)s);
		} else if(s instanceof WycsFile.Import) {
			write(wf,(WycsFile.Import)s);
		} else {
			internalFailure("unknown statement encountered " + s,
					wf.filename(), s);
		}
		out.println();
	}
	
	public void write(WycsFile wf, WycsFile.Import s) {
		String str = s.filter.toString();
		str = str.replace('/', '.');
		if (s.name == null) {
			out.print("import " + str);
{'fraction_non_alphanumeric': 0.14205397301349326, 'fraction_numerical': 0.0007496251874062968, 'mean_word_length': 3.99812734082397, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2970500', 'n_tokens_mistral': 1046, 'n_tokens_neox': 931, 'n_words': 199}