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 * Implements the (?<number) Pattern, where number is an integer telling us 14 * how far to back up in the Pattern. Not in perl 5. 15 */ 16 class Skipped extends Pattern 17 { 18 String s; 19 Skipped(String s)20 Skipped(String s) 21 { 22 this.s = s; 23 } 24 toString()25 public String toString() 26 { 27 return s + nextString(); 28 } 29 matchInternal(int pos, Pthings pt)30 public int matchInternal(int pos, Pthings pt) 31 { 32 // if(pt.no_check || s.regionMatches(pt.ignoreCase,0,pt.src,pos,s.length())) 33 if (pt.no_check 34 || CaseMgr.regionMatches(s, pt.ignoreCase, 0, pt.src, pos, 35 s.length())) 36 { 37 return nextMatch(pos + s.length(), pt); 38 } 39 return -1; 40 } 41 minChars()42 public patInt minChars() 43 { 44 return new patInt(s.length()); 45 } 46 maxChars()47 public patInt maxChars() 48 { 49 return new patInt(s.length()); 50 } 51 clone1(Hashtable h)52 Pattern clone1(Hashtable h) 53 { 54 return new Skipped(s); 55 } 56 }; 57