1 // 2 // This software is now distributed according to 3 // the Lesser Gnu Public License. Please see 4 // http://www.gnu.org/copyleft/lesser.txt for 5 // the details. 6 // -- Happy Computing! 7 // 8 package com.stevesoft.pat; 9 10 import java.util.Hashtable; 11 12 /** 13 * This is the '.' character in a Pattern. It matches any character. 14 */ 15 class Any extends Pattern 16 { matchInternal(int pos, Pthings pt)17 public int matchInternal(int pos, Pthings pt) 18 { 19 if (pos < pt.src.length()) 20 { 21 if (pt.dotDoesntMatchCR) 22 { 23 if (pt.src.charAt(pos) != '\n') 24 { 25 return nextMatch(pos + 1, pt); 26 } 27 } 28 else 29 { 30 return nextMatch(pos + 1, pt); 31 } 32 } 33 return -1; 34 } 35 toString()36 public String toString() 37 { 38 return "." + nextString(); 39 } 40 minChars()41 public patInt minChars() 42 { 43 return new patInt(1); 44 } 45 maxChars()46 public patInt maxChars() 47 { 48 return new patInt(1); 49 } 50 clone1(Hashtable h)51 public Pattern clone1(Hashtable h) 52 { 53 return new Any(); 54 } 55 }; 56