X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=bin%2Fcom%2Fstevesoft%2Fpat%2FStrPos.js;h=366f46bf4d98898085cf98cd4ae7a26fd983ef85;hp=fb1baf42b70e490aea49e8ecd356fea569c10afa;hb=7301a2415adab88038b291fc54caeeb3a5a47a44;hpb=6154cb57a6eac3bb1344b8342495f5bb701ee921 diff --git a/bin/com/stevesoft/pat/StrPos.js b/bin/com/stevesoft/pat/StrPos.js index fb1baf4..366f46b 100644 --- a/bin/com/stevesoft/pat/StrPos.js +++ b/bin/com/stevesoft/pat/StrPos.js @@ -1,109 +1,109 @@ -Clazz.declarePackage ("com.stevesoft.pat"); -Clazz.load (null, "com.stevesoft.pat.StrPos", ["com.stevesoft.pat.patInf", "$.patInt"], function () { -c$ = Clazz.decorateAsClass (function () { -this.s = null; -this.$pos = 0; -this.esc = '\\'; -this.c = '\0'; -this.dontMatch = false; -this.$eos = false; -Clazz.instantialize (this, arguments); -}, com.stevesoft.pat, "StrPos"); -Clazz.defineMethod (c$, "pos", -function () { -return this.$pos; -}); -Clazz.defineMethod (c$, "thisChar", -function () { -return this.c; -}); -Clazz.defineMethod (c$, "eos", -function () { -return this.$eos; -}); -Clazz.makeConstructor (c$, -function (sp) { -this.dup (sp); -}, "com.stevesoft.pat.StrPos"); -Clazz.defineMethod (c$, "dup", -function (sp) { -this.s = sp.s; -this.$pos = sp.$pos; -this.c = sp.c; -this.dontMatch = sp.dontMatch; -this.$eos = sp.$eos; -}, "com.stevesoft.pat.StrPos"); -Clazz.makeConstructor (c$, -function (s, pos) { -this.s = s; -this.$pos = pos - 1; -this.inc (); -}, "~S,~N"); -Clazz.defineMethod (c$, "inc", -function () { -this.$pos++; -if (this.$pos >= this.s.length) { -this.$eos = true; -return this; -}this.$eos = false; -this.c = this.s.charAt (this.$pos); -if (this.c == this.esc && this.$pos + 1 < this.s.length) { -this.$pos++; -this.c = this.s.charAt (this.$pos); -if (this.c != this.esc) { -this.dontMatch = true; -} else { -this.dontMatch = false; -}} else { -this.dontMatch = false; -}return this; -}); -Clazz.defineMethod (c$, "match", -function (ch) { -if (this.dontMatch || this.$eos) { -return false; -}return this.c == ch; -}, "~S"); -Clazz.defineMethod (c$, "escMatch", -function (ch) { -if (!this.dontMatch || this.$eos) { -return false; -}return this.c == ch; -}, "~S"); -Clazz.defineMethod (c$, "escaped", -function () { -return this.dontMatch; -}); -Clazz.defineMethod (c$, "incMatch", -function (st) { -var sp = new com.stevesoft.pat.StrPos (this); -var i; -for (i = 0; i < st.length; i++) { -if (!sp.match (st.charAt (i))) { -return false; -}sp.inc (); -} -this.dup (sp); -return true; -}, "~S"); -Clazz.defineMethod (c$, "getPatInt", -function () { -if (this.incMatch ("inf")) { -return new com.stevesoft.pat.patInf (); -}var i; -var cnt = 0; -var sp = new com.stevesoft.pat.StrPos (this); -for (i = 0; !sp.$eos && sp.c >= '0' && sp.c <= '9'; i++) { -cnt = 10 * cnt + sp.c.charCodeAt (0) - 48; -sp.inc (); -} -if (i == 0) { -return null; -}this.dup (sp); -return new com.stevesoft.pat.patInt (cnt); -}); -Clazz.defineMethod (c$, "getString", -function () { -return this.s; -}); -}); +Clazz.declarePackage ("com.stevesoft.pat"); +Clazz.load (null, "com.stevesoft.pat.StrPos", ["com.stevesoft.pat.patInf", "$.patInt"], function () { +c$ = Clazz.decorateAsClass (function () { +this.s = null; +this.$pos = 0; +this.esc = '\\'; +this.c = '\0'; +this.dontMatch = false; +this.$eos = false; +Clazz.instantialize (this, arguments); +}, com.stevesoft.pat, "StrPos"); +Clazz.defineMethod (c$, "pos", +function () { +return this.$pos; +}); +Clazz.defineMethod (c$, "thisChar", +function () { +return this.c; +}); +Clazz.defineMethod (c$, "eos", +function () { +return this.$eos; +}); +Clazz.makeConstructor (c$, +function (sp) { +this.dup (sp); +}, "com.stevesoft.pat.StrPos"); +Clazz.defineMethod (c$, "dup", +function (sp) { +this.s = sp.s; +this.$pos = sp.$pos; +this.c = sp.c; +this.dontMatch = sp.dontMatch; +this.$eos = sp.$eos; +}, "com.stevesoft.pat.StrPos"); +Clazz.makeConstructor (c$, +function (s, pos) { +this.s = s; +this.$pos = pos - 1; +this.inc (); +}, "~S,~N"); +Clazz.defineMethod (c$, "inc", +function () { +this.$pos++; +if (this.$pos >= this.s.length) { +this.$eos = true; +return this; +}this.$eos = false; +this.c = this.s.charAt (this.$pos); +if (this.c == this.esc && this.$pos + 1 < this.s.length) { +this.$pos++; +this.c = this.s.charAt (this.$pos); +if (this.c != this.esc) { +this.dontMatch = true; +} else { +this.dontMatch = false; +}} else { +this.dontMatch = false; +}return this; +}); +Clazz.defineMethod (c$, "match", +function (ch) { +if (this.dontMatch || this.$eos) { +return false; +}return this.c == ch; +}, "~S"); +Clazz.defineMethod (c$, "escMatch", +function (ch) { +if (!this.dontMatch || this.$eos) { +return false; +}return this.c == ch; +}, "~S"); +Clazz.defineMethod (c$, "escaped", +function () { +return this.dontMatch; +}); +Clazz.defineMethod (c$, "incMatch", +function (st) { +var sp = new com.stevesoft.pat.StrPos (this); +var i; +for (i = 0; i < st.length; i++) { +if (!sp.match (st.charAt (i))) { +return false; +}sp.inc (); +} +this.dup (sp); +return true; +}, "~S"); +Clazz.defineMethod (c$, "getPatInt", +function () { +if (this.incMatch ("inf")) { +return new com.stevesoft.pat.patInf (); +}var i; +var cnt = 0; +var sp = new com.stevesoft.pat.StrPos (this); +for (i = 0; !sp.$eos && sp.c >= '0' && sp.c <= '9'; i++) { +cnt = 10 * cnt + sp.c.charCodeAt (0) - 48; +sp.inc (); +} +if (i == 0) { +return null; +}this.dup (sp); +return new com.stevesoft.pat.patInt (cnt); +}); +Clazz.defineMethod (c$, "getString", +function () { +return this.s; +}); +});