-//\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
-import java.util.Hashtable;\r
-\r
-/** This class implements the word boundary pattern element: \b. */\r
-class Boundary extends Pattern {\r
- public String toString() {\r
- return "\\b"+nextString();\r
- }\r
- boolean isAChar(char c) {\r
- if(c >= 'a' && c <= 'z')\r
- return true;\r
- if(c >= 'A' && c <= 'Z')\r
- return true;\r
- if(c >= '0' && c <= '9')\r
- return true;\r
- if(c == '_')\r
- return true;\r
- return false;\r
- }\r
- boolean matchLeft(int pos,Pthings pt) {\r
- if(pos <= 0)\r
- return true;\r
- if(isAChar(pt.src.charAt(pos))\r
- && isAChar(pt.src.charAt(pos-1)))\r
- return false;\r
- return true;\r
- }\r
- boolean matchRight(int pos,Pthings pt) {\r
- if(pos < 0) return false;\r
- if(pos+1 >= pt.src.length())\r
- return true;\r
- if(isAChar(pt.src.charAt(pos))\r
- && isAChar(pt.src.charAt(pos+1)))\r
- return false;\r
- return true;\r
- }\r
- public int matchInternal(int pos,Pthings pt) {\r
- if(matchRight(pos-1,pt) || matchLeft(pos,pt))\r
- return nextMatch(pos,pt);\r
- return -1;\r
- }\r
- public patInt maxChars() { return new patInt(0); }\r
- public Pattern clone1(Hashtable h) { return new Boundary(); }\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;
+
+/** This class implements the word boundary pattern element: \b. */
+class Boundary extends Pattern
+{
+ public String toString()
+ {
+ return "\\b" + nextString();
+ }
+
+ boolean isAChar(char c)
+ {
+ if (c >= 'a' && c <= 'z')
+ {
+ return true;
+ }
+ if (c >= 'A' && c <= 'Z')
+ {
+ return true;
+ }
+ if (c >= '0' && c <= '9')
+ {
+ return true;
+ }
+ if (c == '_')
+ {
+ return true;
+ }
+ return false;
+ }
+
+ boolean matchLeft(int pos, Pthings pt)
+ {
+ if (pos <= 0)
+ {
+ return true;
+ }
+ if (isAChar(pt.src.charAt(pos)) && isAChar(pt.src.charAt(pos - 1)))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ boolean matchRight(int pos, Pthings pt)
+ {
+ if (pos < 0)
+ {
+ return false;
+ }
+ if (pos + 1 >= pt.src.length())
+ {
+ return true;
+ }
+ if (isAChar(pt.src.charAt(pos)) && isAChar(pt.src.charAt(pos + 1)))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public int matchInternal(int pos, Pthings pt)
+ {
+ if (matchRight(pos - 1, pt) || matchLeft(pos, pt))
+ {
+ return nextMatch(pos, pt);
+ }
+ return -1;
+ }
+
+ public patInt maxChars()
+ {
+ return new patInt(0);
+ }
+
+ public Pattern clone1(Hashtable h)
+ {
+ return new Boundary();
+ }
+};