2 // This software is now distributed according to
\r
3 // the Lesser Gnu Public License. Please see
\r
4 // http://www.gnu.org/copyleft/lesser.txt for
\r
6 // -- Happy Computing!
\r
8 package com.stevesoft.pat;
\r
9 import java.util.Hashtable;
\r
11 /** The '^' or the '\A' Pattern, matches the start of a string. */
\r
12 class Start extends Pattern {
\r
14 Start(boolean b) { retIsStart = b; }
\r
15 public int matchInternal(int pos,Pthings pt) {
\r
18 && pos > 0 && pt.src.charAt(pos-1)=='\n')
\r
19 return nextMatch(pos,pt);
\r
20 if(pos == 0) return nextMatch(pos,pt);
\r
23 public String toString() {
\r
25 return "^"+nextString();
\r
27 return "\\A"+nextString();
\r
29 public patInt maxChars() { return new patInt(0); }
\r
30 Pattern clone1(Hashtable h) { return new Start(retIsStart); }
\r