// Path: src/io/Preface.java
// public class Preface {
// 	public static void readPreface(BufferedReader in) throws IOException {
// 		String line = in.readLine();
// 
// 		if (line == null || line.charAt(0) != '#') {
// 			throw new IllegalArgumentException("File does not start with the mandatory preface.");
// 		}
// 
// 		while ((line = in.readLine()) != null) {
// 			if (line.isEmpty()) {
// 				break;
// 			}
// 			if (line.charAt(0) != '#') {
// 				throw new IllegalArgumentException("Uncommented line within preface.");
// 			}
// 		}
// 	}
// 
// 	public static void printPreface(PrintWriter out) {
// 		out.println("# mandatory preface");
// 		out.println("# mandatory preface");
// 		out.println();
// 	}
// }
// 
// Path: src/utils/ByteWrapper.java
// public class ByteWrapper {
// 	public byte value;
// 
// 	public ByteWrapper(byte value) {
// 		this.value = value;
// 	}
// }
// 
// Path: src/utils/ShortWrapper.java
// public class ShortWrapper {
// 	public short value;
// 
// 	public ShortWrapper(short value) {
// 		this.value = value;
// 	}
// }


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import io.Preface;
import utils.ByteWrapper;
import utils.ShortWrapper;

	public String getString(String plainCategoryString) {
		return markedupStrings.get(plainCategoryString);
	}

	public String getPlainString(String markedupString) {
		return plainCategoryStrings.get(markedupString);
	}

	public Category getCategory(String plainCategoryString) {
		return markedupCategories.get(plainCategoryString);
	}

	// 3 constants only used when reading the markedup file:
	private enum States {
		CAT, MARKEDUP, GRS
	}

	private void readMarkedupFile(String grammarDir, boolean ALT_MARKEDUP) throws IOException {
		markedupStrings = new HashMap<String, String>();
		plainCategoryStrings = new HashMap<String, String>();
		markedupCategories = new HashMap<String, Category>();

		// not sure when the sentinel is used for categories, but retaining from C&C:
		markedupStrings.put("+", "+");
		markedupCategories.put("+", null);

		String markedupFile = grammarDir + "/markedup";

		try ( BufferedReader in = new BufferedReader(new FileReader(markedupFile)) ) {
// Path: src/io/Preface.java
// public class Preface {
// 	public static void readPreface(BufferedReader in) throws IOException {
// 		String line = in.readLine();
// 
// 		if (line == null || line.charAt(0) != '#') {
// 			throw new IllegalArgumentException("File does not start with the mandatory preface.");
// 		}
// 
// 		while ((line = in.readLine()) != null) {
// 			if (line.isEmpty()) {
// 				break;
// 			}
// 			if (line.charAt(0) != '#') {
// 				throw new IllegalArgumentException("Uncommented line within preface.");
// 			}
// 		}
// 	}
// 
// 	public static void printPreface(PrintWriter out) {
// 		out.println("# mandatory preface");
// 		out.println("# mandatory preface");
// 		out.println();
// 	}
// }
// 
// Path: src/utils/ByteWrapper.java
// public class ByteWrapper {
// 	public byte value;
// 
// 	public ByteWrapper(byte value) {
// 		this.value = value;
// 	}
// }
// 
// Path: src/utils/ShortWrapper.java
// public class ShortWrapper {
// 	public short value;
// 
// 	public ShortWrapper(short value) {
// 		this.value = value;
// 	}
// }


// Path: src/lexicon/Categories.java
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import io.Preface;
import utils.ByteWrapper;
import utils.ShortWrapper;


	public String getString(String plainCategoryString) {
		return markedupStrings.get(plainCategoryString);
	}

	public String getPlainString(String markedupString) {
		return plainCategoryStrings.get(markedupString);
	}

	public Category getCategory(String plainCategoryString) {
		return markedupCategories.get(plainCategoryString);
	}

	// 3 constants only used when reading the markedup file:
	private enum States {
		CAT, MARKEDUP, GRS
	}

	private void readMarkedupFile(String grammarDir, boolean ALT_MARKEDUP) throws IOException {
		markedupStrings = new HashMap<String, String>();
		plainCategoryStrings = new HashMap<String, String>();
		markedupCategories = new HashMap<String, Category>();

		// not sure when the sentinel is used for categories, but retaining from C&C:
		markedupStrings.put("+", "+");
		markedupCategories.put("+", null);

		String markedupFile = grammarDir + "/markedup";

		try ( BufferedReader in = new BufferedReader(new FileReader(markedupFile)) ) {
			Preface.readPreface(in);