1 19 package gnu.regexp; 20 21 final class RETokenEnd extends REToken { 22 25 private String newline; 26 27 RETokenEnd(int subIndex,String newline) { 28 super(subIndex); 29 this.newline = newline; 30 } 31 32 boolean match(CharIndexed input, REMatch mymatch) { 33 char ch = input.charAt(mymatch.index); 34 if (ch == CharIndexed.OUT_OF_BOUNDS) 35 return ((mymatch.eflags & RE.REG_NOTEOL)>0) ? 36 false : next(input, mymatch); 37 if (newline != null) { 38 char z; 39 int i = 0; do { 41 z = newline.charAt(i); 42 if (ch != z) return false; 43 ++i; 44 ch = input.charAt(mymatch.index + i); 45 } while (i < newline.length()); 46 47 return next(input, mymatch); 48 } 49 return false; 50 } 51 52 void dump(StringBuffer os) { 53 os.append('$'); 54 } 55 } 56 | Popular Tags |