needed for applet search
[jalview.git] / src / com / stevesoft / pat / RegSyntaxError.java
diff --git a/src/com/stevesoft/pat/RegSyntaxError.java b/src/com/stevesoft/pat/RegSyntaxError.java
new file mode 100755 (executable)
index 0000000..c403412
--- /dev/null
@@ -0,0 +1,29 @@
+//\r
+// This software is now distributed according to\r
+// the Lesser Gnu Public License.  Please see\r
+// http://www.gnu.org/copyleft/lesser.txt for\r
+// the details.\r
+//    -- Happy Computing!\r
+//\r
+package com.stevesoft.pat;\r
+\r
+/** When enabled, this class is thrown instead of\r
+    the normal RegSyntax.  Thus, enabling of this\r
+    class will make your debugging easier -- but\r
+    if you leave it on and forget to catch RegSyntaxError\r
+    a user-supplied pattern could generate a\r
+    RegSyntaxError that will kill your application.\r
+\r
+    I strongly recommend turning this flag on, however,\r
+    as I think it is more likely to help than to hurt\r
+    your programming efforts.\r
+    */\r
+public class RegSyntaxError extends Error {\r
+    public static boolean RegSyntaxErrorEnabled = false;\r
+    public RegSyntaxError() {}\r
+    public RegSyntaxError(String s) { super(s); }\r
+    final static void endItAll(String s) throws RegSyntax {\r
+        if(RegSyntaxErrorEnabled) throw new RegSyntaxError(s);\r
+        throw new RegSyntax(s);\r
+    }\r
+}\r