JAL-1807 test
[jalviewjs.git] / bin / com / stevesoft / pat / Skip.js
index bdf02e4..6dd2756 100644 (file)
-Clazz.declarePackage ("com.stevesoft.pat");\r
-Clazz.load (null, "com.stevesoft.pat.Skip", ["com.stevesoft.pat.CaseMgr", "$.Or", "$.Skipped", "$.oneChar", "java.lang.StringBuffer"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.src = null;\r
-this.c = 0;\r
-this.mask = 0;\r
-this.$offset = 0;\r
-this.ign = false;\r
-this.m1 = false;\r
-Clazz.instantialize (this, arguments);\r
-}, com.stevesoft.pat, "Skip");\r
-c$.mkmask = Clazz.defineMethod (c$, "mkmask", \r
-function (c) {\r
-var x = String.fromCharCode (c);\r
-return ~((com.stevesoft.pat.CaseMgr.toUpperCaseC (x)).charCodeAt (0) | (com.stevesoft.pat.CaseMgr.toLowerCaseC (x)).charCodeAt (0) | (com.stevesoft.pat.CaseMgr.toTitleCaseC (x)).charCodeAt (0));\r
-}, "~N");\r
-c$.string = Clazz.defineMethod (c$, "string", \r
-function (r) {\r
-return r.skipper == null ? null : r.skipper.src;\r
-}, "com.stevesoft.pat.Regex");\r
-c$.offset = Clazz.defineMethod (c$, "offset", \r
-function (r) {\r
-return r.skipper == null ? -1 : r.skipper.$offset;\r
-}, "com.stevesoft.pat.Regex");\r
-Clazz.makeConstructor (c$, \r
-function (s, ign, o) {\r
-this.src = s;\r
-this.c = s.charCodeAt (0);\r
-if (ign) {\r
-this.mask = com.stevesoft.pat.Skip.mkmask (this.c);\r
-} else {\r
-this.mask = 0;\r
-}this.$offset = o;\r
-this.ign = ign;\r
-this.m1 = (s.length == 1);\r
-}, "~S,~B,~N");\r
-Clazz.defineMethod (c$, "find", \r
-function (s) {\r
-return this.find (s, 0, s.length ());\r
-}, "com.stevesoft.pat.StringLike");\r
-c$.min = Clazz.defineMethod (c$, "min", \r
-function (a, b) {\r
-return a < b ? a : b;\r
-}, "~N,~N");\r
-Clazz.defineMethod (c$, "find", \r
-function (s, start, end) {\r
-if (start > end) {\r
-return -1;\r
-}start += this.$offset;\r
-var vend = com.stevesoft.pat.Skip.min (s.length () - 1, end + this.$offset);\r
-if (this.mask != this.c) {\r
-for (var i = start; i <= vend; i++) {\r
-if (0 == (s.charCodeAt (i) & this.mask)) {\r
-if (this.m1 || com.stevesoft.pat.CaseMgr.regionMatchesLike2 (s, this.ign, i, this.src, 0, this.src.length)) {\r
-return i - this.$offset;\r
-}}}\r
-} else {\r
-for (var i = start; i <= vend; i++) {\r
-if (this.c == s.charCodeAt (i)) {\r
-if (this.m1 || com.stevesoft.pat.CaseMgr.regionMatchesLike2 (s, this.ign, i, this.src, 0, this.src.length)) {\r
-return i - this.$offset;\r
-}}}\r
-}return -1;\r
-}, "com.stevesoft.pat.StringLike,~N,~N");\r
-c$.findSkipRegex = Clazz.defineMethod (c$, "findSkipRegex", \r
-function (r) {\r
-return com.stevesoft.pat.Skip.findSkip (r.thePattern, r.ignoreCase, !r.dontMatchInQuotes);\r
-}, "com.stevesoft.pat.Regex");\r
-c$.findSkip = Clazz.defineMethod (c$, "findSkip", \r
-function (p, ignoreCase, trnc) {\r
-var sb =  new StringBuffer ();\r
-var subsk = null;\r
-var offset = 0;\r
-var skipc = -1;\r
-var skipoff = 0;\r
-for (; p != null; p = p.next) {\r
-if (Clazz.instanceOf (p, com.stevesoft.pat.oneChar)) {\r
-skipc = ((p).c).charCodeAt (0);\r
-skipoff = offset;\r
-}if (Clazz.instanceOf (p, com.stevesoft.pat.oneChar) && Clazz.instanceOf (p.next, com.stevesoft.pat.oneChar)) {\r
-var psav = p;\r
-sb.append ((p).c);\r
-while (Clazz.instanceOf (p.next, com.stevesoft.pat.oneChar)) {\r
-sb.append ((p.next).c);\r
-p = p.next;\r
-}\r
-var st = sb.toString ();\r
-var sk = null;\r
-if (st.length > 2) {\r
-sk =  new com.stevesoft.pat.SkipBMH (st, ignoreCase, offset);\r
-} else {\r
-sk =  new com.stevesoft.pat.Skip2 (st, ignoreCase, offset);\r
-}if (trnc && st.length > 2) {\r
-psav.next =  new com.stevesoft.pat.Skipped (st.substring (1));\r
-psav.next.next = p.next;\r
-psav.next.parent = p.parent;\r
-}return sk;\r
-} else if (Clazz.instanceOf (p, com.stevesoft.pat.Or) && (p).v.size () == 1 && !(p).leftForm ().equals ("(?!") && null != (subsk = com.stevesoft.pat.Skip.findSkip ((p).v.elementAt (0), ignoreCase, trnc))) {\r
-subsk.$offset += offset;\r
-return subsk;\r
-} else if (p.minChars ().equals (p.maxChars ())) {\r
-offset += p.minChars ().intValue ();\r
-} else {\r
-return skipc < 0 ? null :  new com.stevesoft.pat.Skip ("" + String.fromCharCode (skipc), ignoreCase, skipoff);\r
-}}\r
-return null;\r
-}, "com.stevesoft.pat.Pattern,~B,~B");\r
-});\r
+Clazz.declarePackage ("com.stevesoft.pat");
+Clazz.load (null, "com.stevesoft.pat.Skip", ["com.stevesoft.pat.CaseMgr", "$.Or", "$.Skipped", "$.oneChar", "java.lang.StringBuffer"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.src = null;
+this.c = 0;
+this.mask = 0;
+this.$offset = 0;
+this.ign = false;
+this.m1 = false;
+Clazz.instantialize (this, arguments);
+}, com.stevesoft.pat, "Skip");
+c$.mkmask = Clazz.defineMethod (c$, "mkmask", 
+function (c) {
+var x = String.fromCharCode (c);
+return ~((com.stevesoft.pat.CaseMgr.toUpperCaseC (x)).charCodeAt (0) | (com.stevesoft.pat.CaseMgr.toLowerCaseC (x)).charCodeAt (0) | (com.stevesoft.pat.CaseMgr.toTitleCaseC (x)).charCodeAt (0));
+}, "~N");
+c$.string = Clazz.defineMethod (c$, "string", 
+function (r) {
+return r.skipper == null ? null : r.skipper.src;
+}, "com.stevesoft.pat.Regex");
+c$.offset = Clazz.defineMethod (c$, "offset", 
+function (r) {
+return r.skipper == null ? -1 : r.skipper.$offset;
+}, "com.stevesoft.pat.Regex");
+Clazz.makeConstructor (c$, 
+function (s, ign, o) {
+this.src = s;
+this.c = s.charCodeAt (0);
+if (ign) {
+this.mask = com.stevesoft.pat.Skip.mkmask (this.c);
+} else {
+this.mask = 0;
+}this.$offset = o;
+this.ign = ign;
+this.m1 = (s.length == 1);
+}, "~S,~B,~N");
+Clazz.defineMethod (c$, "find", 
+function (s) {
+return this.find (s, 0, s.length ());
+}, "com.stevesoft.pat.StringLike");
+c$.min = Clazz.defineMethod (c$, "min", 
+function (a, b) {
+return a < b ? a : b;
+}, "~N,~N");
+Clazz.defineMethod (c$, "find", 
+function (s, start, end) {
+if (start > end) {
+return -1;
+}start += this.$offset;
+var vend = com.stevesoft.pat.Skip.min (s.length () - 1, end + this.$offset);
+if (this.mask != this.c) {
+for (var i = start; i <= vend; i++) {
+if (0 == (s.charCodeAt (i) & this.mask)) {
+if (this.m1 || com.stevesoft.pat.CaseMgr.regionMatchesLike2 (s, this.ign, i, this.src, 0, this.src.length)) {
+return i - this.$offset;
+}}}
+} else {
+for (var i = start; i <= vend; i++) {
+if (this.c == s.charCodeAt (i)) {
+if (this.m1 || com.stevesoft.pat.CaseMgr.regionMatchesLike2 (s, this.ign, i, this.src, 0, this.src.length)) {
+return i - this.$offset;
+}}}
+}return -1;
+}, "com.stevesoft.pat.StringLike,~N,~N");
+c$.findSkipRegex = Clazz.defineMethod (c$, "findSkipRegex", 
+function (r) {
+return com.stevesoft.pat.Skip.findSkip (r.thePattern, r.ignoreCase, !r.dontMatchInQuotes);
+}, "com.stevesoft.pat.Regex");
+c$.findSkip = Clazz.defineMethod (c$, "findSkip", 
+function (p, ignoreCase, trnc) {
+var sb =  new StringBuffer ();
+var subsk = null;
+var offset = 0;
+var skipc = -1;
+var skipoff = 0;
+for (; p != null; p = p.next) {
+if (Clazz.instanceOf (p, com.stevesoft.pat.oneChar)) {
+skipc = ((p).c).charCodeAt (0);
+skipoff = offset;
+}if (Clazz.instanceOf (p, com.stevesoft.pat.oneChar) && Clazz.instanceOf (p.next, com.stevesoft.pat.oneChar)) {
+var psav = p;
+sb.append ((p).c);
+while (Clazz.instanceOf (p.next, com.stevesoft.pat.oneChar)) {
+sb.append ((p.next).c);
+p = p.next;
+}
+var st = sb.toString ();
+var sk = null;
+if (st.length > 2) {
+sk =  new com.stevesoft.pat.SkipBMH (st, ignoreCase, offset);
+} else {
+sk =  new com.stevesoft.pat.Skip2 (st, ignoreCase, offset);
+}if (trnc && st.length > 2) {
+psav.next =  new com.stevesoft.pat.Skipped (st.substring (1));
+psav.next.next = p.next;
+psav.next.parent = p.parent;
+}return sk;
+} else if (Clazz.instanceOf (p, com.stevesoft.pat.Or) && (p).v.size () == 1 && !(p).leftForm ().equals ("(?!") && null != (subsk = com.stevesoft.pat.Skip.findSkip ((p).v.elementAt (0), ignoreCase, trnc))) {
+subsk.$offset += offset;
+return subsk;
+} else if (p.minChars ().equals (p.maxChars ())) {
+offset += p.minChars ().intValue ();
+} else {
+return skipc < 0 ? null :  new com.stevesoft.pat.Skip ("" + String.fromCharCode (skipc), ignoreCase, skipoff);
+}}
+return null;
+}, "com.stevesoft.pat.Pattern,~B,~B");
+});