JAL-1807 still testing
[jalviewjs.git] / bin / com / stevesoft / pat / RegexReader.js
index d767d80..301d8e7 100644 (file)
-Clazz.declarePackage ("com.stevesoft.pat");
-Clazz.load (["java.io.Reader", "com.stevesoft.pat.PartialBuffer", "$.RBuffer", "java.lang.StringBuffer"], "com.stevesoft.pat.RegexReader", ["com.stevesoft.pat.StringBufferLike", "com.stevesoft.pat.wrap.StringBufferWrap"], function () {
-c$ = Clazz.decorateAsClass (function () {
-this.rb = null;
-this.wrap = null;
-this.moreToRead = true;
-this.r = null;
-this.rp = null;
-this.nmax = 2048;
-this.max_lines = 2;
-this.EOLchar = '\n';
-Clazz.instantialize (this, arguments);
-}, com.stevesoft.pat, "RegexReader", java.io.Reader);
-Clazz.prepareFields (c$, function () {
-this.rb =  new com.stevesoft.pat.RBuffer ( new StringBuffer ());
-this.wrap =  new com.stevesoft.pat.PartialBuffer (this.rb.sb);
-});
-Clazz.makeConstructor (c$, 
-function (rex, r) {
-Clazz.superConstructor (this, com.stevesoft.pat.RegexReader, []);
-this.r = r;
-this.rp = rex.getReplacer ();
-}, "com.stevesoft.pat.Regex,java.io.Reader");
-Clazz.makeConstructor (c$, 
-function (tex, r) {
-Clazz.superConstructor (this, com.stevesoft.pat.RegexReader, []);
-this.r = r;
-this.rp = tex.getReplacer ();
-}, "com.stevesoft.pat.Transformer,java.io.Reader");
-Clazz.defineMethod (c$, "reset", 
-function () {
-this.r.reset ();
-this.rb =  new com.stevesoft.pat.RBuffer ( new StringBuffer ());
-this.wrap =  new com.stevesoft.pat.PartialBuffer (this.rb.sb);
-this.moreToRead = true;
-});
-Clazz.defineMethod (c$, "readData", 
-function () {
-var c;
-var n = 0;
-while ((c = this.r.read ()) != -1) {
-this.rb.sb.append (String.fromCharCode (c));
-if (n++ > this.nmax) {
-break;
-}}
-if (c == -1 && n == 0) {
-this.moreToRead = false;
-this.wrap.allowOverRun = false;
-}});
-Clazz.defineMethod (c$, "getMoreData", 
-function () {
-while (this.rb.pos >= this.rb.epos) {
-this.wrap.overRun = false;
-if (this.rb.next != null) {
-this.rb = this.rb.next;
-} else if (this.rb.done) {
-break;
-} else if (this.rb.epos >= this.rb.sb.length () && this.rb.epos > this.nmax) {
-this.rb.pos = 1;
-this.rb.epos = 1;
-this.rb.sb.setLength (1);
-this.readData ();
-} else if (this.rb.epos >= this.rb.sb.length () && this.moreToRead) {
-this.readData ();
-} else if (this.rp.getRegex ().matchAtLike (this.wrap, this.rb.epos)) {
-if (this.wrap.overRun) {
-this.readData ();
-} else {
-var sbw =  new com.stevesoft.pat.wrap.StringBufferWrap ();
-var sbl =  new com.stevesoft.pat.StringBufferLike (sbw);
-var rex = this.rp.getRegex ();
-var npos = rex.matchedTo ();
-this.rp.setBuffer (sbl);
-this.rp.setSource (this.wrap);
-this.rp.setPos (npos);
-this.rp.apply (rex, rex.getReplaceRule ());
-var opos = this.rb.epos;
-var rb2 =  new com.stevesoft.pat.RBuffer (sbw.unwrap ());
-rb2.epos = rb2.sb.length ();
-var rb3 =  new com.stevesoft.pat.RBuffer (this.rb.sb);
-this.rb.next = rb2;
-rb2.next = rb3;
-if (npos == opos) {
-rb3.epos = npos + 1;
-if (rb3.epos > rb3.sb.length ()) {
-if (this.rb.pos >= this.rb.epos) {
-this.rb = this.rb.next;
-}rb3.pos = rb3.epos = 0;
-rb3.done = true;
-}rb3.pos = npos;
-} else {
-rb3.pos = rb3.epos = npos;
-}}} else {
-if (this.wrap.overRun) {
-this.readData ();
-} else if (this.rb.epos < this.rb.sb.length ()) {
-this.rb.epos++;
-} else {
-break;
-}}}
-});
-Clazz.defineMethod (c$, "read", 
-function () {
-if (this.rb.pos >= this.rb.epos) {
-this.getMoreData ();
-if (this.rb.pos >= this.rb.epos) {
-return -1;
-}}return this.rb.sb.charAt (this.rb.pos++);
-});
-Clazz.defineMethod (c$, "read", 
-function (buf, off, len) {
-var c = -1;
-var end = off + len;
-for (var i = off; i < end; i++) {
-c = this.read ();
-if (c < 0) {
-if (i == off) {
-return -1;
-}return i - off;
-}buf[i] = String.fromCharCode (c);
-}
-return len;
-}, "~A,~N,~N");
-Clazz.defineMethod (c$, "close", 
-function () {
-this.r.close ();
-});
-Clazz.overrideMethod (c$, "markSupported", 
-function () {
-return false;
-});
-Clazz.defineMethod (c$, "getBufferSize", 
-function () {
-return this.nmax;
-});
-Clazz.defineMethod (c$, "setBufferSize", 
-function (n) {
-this.nmax = n;
-}, "~N");
-Clazz.defineMethod (c$, "getMaxLines", 
-function () {
-return this.max_lines;
-});
-Clazz.defineMethod (c$, "setMaxLines", 
-function (ml) {
-this.max_lines = ml;
-}, "~N");
-Clazz.defineMethod (c$, "getEOLchar", 
-function () {
-return this.EOLchar;
-});
-Clazz.defineMethod (c$, "setEOLchar", 
-function (c) {
-this.EOLchar = c;
-}, "~S");
-Clazz.overrideMethod (c$, "skip", 
-function (d) {
-var n = 0;
-while (n < d && this.read () != -1) {
-n++;
-}
-return n;
-}, "~N");
-});
+Clazz.declarePackage ("com.stevesoft.pat");\r
+Clazz.load (["java.io.Reader", "com.stevesoft.pat.PartialBuffer", "$.RBuffer", "java.lang.StringBuffer"], "com.stevesoft.pat.RegexReader", ["com.stevesoft.pat.StringBufferLike", "com.stevesoft.pat.wrap.StringBufferWrap"], function () {\r
+c$ = Clazz.decorateAsClass (function () {\r
+this.rb = null;\r
+this.wrap = null;\r
+this.moreToRead = true;\r
+this.r = null;\r
+this.rp = null;\r
+this.nmax = 2048;\r
+this.max_lines = 2;\r
+this.EOLchar = '\n';\r
+Clazz.instantialize (this, arguments);\r
+}, com.stevesoft.pat, "RegexReader", java.io.Reader);\r
+Clazz.prepareFields (c$, function () {\r
+this.rb =  new com.stevesoft.pat.RBuffer ( new StringBuffer ());\r
+this.wrap =  new com.stevesoft.pat.PartialBuffer (this.rb.sb);\r
+});\r
+Clazz.makeConstructor (c$, \r
+function (rex, r) {\r
+Clazz.superConstructor (this, com.stevesoft.pat.RegexReader, []);\r
+this.r = r;\r
+this.rp = rex.getReplacer ();\r
+}, "com.stevesoft.pat.Regex,java.io.Reader");\r
+Clazz.makeConstructor (c$, \r
+function (tex, r) {\r
+Clazz.superConstructor (this, com.stevesoft.pat.RegexReader, []);\r
+this.r = r;\r
+this.rp = tex.getReplacer ();\r
+}, "com.stevesoft.pat.Transformer,java.io.Reader");\r
+Clazz.defineMethod (c$, "reset", \r
+function () {\r
+this.r.reset ();\r
+this.rb =  new com.stevesoft.pat.RBuffer ( new StringBuffer ());\r
+this.wrap =  new com.stevesoft.pat.PartialBuffer (this.rb.sb);\r
+this.moreToRead = true;\r
+});\r
+Clazz.defineMethod (c$, "readData", \r
+function () {\r
+var c;\r
+var n = 0;\r
+while ((c = this.r.read ()) != -1) {\r
+this.rb.sb.append (String.fromCharCode (c));\r
+if (n++ > this.nmax) {\r
+break;\r
+}}\r
+if (c == -1 && n == 0) {\r
+this.moreToRead = false;\r
+this.wrap.allowOverRun = false;\r
+}});\r
+Clazz.defineMethod (c$, "getMoreData", \r
+function () {\r
+while (this.rb.pos >= this.rb.epos) {\r
+this.wrap.overRun = false;\r
+if (this.rb.next != null) {\r
+this.rb = this.rb.next;\r
+} else if (this.rb.done) {\r
+break;\r
+} else if (this.rb.epos >= this.rb.sb.length () && this.rb.epos > this.nmax) {\r
+this.rb.pos = 1;\r
+this.rb.epos = 1;\r
+this.rb.sb.setLength (1);\r
+this.readData ();\r
+} else if (this.rb.epos >= this.rb.sb.length () && this.moreToRead) {\r
+this.readData ();\r
+} else if (this.rp.getRegex ().matchAtLike (this.wrap, this.rb.epos)) {\r
+if (this.wrap.overRun) {\r
+this.readData ();\r
+} else {\r
+var sbw =  new com.stevesoft.pat.wrap.StringBufferWrap ();\r
+var sbl =  new com.stevesoft.pat.StringBufferLike (sbw);\r
+var rex = this.rp.getRegex ();\r
+var npos = rex.matchedTo ();\r
+this.rp.setBuffer (sbl);\r
+this.rp.setSource (this.wrap);\r
+this.rp.setPos (npos);\r
+this.rp.apply (rex, rex.getReplaceRule ());\r
+var opos = this.rb.epos;\r
+var rb2 =  new com.stevesoft.pat.RBuffer (sbw.unwrap ());\r
+rb2.epos = rb2.sb.length ();\r
+var rb3 =  new com.stevesoft.pat.RBuffer (this.rb.sb);\r
+this.rb.next = rb2;\r
+rb2.next = rb3;\r
+if (npos == opos) {\r
+rb3.epos = npos + 1;\r
+if (rb3.epos > rb3.sb.length ()) {\r
+if (this.rb.pos >= this.rb.epos) {\r
+this.rb = this.rb.next;\r
+}rb3.pos = rb3.epos = 0;\r
+rb3.done = true;\r
+}rb3.pos = npos;\r
+} else {\r
+rb3.pos = rb3.epos = npos;\r
+}}} else {\r
+if (this.wrap.overRun) {\r
+this.readData ();\r
+} else if (this.rb.epos < this.rb.sb.length ()) {\r
+this.rb.epos++;\r
+} else {\r
+break;\r
+}}}\r
+});\r
+Clazz.defineMethod (c$, "read", \r
+function () {\r
+if (this.rb.pos >= this.rb.epos) {\r
+this.getMoreData ();\r
+if (this.rb.pos >= this.rb.epos) {\r
+return -1;\r
+}}return this.rb.sb.charAt (this.rb.pos++);\r
+});\r
+Clazz.defineMethod (c$, "read", \r
+function (buf, off, len) {\r
+var c = -1;\r
+var end = off + len;\r
+for (var i = off; i < end; i++) {\r
+c = this.read ();\r
+if (c < 0) {\r
+if (i == off) {\r
+return -1;\r
+}return i - off;\r
+}buf[i] = String.fromCharCode (c);\r
+}\r
+return len;\r
+}, "~A,~N,~N");\r
+Clazz.defineMethod (c$, "close", \r
+function () {\r
+this.r.close ();\r
+});\r
+Clazz.overrideMethod (c$, "markSupported", \r
+function () {\r
+return false;\r
+});\r
+Clazz.defineMethod (c$, "getBufferSize", \r
+function () {\r
+return this.nmax;\r
+});\r
+Clazz.defineMethod (c$, "setBufferSize", \r
+function (n) {\r
+this.nmax = n;\r
+}, "~N");\r
+Clazz.defineMethod (c$, "getMaxLines", \r
+function () {\r
+return this.max_lines;\r
+});\r
+Clazz.defineMethod (c$, "setMaxLines", \r
+function (ml) {\r
+this.max_lines = ml;\r
+}, "~N");\r
+Clazz.defineMethod (c$, "getEOLchar", \r
+function () {\r
+return this.EOLchar;\r
+});\r
+Clazz.defineMethod (c$, "setEOLchar", \r
+function (c) {\r
+this.EOLchar = c;\r
+}, "~S");\r
+Clazz.overrideMethod (c$, "skip", \r
+function (d) {\r
+var n = 0;\r
+while (n < d && this.read () != -1) {\r
+n++;\r
+}\r
+return n;\r
+}, "~N");\r
+});\r