From ffdeed6d39f651bc6ffb75ecf9b8134798041f82 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Mon, 9 Sep 2019 20:13:50 -0400 Subject: Upgrade version to 0.2 --- docs/jacoco-ut/bjc.everge/ReplPair.java.html | 764 ++++++++++++++------------- 1 file changed, 397 insertions(+), 367 deletions(-) (limited to 'docs/jacoco-ut/bjc.everge/ReplPair.java.html') diff --git a/docs/jacoco-ut/bjc.everge/ReplPair.java.html b/docs/jacoco-ut/bjc.everge/ReplPair.java.html index 9701d27..eea7307 100644 --- a/docs/jacoco-ut/bjc.everge/ReplPair.java.html +++ b/docs/jacoco-ut/bjc.everge/ReplPair.java.html @@ -1,13 +1,10 @@ ReplPair.java

ReplPair.java

package bjc.everge;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Scanner;
+import java.util.*;
+import java.util.function.*;
+import java.util.regex.*;
 
-import java.util.function.UnaryOperator;
-
-import bjc.everge.ControlledString.Control;
-import bjc.everge.ControlledString.ParseStrings;
+import bjc.everge.ControlledString.*;
 
 /**
  * String pairs for replacements.
@@ -22,7 +19,7 @@ public class ReplPair implements Comparable<ReplPair>, UnaryOperator<St
 	private int stage;
 
 	// Status of this pair with regards to doing staging stuff
-	private StageStatus stat = StageStatus.BOTH;
+	private StageStatus stat = StageStatus.BOTH;
 
 	/**
 	 * The priority for this replacement.
@@ -36,6 +33,14 @@ public class ReplPair implements Comparable<ReplPair>, UnaryOperator<St
 	 */
 	public String name;
 
+	/**
+	 * The guard for this replacement.
+	 *
+	 * The guard of the replacement is a regex that has to match before the pair will be considered.
+	 * Defaults to being blank.
+	 */
+	public String guard;
+
 	/**
 	 * The string to look for.
 	 */
@@ -50,8 +55,8 @@ public class ReplPair implements Comparable<ReplPair>, UnaryOperator<St
 	 * Create a new blank replacement pair.
 	 */
 	public ReplPair() {
-		this("", "", 1, null);
-	}
+		this("", "", 1, null);
+	}
 
 	/**
 	 * Create a new replacement pair with a priority of 1.
@@ -62,8 +67,8 @@ public class ReplPair implements Comparable<ReplPair>, UnaryOperator<St
 	 * 	The string to replace.
 	 */
 	public ReplPair(String f, String r) {
-		this(f, r, 1);
-	}
+		this(f, r, 1);
+	}
 
 	/**
 	 * Create a new named replacement pair with a priority of 1.
@@ -76,8 +81,8 @@ public class ReplPair implements Comparable<ReplPair>, UnaryOperator<St
 	 * 	The name of the replacement pair.
 	 */
 	public ReplPair(String f, String r, String n) {
-		this(f, r, 1, n);
-	}
+		this(f, r, 1, n);
+	}
 
 	/**
 	 * Create a new replacement pair with a set priority.
@@ -90,8 +95,8 @@ public class ReplPair implements Comparable<ReplPair>, UnaryOperator<St
 	 * 	The priority for the replacement.
 	 */
 	public ReplPair(String f, String r, int p) {
-		this(f, r, p, f);
-	}
+		this(f, r, p, f);
+	}
 
 	/**
 	 * Create a new replacement pair with a set priority and name.
@@ -105,14 +110,14 @@ public class ReplPair implements Comparable<ReplPair>, UnaryOperator<St
 	 * @param p
 	 * 	The priority for the replacement.
 	 */
