JAL-1807 still testing
[jalviewjs.git] / bin / com / stevesoft / pat / FastMulti.js
index 16ffec1..898aa9e 100644 (file)
-Clazz.declarePackage ("com.stevesoft.pat");
-Clazz.load (["com.stevesoft.pat.PatternSub"], "com.stevesoft.pat.FastMulti", ["com.stevesoft.pat.RegSyntaxError", "$.patInt"], function () {
-c$ = Clazz.decorateAsClass (function () {
-this.fewestMatches = null;
-this.mostMatches = null;
-this.matchFewest = false;
-this.step = -1;
-Clazz.instantialize (this, arguments);
-}, com.stevesoft.pat, "FastMulti", com.stevesoft.pat.PatternSub);
-Clazz.overrideMethod (c$, "minChars", 
-function () {
-return this.sub.countMinChars ().mul (this.fewestMatches);
-});
-Clazz.overrideMethod (c$, "maxChars", 
-function () {
-return this.sub.countMaxChars ().mul (this.mostMatches);
-});
-Clazz.makeConstructor (c$, 
-function (a, b, p) {
-Clazz.superConstructor (this, com.stevesoft.pat.FastMulti, []);
-if (p == null) {
-com.stevesoft.pat.RegSyntaxError.endItAll ("Null length pattern followed by *, +, or other Multi.");
-}this.fewestMatches = a;
-this.mostMatches = b;
-this.sub = p;
-this.step = p.countMinChars ().intValue ();
-this.sub.setParent (null);
-}, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt,com.stevesoft.pat.Pattern");
-Clazz.defineMethod (c$, "toString", 
-function () {
-return this.sub.toString () + "{" + this.fewestMatches + "," + this.mostMatches + "}" + (this.matchFewest ? "?" : "") + "(?# <= fast multi)" + this.nextString ();
-});
-Clazz.defineMethod (c$, "matchInternal", 
-function (pos, pt) {
-var m = -1;
-var i = pos;
-var endstr = pt.src.length () - this.step;
-var matches =  new com.stevesoft.pat.patInt (0);
-if (this.matchFewest) {
-if (this.fewestMatches.lessEq (matches)) {
-var ii = this.nextMatch (i, pt);
-if (ii >= 0) {
-return ii;
-}}while (i >= 0 && i <= endstr) {
-i = this.sub.matchInternal (i, pt);
-if (i >= 0) {
-matches.inc ();
-if (this.fewestMatches.lessEq (matches)) {
-var ii = this.nextMatch (i, pt);
-if (ii >= 0) {
-return ii;
-}}if (matches.equals (this.mostMatches)) {
-return -1;
-}}}
-return -1;
-}var nMatches = 0;
-while (this.fewestMatches.intValue () > nMatches) {
-i = this.sub.matchInternal (i, pt);
-if (i >= 0) {
-nMatches++;
-} else {
-return -1;
-}}
-m = i;
-if (this.mostMatches.finite ()) {
-while (nMatches < this.mostMatches.intValue ()) {
-i = this.sub.matchInternal (i, pt);
-if (i >= 0) {
-m = i;
-nMatches++;
-} else {
-break;
-}}
-} else {
-while (true) {
-i = this.sub.matchInternal (i, pt);
-if (i >= 0) {
-m = i;
-nMatches++;
-} else {
-break;
-}}
-}while (m >= pos) {
-var r = this.nextMatch (m, pt);
-if (r >= 0) {
-return r;
-}m -= this.step;
-nMatches--;
-if (nMatches < this.fewestMatches.intValue ()) {
-return -1;
-}}
-return -1;
-}, "~N,com.stevesoft.pat.Pthings");
-Clazz.overrideMethod (c$, "clone1", 
-function (h) {
-try {
-var fm =  new com.stevesoft.pat.FastMulti (this.fewestMatches, this.mostMatches, this.sub.clone (h));
-fm.matchFewest = this.matchFewest;
-return fm;
-} catch (rs) {
-if (Clazz.exceptionOf (rs, com.stevesoft.pat.RegSyntax)) {
-return null;
-} else {
-throw rs;
-}
-}
-}, "java.util.Hashtable");
-});
+Clazz.declarePackage ("com.stevesoft.pat");\r
+Clazz.load (["com.stevesoft.pat.PatternSub"], "com.stevesoft.pat.FastMulti", ["com.stevesoft.pat.RegSyntaxError", "$.patInt"], function () {\r
+c$ = Clazz.decorateAsClass (function () {\r
+this.fewestMatches = null;\r
+this.mostMatches = null;\r
+this.matchFewest = false;\r
+this.step = -1;\r
+Clazz.instantialize (this, arguments);\r
+}, com.stevesoft.pat, "FastMulti", com.stevesoft.pat.PatternSub);\r
+Clazz.overrideMethod (c$, "minChars", \r
+function () {\r
+return this.sub.countMinChars ().mul (this.fewestMatches);\r
+});\r
+Clazz.overrideMethod (c$, "maxChars", \r
+function () {\r
+return this.sub.countMaxChars ().mul (this.mostMatches);\r
+});\r
+Clazz.makeConstructor (c$, \r
+function (a, b, p) {\r
+Clazz.superConstructor (this, com.stevesoft.pat.FastMulti, []);\r
+if (p == null) {\r
+com.stevesoft.pat.RegSyntaxError.endItAll ("Null length pattern followed by *, +, or other Multi.");\r
+}this.fewestMatches = a;\r
+this.mostMatches = b;\r
+this.sub = p;\r
+this.step = p.countMinChars ().intValue ();\r
+this.sub.setParent (null);\r
+}, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt,com.stevesoft.pat.Pattern");\r
+Clazz.defineMethod (c$, "toString", \r
+function () {\r
+return this.sub.toString () + "{" + this.fewestMatches + "," + this.mostMatches + "}" + (this.matchFewest ? "?" : "") + "(?# <= fast multi)" + this.nextString ();\r
+});\r
+Clazz.defineMethod (c$, "matchInternal", \r
+function (pos, pt) {\r
+var m = -1;\r
+var i = pos;\r
+var endstr = pt.src.length () - this.step;\r
+var matches =  new com.stevesoft.pat.patInt (0);\r
+if (this.matchFewest) {\r
+if (this.fewestMatches.lessEq (matches)) {\r
+var ii = this.nextMatch (i, pt);\r
+if (ii >= 0) {\r
+return ii;\r
+}}while (i >= 0 && i <= endstr) {\r
+i = this.sub.matchInternal (i, pt);\r
+if (i >= 0) {\r
+matches.inc ();\r
+if (this.fewestMatches.lessEq (matches)) {\r
+var ii = this.nextMatch (i, pt);\r
+if (ii >= 0) {\r
+return ii;\r
+}}if (matches.equals (this.mostMatches)) {\r
+return -1;\r
+}}}\r
+return -1;\r
+}var nMatches = 0;\r
+while (this.fewestMatches.intValue () > nMatches) {\r
+i = this.sub.matchInternal (i, pt);\r
+if (i >= 0) {\r
+nMatches++;\r
+} else {\r
+return -1;\r
+}}\r
+m = i;\r
+if (this.mostMatches.finite ()) {\r
+while (nMatches < this.mostMatches.intValue ()) {\r
+i = this.sub.matchInternal (i, pt);\r
+if (i >= 0) {\r
+m = i;\r
+nMatches++;\r
+} else {\r
+break;\r
+}}\r
+} else {\r
+while (true) {\r
+i = this.sub.matchInternal (i, pt);\r
+if (i >= 0) {\r
+m = i;\r
+nMatches++;\r
+} else {\r
+break;\r
+}}\r
+}while (m >= pos) {\r
+var r = this.nextMatch (m, pt);\r
+if (r >= 0) {\r
+return r;\r
+}m -= this.step;\r
+nMatches--;\r
+if (nMatches < this.fewestMatches.intValue ()) {\r
+return -1;\r
+}}\r
+return -1;\r
+}, "~N,com.stevesoft.pat.Pthings");\r
+Clazz.overrideMethod (c$, "clone1", \r
+function (h) {\r
+try {\r
+var fm =  new com.stevesoft.pat.FastMulti (this.fewestMatches, this.mostMatches, this.sub.clone (h));\r
+fm.matchFewest = this.matchFewest;\r
+return fm;\r
+} catch (rs) {\r
+if (Clazz.exceptionOf (rs, com.stevesoft.pat.RegSyntax)) {\r
+return null;\r
+} else {\r
+throw rs;\r
+}\r
+}\r
+}, "java.util.Hashtable");\r
+});\r