1 19 20 package gnu.regexp; 21 22 final class RETokenBackRef extends REToken { 23 private int num; 24 private boolean insens; 25 26 RETokenBackRef(int subIndex, int num, boolean insens) { 27 super(subIndex); 28 this.num = num; 29 this.insens = insens; 30 } 31 32 34 boolean match(CharIndexed input, REMatch mymatch) { 35 int b,e; 36 b = mymatch.start[num]; 37 e = mymatch.end[num]; 38 if ((b==-1)||(e==-1)) return false; for (int i=b; i<e; i++) { 40 if (input.charAt(mymatch.index+i-b) != input.charAt(i)) { 41 return false; 42 } 43 } 44 mymatch.index += e-b; 45 return next(input, mymatch); 46 } 47 48 void dump(StringBuffer os) { 49 os.append('\\').append(num); 50 } 51 } 52 53 54 | Popular Tags |