-	public ReplPair(String f, String r, int p, String n) {
-		find    = f;
-		replace = r;
+	public ReplPair(String f, String r, int p, String n) {
+		find    = f;
+		replace = r;
 
-		name = n;
+		name = n;
 
-		priority = p;
-	}
+		priority = p;
+	}
 
 	/**
 	 * Read a list of replacement pairs from an input source.
@@ -123,9 +128,9 @@ public class ReplPair implements Comparable<ReplPair>, UnaryOperator<St
 	 * 	The list of replacements.
 	 */
 	public static List<ReplPair> readList(Scanner scn) {
-		List<ReplPair> lst = new ArrayList<>();
+		List<ReplPair> lst = new ArrayList<>();
 
-		return readList(lst, scn);
+		return readList(lst, scn);
 	}
 
 	/**
@@ -140,15 +145,15 @@ public class ReplPair implements Comparable<ReplPair>, UnaryOperator<St
 	 * 	The list of replacements.
 	 */
 	public static List<ReplPair> readList(List<ReplPair> detals, Scanner scn) {
-		List<ReplError> errList = new ArrayList<>();
+		List<ReplError> errList = new ArrayList<>();
 
-		List<ReplPair> rplPar = readList(detals, scn, errList);
+		List<ReplPair> rplPar = readList(detals, scn, errList);
 
-		if (errList.size() != 0) {
-			throw new ReplParseException("", errList);
+		if (errList.size() != 0) {
+			throw new BadReplParse("", errList);
 		}
 
-		return rplPar;
+		return rplPar;
 	}
 
 	/**
@@ -165,7 +170,7 @@ public class ReplPair implements Comparable<ReplPair>, UnaryOperator<St
 	 * 	The list of replacements.
 	 */
 	public static List<ReplPair> readList(List<ReplPair> detals, Scanner scn, List<ReplError> errs) {
-		return readList(detals, scn, errs, new ReplOpts());
+		return readList(detals, scn, errs, new ReplOpts());
 	}
 
 	/**
@@ -187,627 +192,652 @@ public class ReplPair implements Comparable<ReplPair>, UnaryOperator<St
 			List<ReplPair> detals, Scanner scn,
 			List<ReplError> errs, ReplOpts ropts) 
 	{
-		IntHolder lno = new IntHolder();
-		IntHolder pno = new IntHolder();
+		IntHolder lno = new IntHolder();
+		IntHolder pno = new IntHolder();
 
-		List<List<ReplPair>> stages = new ArrayList<>();
-		stages.add(new ArrayList<ReplPair>());
+		List<List<ReplPair>> stages = new ArrayList<>();
+		stages.add(new ArrayList<ReplPair>());
 
 		// For every line in the source...
-		while (scn.hasNextLine()) {
-			String name = scn.nextLine().trim();
-			lno.incr();
+		while (scn.hasNextLine()) {
+			String name = scn.nextLine().trim();
+			lno.incr();
 
 			// If its commented or blank, skip it
-			if (name.equals(""))      continue;
-			if (name.startsWith("#")) continue;
+			if (name.equals(""))      continue;
+			if (name.startsWith("#")) continue;
 
 			// Global control. Process it.
-			if (name.startsWith("|//")) {
-				readGlobal(name, scn, errs, ropts, lno, pno);
+			if (name.startsWith("|//")) {
+				readGlobal(name, scn, errs, ropts, lno, pno);
 
-				continue;
+				continue;
 			}
 
-			ReplPair rp = new ReplPair();
+			ReplPair rp = new ReplPair();
 
-			rp.priority = ropts.defPrior;
-			rp.stat     = ropts.defStatus;
-			rp.lno      = lno.get();
-			rp.stage    = ropts.defStage;
+			rp.priority = ropts.defPrior;
+			rp.stat     = ropts.defStatus;
+			rp.lno      = lno.get();
+			rp.stage    = ropts.defStage;
 
-			boolean isMulti = ropts.defMulti;
+			boolean isMulti = ropts.defMulti;
 
 			{
-				String tmpName = readName(name, scn, errs, rp, ropts, lno, pno);
-				if (tmpName == null) continue;
-				name = tmpName;
+				String tmpName = readName(name, scn, errs, rp, ropts, lno, pno);
+				if (tmpName == null) continue;
+				name = tmpName;
 			}
 
-			rp.find = name;
-			if (rp.name == null) rp.name = name;
+			rp.find = name;
+			if (rp.name == null) rp.name = name;
 
 			// We started to process the pair, mark it as being
 			// started
-			pno.incr();
-			String body = null;
+			pno.incr();
+			String body = null;
 
 			// Read in the next uncommented line
 			do {
-				if (!scn.hasNextLine()) break; 
+				if (!scn.hasNextLine()) break; 
 
-				body = scn.nextLine().trim();
-				lno.incr();
-			} while (body.startsWith("#"));
+				body = scn.nextLine().trim();
+				lno.incr();
+			} while (body.startsWith("#"));
 
-			if (body == null) {
-				String msg = String.format(
+			if (body == null) {
+				String msg = String.format(
 						"Ran out of input looking for replacement body for raw name '%s'", name);
 
-				errs.add(new ReplError(lno, pno, msg, null));
-				break;
+				errs.add(new ReplError(lno, pno, msg, null));
+				break;
 			}
 
-			isMulti = ropts.defMulti;
+			isMulti = ropts.defMulti;
 			
-			ControlledString cs = getControls(body, errs, ropts, lno, pno, "body");
+			ControlledString cs = getControls(body, errs, ropts, lno, pno, "body");
 			// Body has attached controls, process them.
-			if (cs.hasControls()) {
-				for (Control cont : cs.controls) {
-					switch (cont.name) {
+			if (cs.hasControls()) {
+				for (Control cont : cs.controls) {
+					switch (cont.name) {
 					case "MULTITRUE":
 					case "MULTIT":
 					case "MT":
-						isMulti = true;
-						break;
+						isMulti = true;
+						break;
 					case "MULTIFALSE":
 					case "MULTIF":
 					case "MF":
-						isMulti = false;
-						break;
+						isMulti = false;
+						break;
 					case "MULTI":
 					case "M":
-						if (cont.count() != 1) {
-							String errMsg = String.format("Expected one multi flag (got %d)", cont.count());
-							errs.add(new ReplError(lno, pno, errMsg, body));
-						} else {
-							isMulti = Boolean.parseBoolean(cont.get(0));
+						if (cont.count() != 1) {
+							String errMsg = String.format("Expected one multi flag (got %d)", cont.count());
+							errs.add(new ReplError(lno, pno, errMsg, body));
+						} else {
+							isMulti = Boolean.parseBoolean(cont.get(0));
 						}
-						break;
+						break;
 					default: 
 						{
-							String errMsg = String.format("Invalid control name '%s'", cont.name);
-							errs.add(new ReplError(lno, pno, errMsg, body));
+							String errMsg = String.format("Invalid control name '%s'", cont.name);
+							errs.add(new ReplError(lno, pno, errMsg, body));
 						}
 						break;
 					}
 				}
 
-				body = cs.strang;
+				body = cs.strang;
 			}
 
-			if (isMulti) {
-				String tmp = readMultiLine(body, scn, ropts, errs, "body", lno);
-				if (tmp == null) continue;
-				body = tmp;
+			if (isMulti) {
+				String tmp = readMultiLine(body, scn, ropts, errs, "body", lno);
+				if (tmp == null) continue;
+				body = tmp;
 			}
 
-			rp.replace = body;
+			rp.replace = body;
 
-			List<ReplPair> stageList = null;
-			if (rp.stage == 0 || stages.size() < (rp.stage - 1)) {
-				stageList = stages.get(rp.stage);
+			List<ReplPair> stageList = null;
+			if (rp.stage == 0 || stages.size() < (rp.stage - 1)) {
+				stageList = stages.get(rp.stage);
 
-				if (stageList == null) {
-					stageList = new ArrayList<>();
+				if (stageList == null) {
+					stageList = new ArrayList<>();
 
-					stages.add(rp.stage, stageList);
+					stages.add(rp.stage, stageList);
 				}
 			} else {
-				for (int i = stages.size(); i <= rp.stage; i++) {
-					stages.add(new ArrayList<>());
+				for (int i = stages.size(); i <= rp.stage; i++) {
+					stages.add(new ArrayList<>());
 				}
 
-				stageList = stages.get(rp.stage);
+				stageList = stages.get(rp.stage);
 			}
 
-			if (ropts.isTrace) {
-				ropts.errStream.printf("\t[DEBUG] Stage %d: Added %s\n\t\tContents: %s\n",
-						rp.stage, rp, stageList);
+			if (ropts.isTrace) {
+				ropts.errStream.printf("\t[DEBUG] Stage %d: Added %s\n\t\tContents: %s\n",
+						rp.stage, rp, stageList);
 			}
 
-			stageList.add(rp);
-		}
+			stageList.add(rp);
+		}
 
 		// Special-case one-stage processing.
-		if (stages.size() == 1) {
-			if (ropts.isTrace) ropts.errStream.printf("\t[DEBUG] Executing single-stage bypass\n");
+		if (stages.size() == 1) {
+			if (ropts.isTrace) ropts.errStream.printf("\t[DEBUG] Executing single-stage bypass\n");
 
-			for (ReplPair rp : stages.iterator().next()) {
-				if (rp.stat == StageStatus.INTERNAL) {
-					if (ropts.isTrace) ropts.errStream.printf("\t[DEBUG] Excluding internal RP %s\n", rp);
+			for (ReplPair rp : stages.iterator().next()) {
+				if (rp.stat == StageStatus.INTERNAL) {
+					if (ropts.isTrace) ropts.errStream.printf("\t[DEBUG] Excluding internal RP %s\n", rp);
 
 					continue;
 				}
 
-				detals.add(rp);
-			}
+				detals.add(rp);
+			}
 
-			detals.sort(null);
+			detals.sort(null);
 
-			return detals;
+			return detals;
 		}
 
 		// Handle stages
-		List<ReplPair> tmpList = new ArrayList<>();
-		tmpList.addAll(detals);
+		List<ReplPair> tmpList = new ArrayList<>();
+		tmpList.addAll(detals);
 
-		if (ropts.isTrace) ropts.errStream.printf("\t[DEBUG] Stages: %s\n", stages);
+		if (ropts.isTrace) ropts.errStream.printf("\t[DEBUG] Stages: %s\n", stages);
 
-		int procStg = 0;
-		for (List<ReplPair> stageList : stages) {
-			procStg += 1;
-			List<ReplPair> curStage = new ArrayList<>();
+		int procStg = 0;
+		for (List<ReplPair> stageList : stages) {
+			procStg += 1;
+			List<ReplPair> curStage = new ArrayList<>();
 
-			if (ropts.isTrace) ropts.errStream.printf("\t[DEBUG] Staging stage %d of %d: %s\n",
-					procStg, stageList.size(), stageList);
+			if (ropts.isTrace) ropts.errStream.printf("\t[DEBUG] Staging stage %d of %d: %s\n",
+					procStg, stageList.size(), stageList);
 
-			for (ReplPair rp : stageList) {
+			for (ReplPair rp : stageList) {
 				// Process through every pair in the previous
 				// stages
-				for (ReplPair curPar : tmpList) {
-					String tmp = rp.replace.replaceAll(curPar.find, curPar.replace);
+				for (ReplPair curPar : tmpList) {
+					String tmp = rp.replace.replaceAll(curPar.find, curPar.replace);
 
-					if (ropts.isTrace && !rp.replace.equals(tmp)) {
-						ropts.errStream.printf("\t[DEBUG] Staged '%s' -> '%s'\t%s\n",
+					if (ropts.isTrace && !rp.replace.equals(tmp)) {
+						ropts.errStream.printf("\t[DEBUG] Staged '%s' -> '%s'\t%s\n",
 							rp.replace, tmp, curPar);
 					}
 
-					rp.replace = tmp;
-				}
+					rp.replace = tmp;
+				}
 
 				// If we're external; add straight to the output
-				if (rp.stat == StageStatus.EXTERNAL) {
-					if (ropts.isTrace) {
-						ropts.errStream.printf("\t[DEBUG] Skipped external for staging: %s\n",
+				if (rp.stat == StageStatus.EXTERNAL) {
+					if (ropts.isTrace) {
+						ropts.errStream.printf("\t[DEBUG] Skipped external for staging: %s\n",
 								rp);
 					}
 
-					detals.add(rp);
+					detals.add(rp);
 				} else {
-					if (ropts.isTrace) {
-						ropts.errStream.printf("\t[DEBUG] Added to stage %d: %s\n\t\tContents: %s\n",
-								procStg, rp, curStage);
+					if (ropts.isTrace) {
+						ropts.errStream.printf("\t[DEBUG] Added to stage %d: %s\n\t\tContents: %s\n",
+								procStg, rp, curStage);
 					}
 
-					curStage.add(rp);
+					curStage.add(rp);
 				}
-			}
+			}
 			
-			tmpList.addAll(curStage);
-			tmpList.sort(null);
-		}
+			tmpList.addAll(curStage);
+			tmpList.sort(null);
+		}
 
 		// Copy over to output, excluding internals
-		for (ReplPair rp : tmpList) {
-			if (rp.stat == StageStatus.INTERNAL) {
-				if (ropts.isTrace) ropts.errStream.printf("\t[DEBUG] Excluded internal: %s\n", rp);
+		for (ReplPair rp : tmpList) {
+			if (rp.stat == StageStatus.INTERNAL) {
+				if (ropts.isTrace) ropts.errStream.printf("\t[DEBUG] Excluded internal: %s\n", rp);
 
 				continue;
 			}
 
-			detals.add(rp);
-		}
+			detals.add(rp);
+		}
 
-		detals.sort(null);
+		detals.sort(null);
 
-		if (ropts.isTrace) {
-			ropts.errStream.printf("\t[DEBUG] Final output: %s\n", detals);
+		if (ropts.isTrace) {
+			ropts.errStream.printf("\t[DEBUG] Final output: %s\n", detals);
 		}
 
-		return detals;
+		return detals;
 	}
 
 	private static String readMultiLine(String lead, Scanner src, ReplOpts ropts,
 			List<ReplError> errs, String typ, IntHolder lno) {
-		String tmp = lead;
+		String tmp = lead;
 
-		if (ropts.isTrace && tmp.endsWith("\\")) 
-			ropts.errStream.printf("\t[TRACE] Starting multi-line parse for %s '%s'\n", typ, tmp);
+		if (ropts.isTrace && tmp.endsWith("\\")) 
+			ropts.errStream.printf("\t[TRACE] Starting multi-line parse for %s '%s'\n", typ, tmp);
 
-		boolean didMulti = tmp.endsWith("\\");
-		while (tmp.endsWith("\\")) {
-			boolean incNL = tmp.endsWith("|\\");
+		boolean didMulti = tmp.endsWith("\\");
+		while (tmp.endsWith("\\")) {
+			boolean incNL = tmp.endsWith("|\\");
 
-			if (!src.hasNextLine()) break;
+			if (!src.hasNextLine()) break;
 
-			String nxt = src.nextLine().trim();
-			lno.incr();
+			String nxt = src.nextLine().trim();
+			lno.incr();
 
-			if (nxt.startsWith("#")) continue;
+			if (nxt.startsWith("#")) continue;
 
-			String nlStr = incNL ? "\n" : "";
+			String nlStr = incNL ? "\n" : "";
 
-			if (tmp.endsWith("\\")) {
-				if (incNL) {
-					tmp = tmp.substring(0, tmp.length() - 2);
+			if (tmp.endsWith("\\")) {
+				if (incNL) {
+					tmp = tmp.substring(0, tmp.length() - 2);
 				} else {
-					tmp = tmp.substring(0, tmp.length() - 1);
+					tmp = tmp.substring(0, tmp.length() - 1);
 				}
 			}
 
-			tmp = String.format("%s%s%s", tmp, nlStr, nxt);
-		}
+			tmp = String.format("%s%s%s", tmp, nlStr, nxt);
+		}
 
-		if (ropts.isTrace && didMulti)
-			ropts.errStream.printf("\t[TRACE] Finished multi-line parse for %s:\n%s\n.\n",
+		if (ropts.isTrace && didMulti)
+			ropts.errStream.printf("\t[TRACE] Finished multi-line parse for %s:\n%s\n.\n",
 					typ, tmp);
 
-		return tmp;
+		return tmp;
 	}
 
 	@Override
 	public String apply(String inp) {
-		return inp.replaceAll(find, replace);
+		if (guard != null) {
+			if (!inp.matches(guard)) return inp;
+		}
+
+		return inp.replaceAll(find, replace);
 	}
 
 	@Override
 	public String toString() {
-		String nameStr = "";
+		String nameStr = "";
 
-		if (!find.equals(name)) nameStr = String.format("(%s)", name);
+		if (!find.equals(name)) nameStr = String.format("(%s)", name);
 
-		return String.format("%ss/(%s)/(%s)/p(%d)", nameStr, find, replace, priority);
+		return String.format("%ss/(%s)/(%s)/p(%d)", nameStr, find, replace, priority);
 	}
 
 	@Override
 	public int compareTo(ReplPair rp) {
-		if (this.priority == rp.priority) return this.lno - rp.lno;
+		if (this.priority == rp.priority) return this.lno - rp.lno;
 
-		return rp.priority - this.priority;
+		return rp.priority - this.priority;
 	}
 	
 	@Override
 	public int hashCode() {
-		final int prime = 31;
-		int result = 1;
-		result = prime * result + ((find == null) ? 0 : find.hashCode());
-		result = prime * result + ((name == null) ? 0 : name.hashCode());
-		result = prime * result + priority;
-		result = prime * result + ((replace == null) ? 0 : replace.hashCode());
-		result = prime * result + stage;
-		return result;
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((find == null) ? 0 : find.hashCode());
+		result = prime * result + ((name == null) ? 0 : name.hashCode());
+		result = prime * result + priority;
+		result = prime * result + ((replace == null) ? 0 : replace.hashCode());
+		result = prime * result + stage;
+		return result;
 	}
 
 	@Override
 	public boolean equals(Object obj) {
-		if (this == obj) return true;
-		if (obj == null) return false;
-		if (getClass() != obj.getClass()) return false;
-		ReplPair other = (ReplPair) obj;
-		if (find == null) {
-			if (other.find != null) return false;
-		} else if (!find.equals(other.find)) return false;
-		if (name == null) {
-			if (other.name != null) return false;
-		} else if (!name.equals(other.name)) return false;
-		if (priority != other.priority) return false;
-		if (replace == null) {
-			if (other.replace != null) return false;
-		} else if (!replace.equals(other.replace)) return false;
-		if (stage != other.stage) return false;
-		return true;
+		if (this == obj) return true;
+		if (obj == null) return false;
+		if (getClass() != obj.getClass()) return false;
+		ReplPair other = (ReplPair) obj;
+		if (find == null) {
+			if (other.find != null) return false;
+		} else if (!find.equals(other.find)) return false;
+		if (name == null) {
+			if (other.name != null) return false;
+		} else if (!name.equals(other.name)) return false;
+		if (priority != other.priority) return false;
+		if (replace == null) {
+			if (other.replace != null) return false;
+		} else if (!replace.equals(other.replace)) return false;
+		if (stage != other.stage) return false;
+		return true;
 	}
 
 	private static String readName(String nam, Scanner scn, List<ReplError> errs,
 			ReplPair rp, ReplOpts ropts, IntHolder lno, IntHolder pno) {
-		ControlledString cs = getControls(nam, errs, ropts, lno, pno, "name");
+		ControlledString cs = getControls(nam, errs, ropts, lno, pno, "name");
 
-		boolean isMulti = ropts.defMulti;
+		boolean isMulti = ropts.defMulti;
 
-		String name = cs.strang;
+		String name = cs.strang;
 
-		if (cs.hasControls()) {
-			for (Control cont : cs.controls) {
-				switch (cont.name) {
+		if (cs.hasControls()) {
+			for (Control cont : cs.controls) {
+				switch (cont.name) {
 					case "NAME":
 					case "N":
-						if (cont.count() != 1) {
-							String errMsg = String.format("One name argument was expected (got %d)",
-									cont.count());
+						if (cont.count() != 1) {
+							String errMsg = String.format("One name argument was expected (got %d)",
+									cont.count());
 
-							errs.add(new ReplError(lno, pno, errMsg, nam));
-						} else {
-							rp.name = cont.get(0);
+							errs.add(new ReplError(lno, pno, errMsg, nam));
+						} else {
+							rp.name = cont.get(0);
 						}
-						break;
+						break;
+					case "GUARD":
+					case "G":
+						if (cont.count() != 1) {
+							String errMsg = String.format("One guard argument was expected (got %d)",
+									cont.count());
+
+							errs.add(new ReplError(lno, pno, errMsg, nam));
+						} else {
+							String pat = cont.get(0);
+
+							try {
+								Pattern.compile(pat);
+							} catch (PatternSyntaxException psex) {
+								String errMsg = String.format("Guard argument '%s' is not a valid regex (%s)",
+										pat, psex.getMessage());
+
+								errs.add(new ReplError(lno, pno, errMsg, nam));
+							}
+
+							rp.guard = cont.get(0);
+						}
+						break;
 					case "PRIORITY":
 					case "PRIOR":
 					case "P":
 						try {
-							if (cont.count() != 1) {
-								String errMsg = String.format("One priority argument was expected (got %d",
-										cont.count());
+							if (cont.count() != 1) {
+								String errMsg = String.format("One priority argument was expected (got %d",
+										cont.count());
 
-								errs.add(new ReplError(lno, pno, errMsg, nam));
-							} else {
-								rp.priority = Integer.parseInt(cont.get(0));
+								errs.add(new ReplError(lno, pno, errMsg, nam));
+							} else {
+								rp.priority = Integer.parseInt(cont.get(0));
 							}
-						} catch (NumberFormatException nfex) {
-							String errMsg = String.format("'%s' is not a valid priority (must be an integer)",
-									cont.get(0));
+						} catch (NumberFormatException nfex) {
+							String errMsg = String.format("'%s' is not a valid priority (must be an integer)",
+									cont.get(0));
 
-							errs.add(new ReplError(lno, pno, errMsg, nam));
-						}
-						break;
+							errs.add(new ReplError(lno, pno, errMsg, nam));
+						}
+						break;
 					case "STAGE":
 					case "S":
 						try {
-							if (cont.count() != 1) {
-								String errMsg = String.format("One stage argument was expected (got %d",
-										cont.count());
-
-								errs.add(new ReplError(lno, pno, errMsg, nam));
-							} else {
-								int tmpStage = Integer.parseInt(cont.get(0));
-								if (tmpStage < 0) {
-									String errMsg = String.format("'%s' is not a valid stage (must be a positive integer)",
-											cont.get(0));
-									errs.add(new ReplError(lno, pno, errMsg, nam));
-
-									break;
+							if (cont.count() != 1) {
+								String errMsg = String.format("One stage argument was expected (got %d",
+										cont.count());
+
+								errs.add(new ReplError(lno, pno, errMsg, nam));
+							} else {
+								int tmpStage = Integer.parseInt(cont.get(0));
+								if (tmpStage < 0) {
+									String errMsg = String.format("'%s' is not a valid stage (must be a positive integer)",
+											cont.get(0));
+									errs.add(new ReplError(lno, pno, errMsg, nam));
+
+									break;
 								}
-								rp.stage = tmpStage;
+								rp.stage = tmpStage;
 							}
-						} catch (NumberFormatException nfex) {
-							String errMsg = String.format("'%s' is not a valid stage (must be a positive integer)",
-									cont.get(0));
+						} catch (NumberFormatException nfex) {
+							String errMsg = String.format("'%s' is not a valid stage (must be a positive integer)",
+									cont.get(0));
 
-							errs.add(new ReplError(lno, pno, errMsg, nam));
-						}
-						break;
+							errs.add(new ReplError(lno, pno, errMsg, nam));
+						}
+						break;
 					case "MULTITRUE":
 					case "MULTIT":
 					case "MT":
-						isMulti = true;
-						break;
+						isMulti = true;
+						break;
 					case "MULTIFALSE":
 					case "MULTIF":
 					case "MF":
-						isMulti = false;
-						break;
+						isMulti = false;
+						break;
 					case "MULTI":
 					case "M":
-						if (cont.count() != 1) {
-							String errMsg = String.format("One multi-flag argument was expected (got %d",
-									cont.count());
+						if (cont.count() != 1) {
+							String errMsg = String.format("One multi-flag argument was expected (got %d",
+									cont.count());
 
-							errs.add(new ReplError(lno, pno, errMsg, nam));
-						} else {
-							isMulti = Boolean.parseBoolean(cont.get(0));
+							errs.add(new ReplError(lno, pno, errMsg, nam));
+						} else {
+							isMulti = Boolean.parseBoolean(cont.get(0));
 						}
-						break;
+						break;
 					case "INTERNAL":
 					case "INT":
 					case "I":
-						rp.stat = StageStatus.INTERNAL;
-						break;
+						rp.stat = StageStatus.INTERNAL;
+						break;
 					case "EXTERNAL":
 					case "EXT":
 					case "E":
-						rp.stat = StageStatus.EXTERNAL;
-						break;
+						rp.stat = StageStatus.EXTERNAL;
+						break;
 					case "BOTH":
 					case "B":
-						rp.stat = StageStatus.BOTH;
-						break;
+						rp.stat = StageStatus.BOTH;
+						break;
 					default: 
 						{
-							String errMsg = String.format("Unknown control name '%s' for name '%s'",
+							String errMsg = String.format("Unknown control name '%s' for name '%s'",
 									cont.name, nam);
 
-							ReplError erd = new ReplError(lno, pno, errMsg, nam);
+							ReplError erd = new ReplError(lno, pno, errMsg, nam);
 
-							errs.add(erd);
+							errs.add(erd);
 						}
 						break;
 				}
 			}
 
-			name = cs.strang;
+			name = cs.strang;
 		}
 
 		// Multi-line name with a trailer
-		if (isMulti) {
-			String tmp = readMultiLine(name, scn, ropts, errs, "name", lno);
-			if (tmp == null) return null;
-			name = tmp;
+		if (isMulti) {
+			String tmp = readMultiLine(name, scn, ropts, errs, "name", lno);
+			if (tmp == null) return null;
+			name = tmp;
 		}
 
-		return name;
+		return name;
 	}
 
 	private static void readGlobal(String nam, Scanner scn, List<ReplError> errs,
 			ReplOpts ropts, IntHolder lno, IntHolder pno) {
-		ControlledString cs = getControls(nam.substring(1), errs, ropts, lno, pno, "global");
+		ControlledString cs = getControls(nam.substring(1), errs, ropts, lno, pno, "global");
 
-		for (Control cont : cs.controls) {
-			switch (cont.name) {
+		for (Control cont : cs.controls) {
+			switch (cont.name) {
 			case "PRIORITY":
 			case "PRIOR":
 			case "P":
 				try {
-					if (cont.count() != 1) {
-						String errMsg = String.format("Must specify 1 priority (%d specified)",
-								cont.count());
-
-						errs.add(new ReplError(lno, pno, errMsg, nam));
-					} else {
-						int tmp = Integer.parseInt(cont.get(0));
-						ropts.defPrior = tmp;
+					if (cont.count() != 1) {
+						String errMsg = String.format("Must specify 1 priority (%d specified)",
+								cont.count());
+
+						errs.add(new ReplError(lno, pno, errMsg, nam));
+					} else {
+						int tmp = Integer.parseInt(cont.get(0));
+						ropts.defPrior = tmp;
 					}
-				} catch (NumberFormatException nfex) {
-					String errMsg = String.format("'%s' is not a valid priority (must be an integer)",
-							cont.get(0));
+				} catch (NumberFormatException nfex) {
+					String errMsg = String.format("'%s' is not a valid priority (must be an integer)",
+							cont.get(0));
 
-					errs.add(new ReplError(lno, pno, errMsg, nam));
-				}
-				break;
+					errs.add(new ReplError(lno, pno, errMsg, nam));
+				}
+				break;
 			case "STAGE":
 			case "S":
 				try {
-					if (cont.count() != 1) {
-						String errMsg = String.format("Must specify 1 stage (%d specified)",
-								cont.count());
+					if (cont.count() != 1) {
+						String errMsg = String.format("Must specify 1 stage (%d specified)",
+								cont.count());
 
-						errs.add(new ReplError(lno, pno, errMsg, nam));
-					} else {
-						int tmpStage = Integer.parseInt(cont.get(0));
+						errs.add(new ReplError(lno, pno, errMsg, nam));
+					} else {
+						int tmpStage = Integer.parseInt(cont.get(0));
 
-						if (tmpStage < 0) {
-							String errMsg = String.format("'%s' is not a valid stage (must be a positive integer)",
-									cont.get(0));
+						if (tmpStage < 0) {
+							String errMsg = String.format("'%s' is not a valid stage (must be a positive integer)",
+									cont.get(0));
 
-							errs.add(new ReplError(lno, pno, errMsg, nam));
-							break;
+							errs.add(new ReplError(lno, pno, errMsg, nam));
+							break;
 						}
 
-						ropts.defStage = tmpStage;
+						ropts.defStage = tmpStage;
 					}
-				} catch (NumberFormatException nfex) {
-					String errMsg = String.format("'%s' is not a valid stage (must be a positive integer)",
-							cont.get(0));
+				} catch (NumberFormatException nfex) {
+					String errMsg = String.format("'%s' is not a valid stage (must be a positive integer)",
+							cont.get(0));
 
-					errs.add(new ReplError(lno, pno, errMsg, nam));
-				}
-				break;
+					errs.add(new ReplError(lno, pno, errMsg, nam));
+				}
+				break;
 			case "MULTITRUE":
 			case "MULTIT":
 			case "MT":
-				ropts.defMulti = true;
-				break;
+				ropts.defMulti = true;
+				break;
 			case "MULTIFALSE":
 			case "MULTIF":
 			case "MF":
-				ropts.defMulti = false;
-				break;
+				ropts.defMulti = false;
+				break;
 			case "MULTI":
 			case "M":
-				if (cont.count() != 1) {
-					String errMsg = String.format("Must specify 1 multi-flag (%d specified)",
-							cont.count());
+				if (cont.count() != 1) {
+					String errMsg = String.format("Must specify 1 multi-flag (%d specified)",
+							cont.count());
 
-					errs.add(new ReplError(lno, pno, errMsg, nam));
-				} else {
-					ropts.defMulti = Boolean.parseBoolean(cont.get(0));
+					errs.add(new ReplError(lno, pno, errMsg, nam));
+				} else {
+					ropts.defMulti = Boolean.parseBoolean(cont.get(0));
 				}
-				break;
+				break;
 			case "INTERNAL":
 			case "INT":
 			case "I":
-				ropts.defStatus = StageStatus.INTERNAL;
-				break;
+				ropts.defStatus = StageStatus.INTERNAL;
+				break;
 			case "EXTERNAL":
 			case "EXT":
 			case "E":
-				ropts.defStatus = StageStatus.EXTERNAL;
-				break;
+				ropts.defStatus = StageStatus.EXTERNAL;
+				break;
 			case "BOTH":
 			case "B":
-				ropts.defStatus = StageStatus.BOTH;
-				break;
+				ropts.defStatus = StageStatus.BOTH;
+				break;
 			case "DEBUGTRUE":
 			case "DEBUGT":
 			case "DT":
-				ropts.isDebug = true;
-				break;
+				ropts.isDebug = true;
+				break;
 			case "DEBUGFALSE":
 			case "DEBUGF":
 			case "DF":
-				ropts.isDebug = false;
-				break;
+				ropts.isDebug = false;
+				break;
 			case "DEBUG":
 			case "D":
-				if (cont.count() != 1) {
-					String errMsg = String.format("Must specify 1 debug flag (%d specified)",
-							cont.count());
+				if (cont.count() != 1) {
+					String errMsg = String.format("Must specify 1 debug flag (%d specified)",
+							cont.count());
 
-					errs.add(new ReplError(lno, pno, errMsg, nam));
-				} else {
-					ropts.isDebug = Boolean.parseBoolean(cont.get(0));
+					errs.add(new ReplError(lno, pno, errMsg, nam));
+				} else {
+					ropts.isDebug = Boolean.parseBoolean(cont.get(0));
 				}
-				break;
+				break;
 			case "TRACETRUE":
 			case "TRACET":
 			case "TT":
-				ropts.isTrace = true;
-				break;
+				ropts.isTrace = true;
+				break;
 			case "TRACEFALSE":
 			case "TRACEF":
 			case "TF":
-				ropts.isTrace = false;
-				break;
+				ropts.isTrace = false;
+				break;
 			case "TRACE":
 			case "T":
-				if (cont.count() != 1) {
-					String errMsg = String.format("Must specify 1 trace flag (%d specified)",
-							cont.count());
+				if (cont.count() != 1) {
+					String errMsg = String.format("Must specify 1 trace flag (%d specified)",
+							cont.count());
 
-					errs.add(new ReplError(lno, pno, errMsg, nam));
-				} else {
-					ropts.isTrace = Boolean.parseBoolean(cont.get(0));
+					errs.add(new ReplError(lno, pno, errMsg, nam));
+				} else {
+					ropts.isTrace = Boolean.parseBoolean(cont.get(0));
 				}
-				break;
+				break;
 			case "PERFTRUE":
 			case "PERFT":
 			case "PRFT":
-				ropts.isPerf = true;
-				break;
+				ropts.isPerf = true;
+				break;
 			case "PERFFALSE":
 			case "PERFF":
 			case "PRFF":
-				ropts.isPerf = false;
-				break;
+				ropts.isPerf = false;
+				break;
 			case "PERF":
 			case "PRF":
-				if (cont.count() != 1) {
-					String errMsg = String.format("Must specify 1 perf. flag (%d specified)",
-							cont.count());
+				if (cont.count() != 1) {
+					String errMsg = String.format("Must specify 1 perf. flag (%d specified)",
+							cont.count());
 
-					errs.add(new ReplError(lno, pno, errMsg, nam));
-				} else {
-					ropts.isPerf = Boolean.parseBoolean(cont.get(0));
+					errs.add(new ReplError(lno, pno, errMsg, nam));
+				} else {
+					ropts.isPerf = Boolean.parseBoolean(cont.get(0));
 				}
-				break;
+				break;
 			default: 
 				{
-					String msg = String.format("Invalid global control name '%s'", cont.name);
-					ReplError err = new ReplError(lno, pno, msg, nam);
-					errs.add(err);
+					String msg = String.format("Invalid global control name '%s'", cont.name);
+					ReplError err = new ReplError(lno, pno, msg, nam);
+					errs.add(err);
 				}
 				break;
 			}
 
-			if (ropts.isTrace) 
-				ropts.errStream.printf("\t[TRACE] Processed global control '%s'\n", cont);
+			if (ropts.isTrace) 
+				ropts.errStream.printf("\t[TRACE] Processed global control '%s'\n", cont);
 		}
 
-		return;
+		return;
 	}
 	
 	private static ControlledString getControls(String lne, List<ReplError> errs,
-			ReplOpts ropts, IntHolder lno, IntHolder pno, String type) 
-	{
+			ReplOpts ropts, IntHolder lno, IntHolder pno, String type) {
 		try {
-			return ControlledString.parse(lne, new ParseStrings("//", ";", "/", "|"));
-		} catch (IllegalArgumentException iaex) {
-			String msg = "Did not find control terminator (//) in %s where it should be";
-			msg = String.format(msg, type);
+			return ControlledString.parse(lne, new ParseStrings("//", ";", "/", "|"));
+		} catch (IllegalArgumentException iaex) {
+			String msg = "Did not find control terminator (//) in %s where it should be";
+			msg = String.format(msg, type);
 
-			ReplError re = new ReplError(lno, pno, msg, lne);
-			errs.add(re);
+			ReplError re = new ReplError(lno, pno, msg, lne);
+			errs.add(re);
 
-			return null;
+			return null;
 		}
 	}
 }
-- 
cgit v1.2.3