1 Clazz.declarePackage ("com.stevesoft.pat");
\r
2 Clazz.load (["com.stevesoft.pat.PatternSub"], "com.stevesoft.pat.Multi_stage2", ["com.stevesoft.pat.RegSyntaxError", "$.patInt"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
6 this.matchMin = null;
\r
7 this.matchMax = null;
\r
8 this.matchFewest = false;
\r
10 Clazz.instantialize (this, arguments);
\r
11 }, com.stevesoft.pat, "Multi_stage2", com.stevesoft.pat.PatternSub);
\r
12 Clazz.defineMethod (c$, "toString",
\r
15 ret += this.sub.toString ();
\r
16 ret += "{" + this.matchMin + "," + this.matchMax + "}";
\r
17 if (this.matchFewest) {
\r
19 }ret += this.parent.nextString ();
\r
22 Clazz.makeConstructor (c$,
\r
23 function (a, b, p) {
\r
24 Clazz.superConstructor (this, com.stevesoft.pat.Multi_stage2, []);
\r
26 com.stevesoft.pat.RegSyntaxError.endItAll ("Multiple match of Null pattern requested.");
\r
28 this.nextRet = this;
\r
29 this.sub.setParent (this);
\r
32 this.count = new com.stevesoft.pat.patInt (0);
\r
33 if (!a.lessEq (b)) {
\r
34 com.stevesoft.pat.RegSyntaxError.endItAll ("Bad Multi Args: " + a + ">" + b);
\r
35 }var i = new com.stevesoft.pat.patInt (-1);
\r
37 com.stevesoft.pat.RegSyntaxError.endItAll ("Bad Multi Args: " + a + "< 0");
\r
38 }}, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt,com.stevesoft.pat.Pattern");
\r
39 Clazz.defineMethod (c$, "getNext",
\r
41 return this.nextRet;
\r
43 Clazz.overrideMethod (c$, "matchInternal",
\r
44 function (pos, pt) {
\r
45 this.sub.setParent (this);
\r
47 if (this.pos_old >= 0 && pos == this.pos_old) {
\r
49 }this.pos_old = pos;
\r
50 if (this.matchMin.lessEq (this.count)) {
\r
52 }if (!this.count.lessEq (this.matchMax) || pos > pt.src.length ()) {
\r
54 }if ((this.matchFewest || this.count.equals (this.matchMax)) && canUse >= 0) {
\r
55 var n = Clazz.superCall (this, com.stevesoft.pat.Multi_stage2, "getNext", []);
\r
58 }var ret = this.testMatch (n, pos, pt);
\r
63 }}this.count.inc ();
\r
65 if (this.count.lessEq (this.matchMax)) {
\r
66 var r = this.testMatch (this.sub, pos, pt);
\r
72 if (!this.matchFewest && canUse >= 0) {
\r
73 var n = Clazz.superCall (this, com.stevesoft.pat.Multi_stage2, "getNext", []);
\r
76 }var ret = this.testMatch (n, pos, pt);
\r
80 }}, "~N,com.stevesoft.pat.Pthings");
\r
81 Clazz.overrideMethod (c$, "clone1",
\r
84 var m = new com.stevesoft.pat.Multi_stage2 (this.matchMin, this.matchMax, this.sub.clone (h));
\r
85 m.matchFewest = this.matchFewest;
\r
88 if (Clazz.exceptionOf (rs, com.stevesoft.pat.RegSyntax)) {
\r
94 }, "java.util.Hashtable");
\r