X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fcom%2Fstevesoft%2Fpat%2FMulti_stage2.js;h=6d4f8fc7d83c6b14146c505e68af457d349bd4c9;hp=1d291ab4ece4c0dab044393aa9d376d234809533;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/j2s/com/stevesoft/pat/Multi_stage2.js b/site/j2s/com/stevesoft/pat/Multi_stage2.js index 1d291ab..6d4f8fc 100644 --- a/site/j2s/com/stevesoft/pat/Multi_stage2.js +++ b/site/j2s/com/stevesoft/pat/Multi_stage2.js @@ -1,95 +1,95 @@ -Clazz.declarePackage ("com.stevesoft.pat"); -Clazz.load (["com.stevesoft.pat.PatternSub"], "com.stevesoft.pat.Multi_stage2", ["com.stevesoft.pat.RegSyntaxError", "$.patInt"], function () { -c$ = Clazz.decorateAsClass (function () { -this.nextRet = null; -this.count = null; -this.matchMin = null; -this.matchMax = null; -this.matchFewest = false; -this.pos_old = -1; -Clazz.instantialize (this, arguments); -}, com.stevesoft.pat, "Multi_stage2", com.stevesoft.pat.PatternSub); -Clazz.defineMethod (c$, "toString", -function () { -var ret = ""; -ret += this.sub.toString (); -ret += "{" + this.matchMin + "," + this.matchMax + "}"; -if (this.matchFewest) { -ret += "?"; -}ret += this.parent.nextString (); -return ret; -}); -Clazz.makeConstructor (c$, -function (a, b, p) { -Clazz.superConstructor (this, com.stevesoft.pat.Multi_stage2, []); -if (p == null) { -com.stevesoft.pat.RegSyntaxError.endItAll ("Multiple match of Null pattern requested."); -}this.sub = p; -this.nextRet = this; -this.sub.setParent (this); -this.matchMin = a; -this.matchMax = b; -this.count = new com.stevesoft.pat.patInt (0); -if (!a.lessEq (b)) { -com.stevesoft.pat.RegSyntaxError.endItAll ("Bad Multi Args: " + a + ">" + b); -}var i = new com.stevesoft.pat.patInt (-1); -if (a.lessEq (i)) { -com.stevesoft.pat.RegSyntaxError.endItAll ("Bad Multi Args: " + a + "< 0"); -}}, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt,com.stevesoft.pat.Pattern"); -Clazz.defineMethod (c$, "getNext", -function () { -return this.nextRet; -}); -Clazz.overrideMethod (c$, "matchInternal", -function (pos, pt) { -this.sub.setParent (this); -var canUse = -1; -if (this.pos_old >= 0 && pos == this.pos_old) { -return -1; -}this.pos_old = pos; -if (this.matchMin.lessEq (this.count)) { -canUse = pos; -}if (!this.count.lessEq (this.matchMax) || pos > pt.src.length ()) { -return -1; -}if ((this.matchFewest || this.count.equals (this.matchMax)) && canUse >= 0) { -var n = Clazz.superCall (this, com.stevesoft.pat.Multi_stage2, "getNext", []); -if (n == null) { -return canUse; -}var ret = this.testMatch (n, pos, pt); -if (ret >= 0) { -return ret; -} else { -canUse = -1; -}}this.count.inc (); -try { -if (this.count.lessEq (this.matchMax)) { -var r = this.testMatch (this.sub, pos, pt); -if (r >= 0) { -return r; -}}} finally { -this.count.dec (); -} -if (!this.matchFewest && canUse >= 0) { -var n = Clazz.superCall (this, com.stevesoft.pat.Multi_stage2, "getNext", []); -if (n == null) { -return canUse; -}var ret = this.testMatch (n, pos, pt); -return ret; -} else { -return canUse; -}}, "~N,com.stevesoft.pat.Pthings"); -Clazz.overrideMethod (c$, "clone1", -function (h) { -try { -var m = new com.stevesoft.pat.Multi_stage2 (this.matchMin, this.matchMax, this.sub.clone (h)); -m.matchFewest = this.matchFewest; -return m; -} catch (rs) { -if (Clazz.exceptionOf (rs, com.stevesoft.pat.RegSyntax)) { -return null; -} else { -throw rs; -} -} -}, "java.util.Hashtable"); -}); +Clazz.declarePackage ("com.stevesoft.pat"); +Clazz.load (["com.stevesoft.pat.PatternSub"], "com.stevesoft.pat.Multi_stage2", ["com.stevesoft.pat.RegSyntaxError", "$.patInt"], function () { +c$ = Clazz.decorateAsClass (function () { +this.nextRet = null; +this.count = null; +this.matchMin = null; +this.matchMax = null; +this.matchFewest = false; +this.pos_old = -1; +Clazz.instantialize (this, arguments); +}, com.stevesoft.pat, "Multi_stage2", com.stevesoft.pat.PatternSub); +Clazz.defineMethod (c$, "toString", +function () { +var ret = ""; +ret += this.sub.toString (); +ret += "{" + this.matchMin + "," + this.matchMax + "}"; +if (this.matchFewest) { +ret += "?"; +}ret += this.parent.nextString (); +return ret; +}); +Clazz.makeConstructor (c$, +function (a, b, p) { +Clazz.superConstructor (this, com.stevesoft.pat.Multi_stage2, []); +if (p == null) { +com.stevesoft.pat.RegSyntaxError.endItAll ("Multiple match of Null pattern requested."); +}this.sub = p; +this.nextRet = this; +this.sub.setParent (this); +this.matchMin = a; +this.matchMax = b; +this.count = new com.stevesoft.pat.patInt (0); +if (!a.lessEq (b)) { +com.stevesoft.pat.RegSyntaxError.endItAll ("Bad Multi Args: " + a + ">" + b); +}var i = new com.stevesoft.pat.patInt (-1); +if (a.lessEq (i)) { +com.stevesoft.pat.RegSyntaxError.endItAll ("Bad Multi Args: " + a + "< 0"); +}}, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt,com.stevesoft.pat.Pattern"); +Clazz.defineMethod (c$, "getNext", +function () { +return this.nextRet; +}); +Clazz.overrideMethod (c$, "matchInternal", +function (pos, pt) { +this.sub.setParent (this); +var canUse = -1; +if (this.pos_old >= 0 && pos == this.pos_old) { +return -1; +}this.pos_old = pos; +if (this.matchMin.lessEq (this.count)) { +canUse = pos; +}if (!this.count.lessEq (this.matchMax) || pos > pt.src.length ()) { +return -1; +}if ((this.matchFewest || this.count.equals (this.matchMax)) && canUse >= 0) { +var n = Clazz.superCall (this, com.stevesoft.pat.Multi_stage2, "getNext", []); +if (n == null) { +return canUse; +}var ret = this.testMatch (n, pos, pt); +if (ret >= 0) { +return ret; +} else { +canUse = -1; +}}this.count.inc (); +try { +if (this.count.lessEq (this.matchMax)) { +var r = this.testMatch (this.sub, pos, pt); +if (r >= 0) { +return r; +}}} finally { +this.count.dec (); +} +if (!this.matchFewest && canUse >= 0) { +var n = Clazz.superCall (this, com.stevesoft.pat.Multi_stage2, "getNext", []); +if (n == null) { +return canUse; +}var ret = this.testMatch (n, pos, pt); +return ret; +} else { +return canUse; +}}, "~N,com.stevesoft.pat.Pthings"); +Clazz.overrideMethod (c$, "clone1", +function (h) { +try { +var m = new com.stevesoft.pat.Multi_stage2 (this.matchMin, this.matchMax, this.sub.clone (h)); +m.matchFewest = this.matchFewest; +return m; +} catch (rs) { +if (Clazz.exceptionOf (rs, com.stevesoft.pat.RegSyntax)) { +return null; +} else { +throw rs; +} +} +}, "java.util.Hashtable"); +});