2 // This software is now distributed according to
\r
3 // the Lesser Gnu Public License. Please see
\r
4 // http://www.gnu.org/copyleft/lesser.txt for
\r
6 // -- Happy Computing!
\r
8 package com.stevesoft.pat;
\r
9 import java.util.Hashtable;
\r
11 /** Simple custom patterns. See
\r
12 <a href="http://javaregex.com/code/deriv2.java.html">deriv2.java</a>
\r
13 and <a href="http://javaregex.com/code/deriv3.java.html">deriv3.java</a>
\r
14 in the test directory.
\r
15 @see com.stevesoft.pat.CustomEndpoint
\r
17 class Custom extends PatternSub {
\r
23 v = (Validator)Regex.validators.get(s);
\r
25 public int matchInternal(int pos,Pthings pt) {
\r
27 return sub.matchInternal(pos,pt);
\r
29 public String toString() {
\r
30 String a = v.argsave == null ? "" : ":"+v.argsave;
\r
31 return "(??"+select+a+")"+nextString();
\r
33 public patInt minChars() { return v.minChars(); }
\r
34 public patInt maxChars() { return v.maxChars(); }
\r
35 Pattern clone1(Hashtable h) {
\r
36 Custom c = new Custom(select);
\r
39 c.sub = sub.clone(h);
\r