-//\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
-import java.util.*;\r
-\r
-//class AddToEnd extends RegSyntax {};\r
-\r
-/** Compiles the '$' or the '\Z' Pattern. It is\r
- an error to have further Pattern elements after\r
- '\Z'. It is the end of the String. */\r
-class End\r
- extends Pattern\r
-{\r
- boolean retIsEnd;\r
- End(boolean b)\r
- {\r
- retIsEnd = b;\r
- }\r
-\r
- public int matchInternal(int pos, Pthings pt)\r
- {\r
- if (retIsEnd && pt.mFlag && pos < pt.src.length())\r
- {\r
- if (pt.src.charAt(pos) == '\n')\r
- {\r
- return nextMatch(pos, pt);\r
- }\r
- }\r
- if (pt.src.length() == pos)\r
- {\r
- return nextMatch(pos, pt);\r
- }\r
- else if (pos < pt.src.length())\r
- {\r
- // Access the next character...\r
- // this is crucial to making\r
- // RegexReader work.\r
- pt.src.charAt(pos);\r
- }\r
- return -1;\r
- }\r
-\r
- public String toString()\r
- {\r
- if (retIsEnd)\r
- {\r
- return "$";\r
- }\r
- else\r
- {\r
- return "\\Z";\r
- }\r
- }\r
-\r
- public patInt maxChars()\r
- {\r
- return new patInt(1);\r
- }\r
-\r
- public Pattern clone1(Hashtable h)\r
- {\r
- return new End(retIsEnd);\r
- }\r
-};\r
+//
+// This software is now distributed according to
+// the Lesser Gnu Public License. Please see
+// http://www.gnu.org/copyleft/lesser.txt for
+// the details.
+// -- Happy Computing!
+//
+package com.stevesoft.pat;
+
+import java.util.Hashtable;
+
+//class AddToEnd extends RegSyntax {};
+
+/**
+ * Compiles the '$' or the '\Z' Pattern. It is an error to have further Pattern
+ * elements after '\Z'. It is the end of the String.
+ */
+class End extends Pattern
+{
+ boolean retIsEnd;
+
+ End(boolean b)
+ {
+ retIsEnd = b;
+ }
+
+ public int matchInternal(int pos, Pthings pt)
+ {
+ if (retIsEnd && pt.mFlag && pos < pt.src.length())
+ {
+ if (pt.src.charAt(pos) == '\n')
+ {
+ return nextMatch(pos, pt);
+ }
+ }
+ if (pt.src.length() == pos)
+ {
+ return nextMatch(pos, pt);
+ }
+ else if (pos < pt.src.length())
+ {
+ // Access the next character...
+ // this is crucial to making
+ // RegexReader work.
+ pt.src.charAt(pos);
+ }
+ return -1;
+ }
+
+ public String toString()
+ {
+ if (retIsEnd)
+ {
+ return "$";
+ }
+ else
+ {
+ return "\\Z";
+ }
+ }
+
+ public patInt maxChars()
+ {
+ return new patInt(1);
+ }
+
+ public Pattern clone1(Hashtable h)
+ {
+ return new End(retIsEnd);
+ }
+};