1 Clazz.declarePackage ("com.stevesoft.pat");
\r
2 Clazz.load (null, "com.stevesoft.pat.StrPos", ["com.stevesoft.pat.patInf", "$.patInt"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
8 this.dontMatch = false;
\r
10 Clazz.instantialize (this, arguments);
\r
11 }, com.stevesoft.pat, "StrPos");
\r
12 Clazz.defineMethod (c$, "pos",
\r
16 Clazz.defineMethod (c$, "thisChar",
\r
20 Clazz.defineMethod (c$, "eos",
\r
24 Clazz.makeConstructor (c$,
\r
27 }, "com.stevesoft.pat.StrPos");
\r
28 Clazz.defineMethod (c$, "dup",
\r
31 this.$pos = sp.$pos;
\r
33 this.dontMatch = sp.dontMatch;
\r
34 this.$eos = sp.$eos;
\r
35 }, "com.stevesoft.pat.StrPos");
\r
36 Clazz.makeConstructor (c$,
\r
39 this.$pos = pos - 1;
\r
42 Clazz.defineMethod (c$, "inc",
\r
45 if (this.$pos >= this.s.length) {
\r
49 this.c = this.s.charAt (this.$pos);
\r
50 if (this.c == this.esc && this.$pos + 1 < this.s.length) {
\r
52 this.c = this.s.charAt (this.$pos);
\r
53 if (this.c != this.esc) {
\r
54 this.dontMatch = true;
\r
56 this.dontMatch = false;
\r
58 this.dontMatch = false;
\r
61 Clazz.defineMethod (c$, "match",
\r
63 if (this.dontMatch || this.$eos) {
\r
65 }return this.c == ch;
\r
67 Clazz.defineMethod (c$, "escMatch",
\r
69 if (!this.dontMatch || this.$eos) {
\r
71 }return this.c == ch;
\r
73 Clazz.defineMethod (c$, "escaped",
\r
75 return this.dontMatch;
\r
77 Clazz.defineMethod (c$, "incMatch",
\r
79 var sp = new com.stevesoft.pat.StrPos (this);
\r
81 for (i = 0; i < st.length; i++) {
\r
82 if (!sp.match (st.charAt (i))) {
\r
89 Clazz.defineMethod (c$, "getPatInt",
\r
91 if (this.incMatch ("inf")) {
\r
92 return new com.stevesoft.pat.patInf ();
\r
95 var sp = new com.stevesoft.pat.StrPos (this);
\r
96 for (i = 0; !sp.$eos && sp.c >= '0' && sp.c <= '9'; i++) {
\r
97 cnt = 10 * cnt + sp.c.charCodeAt (0) - 48;
\r
103 return new com.stevesoft.pat.patInt (cnt);
\r
105 Clazz.defineMethod (c$, "getString",
\r