From a47af2c165575bc1a984bca30962cc2af8a7d623 Mon Sep 17 00:00:00 2001 From: dchandler Date: Tue, 21 Oct 2003 00:31:10 +0000 Subject: [PATCH] Bulletproofing -- code cleanup. --- source/org/thdl/tib/text/ttt/TParseTree.java | 4 ++-- source/org/thdl/tib/text/ttt/TStackList.java | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source/org/thdl/tib/text/ttt/TParseTree.java b/source/org/thdl/tib/text/ttt/TParseTree.java index 00250e7..36c190b 100644 --- a/source/org/thdl/tib/text/ttt/TParseTree.java +++ b/source/org/thdl/tib/text/ttt/TParseTree.java @@ -304,7 +304,7 @@ class TParseTree { if (warningLevel == "All") return "Warning: The last stack does not have a vowel in the ACIP {" + ((null != originalACIP) ? originalACIP : recoverACIP()) + "}; this may indicate a typo, because Sanskrit, which this is (because it's not legal Tibetan), should have a vowel after each stack."; } else { - return "Warning: There is a stack, before the last stack, without a vowel in the ACIP {" + ((null != originalACIP) ? originalACIP : recoverACIP()) + "}; this may indicate a typo, because Sanskrit, which this is (because it's not legal Tibetan), should have a vowel after each stack."; + throw new Error("Can't happen now that we stack greedily"); } } if ("All" == warningLevel) { @@ -317,7 +317,7 @@ class TParseTree { if (warningLevel == "All") return "Warning: The last stack does not have a vowel in the ACIP {" + ((null != originalACIP) ? originalACIP : recoverACIP()) + "}; this may indicate a typo, because Sanskrit, which this is (because it's not legal Tibetan), should have a vowel after each stack."; } else { - return "Warning: There is a stack, before the last stack, without a vowel in the ACIP {" + ((null != originalACIP) ? originalACIP : recoverACIP()) + "}; this may indicate a typo, because Sanskrit, which this is (because it's not legal Tibetan), should have a vowel after each stack."; + throw new Error("Can't happen now that we stack greedily"); } } } diff --git a/source/org/thdl/tib/text/ttt/TStackList.java b/source/org/thdl/tib/text/ttt/TStackList.java index e624bb6..0b34760 100644 --- a/source/org/thdl/tib/text/ttt/TStackList.java +++ b/source/org/thdl/tib/text/ttt/TStackList.java @@ -203,8 +203,11 @@ class TStackList { if (null == lastPair.getRight() && !((l = lastPair.getLeft()) != null && l.length() == 1 && l.charAt(0) >= '0' && l.charAt(0) <= '9')) { - if (null != isLastStack) + if (null != isLastStack) { isLastStack[0] = (i + 1 == size()); + if (!isLastStack[0]) + throw new Error("But we now stack greedily!"); + } return true; } }