1 19 20 package gnu.regexp; 21 import java.io.Serializable ; 22 23 abstract class REToken implements Serializable { 24 25 protected REToken next = null; 26 protected REToken uncle = null; 27 protected int subIndex; 28 29 protected REToken(int subIndex) { 30 this.subIndex = subIndex; 31 } 32 33 int getMinimumLength() { 34 return 0; 35 } 36 37 void setUncle(REToken anUncle) { 38 uncle = anUncle; 39 } 40 41 42 abstract boolean match(CharIndexed input, REMatch mymatch); 43 44 45 protected boolean next(CharIndexed input, REMatch mymatch) { 46 if (next == null) { 47 if (uncle == null) { 48 return true; 49 } else { 50 return uncle.match(input, mymatch); 51 } 52 } else { 53 return next.match(input, mymatch); 54 } 55 } 56 57 boolean chain(REToken token) { 58 next = token; 59 return true; } 61 62 abstract void dump(StringBuffer os); 63 64 void dumpAll(StringBuffer os) { 65 dump(os); 66 if (next != null) next.dumpAll(os); 67 } 68 } 69 | Popular Tags |