From 0b373102f64fd7bfd25837a24ffb4ccb44b9d7e9 Mon Sep 17 00:00:00 2001 From: bjculkin Date: Thu, 1 Mar 2018 14:16:15 -0500 Subject: Finish most of CL formatting. There are a couple of unimplemented directives, but the only ones I'd consider anywhere near crucial would be the floating-point ones, which I'm not sure what I should do with them. --- .../bjc/utils/ioutils/format/EscapeDirective.java | 42 ---------------------- 1 file changed, 42 deletions(-) delete mode 100644 base/src/main/java/bjc/utils/ioutils/format/EscapeDirective.java (limited to 'base/src/main/java/bjc/utils/ioutils/format/EscapeDirective.java') diff --git a/base/src/main/java/bjc/utils/ioutils/format/EscapeDirective.java b/base/src/main/java/bjc/utils/ioutils/format/EscapeDirective.java deleted file mode 100644 index 8db3a86..0000000 --- a/base/src/main/java/bjc/utils/ioutils/format/EscapeDirective.java +++ /dev/null @@ -1,42 +0,0 @@ -package bjc.utils.ioutils.format; - -import bjc.utils.esodata.Tape; - -import java.util.regex.Matcher; - -class EscapeDirective implements Directive { - - @Override - public void format(StringBuffer sb, Object item, CLModifiers mods, CLParameters params, - Tape formatParams, Matcher dirMatcher, CLFormatter fmt) { - boolean shouldExit; - - switch(params.length()) { - case 0: - shouldExit = formatParams.size() == 0; - break; - case 1: - int num = params.getInt(0, "condition count", '^'); - shouldExit = num == 0; - break; - case 2: - int left = params.getInt(0, "left-hand condition", '^'); - int right = params.getInt(1, "right-hand condition", '^'); - shouldExit = left == right; - break; - case 3: - default: - int low = params.getInt(0, "lower-bound condition", '^'); - int mid = params.getInt(1, "interval condition", '^'); - int high = params.getInt(2, "upper-bound condition", '^'); - shouldExit = (low <= mid) && (mid <= high); - break; - } - - /* At negates it. */ - if(mods.atMod) shouldExit = !shouldExit; - - if(shouldExit) throw new EscapeException(mods.colonMod); - } - -} -- cgit v1.2.3