JAL-1807 test
[jalviewjs.git] / bin / com / stevesoft / pat / Regex.js
1 Clazz.declarePackage ("com.stevesoft.pat");
2 Clazz.load (["com.stevesoft.pat.RegRes", "$.UniValidator", "jalview.jsdev.api.RegExpInterface", "com.stevesoft.pat.NoPattern", "$.Pthings", "$.patInt", "java.util.Hashtable"], ["com.stevesoft.pat.UnicodeW", "$.UnicodeCurrency", "$.UnicodeAlpha", "$.UnicodeUpper", "$.NUnicodeCurrency", "$.NUnicodeW", "$.NUnicodeAlpha", "$.UnicodeMath", "$.UnicodeWhite", "$.UnicodeDigit", "$.NUnicodeMath", "$.Regex", "$.NUnicodeDigit", "$.NUnicodeWhite", "$.NUnicodePunct", "$.UnicodePunct", "$.UnicodeLower"], ["com.stevesoft.pat.Any", "$.BackG", "$.BackMatch", "$.Backup", "$.Boundary", "$.Bracket", "$.CaseMgr", "$.Ctrl", "$.Custom", "$.CustomEndpoint", "$.DotMulti", "$.End", "$.FastMulti", "$.Group", "$.MessageManager", "$.Multi", "$.NullPattern", "$.Or", "$.OrMark", "$.Prop", "$.Range", "$.RegOpt", "$.RegSyntax", "$.RegSyntaxError", "$.ReplaceRule", "$.Replacer", "$.Rthings", "$.Skip", "$.Skipped", "$.Start", "$.StrPos", "$.lookAhead", "$.oneChar", "$.parsePerl", "$.patInf", "com.stevesoft.pat.wrap.StringWrap", "java.lang.NullPointerException", "$.StringBuffer", "java.util.BitSet"], function () {
3 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodePunct", com.stevesoft.pat.UniValidator);
4 Clazz.overrideMethod (c$, "validate", 
5 function (s, from, to) {
6 return from < s.length () && com.stevesoft.pat.Prop.isPunct (s.charAt (from)) ? to : -1;
7 }, "com.stevesoft.pat.StringLike,~N,~N");
8 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeWhite", com.stevesoft.pat.UniValidator);
9 Clazz.overrideMethod (c$, "validate", 
10 function (s, from, to) {
11 return from < s.length () && com.stevesoft.pat.Prop.isWhite (s.charAt (from)) ? to : -1;
12 }, "com.stevesoft.pat.StringLike,~N,~N");
13 c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodePunct", com.stevesoft.pat.UniValidator);
14 Clazz.overrideMethod (c$, "validate", 
15 function (s, from, to) {
16 return from < s.length () && !com.stevesoft.pat.Prop.isPunct (s.charAt (from)) ? to : -1;
17 }, "com.stevesoft.pat.StringLike,~N,~N");
18 c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeWhite", com.stevesoft.pat.UniValidator);
19 Clazz.overrideMethod (c$, "validate", 
20 function (s, from, to) {
21 return from < s.length () && !com.stevesoft.pat.Prop.isWhite (s.charAt (from)) ? to : -1;
22 }, "com.stevesoft.pat.StringLike,~N,~N");
23 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeW", com.stevesoft.pat.UniValidator);
24 Clazz.overrideMethod (c$, "validate", 
25 function (s, from, to) {
26 if (from >= s.length ()) {
27 return -1;
28 }var c = s.charAt (from);
29 return (com.stevesoft.pat.Prop.isAlphabetic (c) || com.stevesoft.pat.Prop.isDecimalDigit (c) || c == '_') ? to : -1;
30 }, "com.stevesoft.pat.StringLike,~N,~N");
31 c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeW", com.stevesoft.pat.UniValidator);
32 Clazz.overrideMethod (c$, "validate", 
33 function (s, from, to) {
34 if (from >= s.length ()) {
35 return -1;
36 }var c = s.charAt (from);
37 return !(com.stevesoft.pat.Prop.isAlphabetic (c) || com.stevesoft.pat.Prop.isDecimalDigit (c) || c == '_') ? to : -1;
38 }, "com.stevesoft.pat.StringLike,~N,~N");
39 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeDigit", com.stevesoft.pat.UniValidator);
40 Clazz.overrideMethod (c$, "validate", 
41 function (s, from, to) {
42 return from < s.length () && com.stevesoft.pat.Prop.isDecimalDigit (s.charAt (from)) ? to : -1;
43 }, "com.stevesoft.pat.StringLike,~N,~N");
44 c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeDigit", com.stevesoft.pat.UniValidator);
45 Clazz.overrideMethod (c$, "validate", 
46 function (s, from, to) {
47 return from < s.length () && !com.stevesoft.pat.Prop.isDecimalDigit (s.charAt (from)) ? to : -1;
48 }, "com.stevesoft.pat.StringLike,~N,~N");
49 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeMath", com.stevesoft.pat.UniValidator);
50 Clazz.overrideMethod (c$, "validate", 
51 function (s, from, to) {
52 return from < s.length () && com.stevesoft.pat.Prop.isMath (s.charAt (from)) ? to : -1;
53 }, "com.stevesoft.pat.StringLike,~N,~N");
54 c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeMath", com.stevesoft.pat.UniValidator);
55 Clazz.overrideMethod (c$, "validate", 
56 function (s, from, to) {
57 return from < s.length () && !com.stevesoft.pat.Prop.isMath (s.charAt (from)) ? to : -1;
58 }, "com.stevesoft.pat.StringLike,~N,~N");
59 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeCurrency", com.stevesoft.pat.UniValidator);
60 Clazz.overrideMethod (c$, "validate", 
61 function (s, from, to) {
62 return from < s.length () && com.stevesoft.pat.Prop.isCurrency (s.charAt (from)) ? to : -1;
63 }, "com.stevesoft.pat.StringLike,~N,~N");
64 c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeCurrency", com.stevesoft.pat.UniValidator);
65 Clazz.overrideMethod (c$, "validate", 
66 function (s, from, to) {
67 return from < s.length () && !com.stevesoft.pat.Prop.isCurrency (s.charAt (from)) ? to : -1;
68 }, "com.stevesoft.pat.StringLike,~N,~N");
69 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeAlpha", com.stevesoft.pat.UniValidator);
70 Clazz.overrideMethod (c$, "validate", 
71 function (s, from, to) {
72 return from < s.length () && com.stevesoft.pat.Prop.isAlphabetic (s.charAt (from)) ? to : -1;
73 }, "com.stevesoft.pat.StringLike,~N,~N");
74 c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeAlpha", com.stevesoft.pat.UniValidator);
75 Clazz.overrideMethod (c$, "validate", 
76 function (s, from, to) {
77 return from < s.length () && !com.stevesoft.pat.Prop.isAlphabetic (s.charAt (from)) ? to : -1;
78 }, "com.stevesoft.pat.StringLike,~N,~N");
79 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeUpper", com.stevesoft.pat.UniValidator);
80 Clazz.overrideMethod (c$, "validate", 
81 function (s, from, to) {
82 return from < s.length () && this.isUpper (s.charAt (from)) ? to : -1;
83 }, "com.stevesoft.pat.StringLike,~N,~N");
84 Clazz.defineMethod (c$, "isUpper", 
85 function (c) {
86 return c == com.stevesoft.pat.CaseMgr.toUpperCaseC (c) && c != com.stevesoft.pat.CaseMgr.toLowerCaseC (c);
87 }, "~S");
88 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeLower", com.stevesoft.pat.UniValidator);
89 Clazz.overrideMethod (c$, "validate", 
90 function (s, from, to) {
91 return from < s.length () && this.isLower (s.charAt (from)) ? to : -1;
92 }, "com.stevesoft.pat.StringLike,~N,~N");
93 Clazz.defineMethod (c$, "isLower", 
94 function (c) {
95 return c != com.stevesoft.pat.CaseMgr.toUpperCaseC (c) && c == com.stevesoft.pat.CaseMgr.toLowerCaseC (c);
96 }, "~S");
97 c$ = Clazz.decorateAsClass (function () {
98 this.thePattern = null;
99 this.minMatch = null;
100 this.rep = null;
101 this.dontMatchInQuotes = false;
102 this.ignoreCase = false;
103 this.repr = null;
104 this.esc = '\\';
105 this.pt = null;
106 this.gFlags = null;
107 this.gFlagto = 0;
108 this.gFlag = false;
109 this.sFlag = false;
110 this.mFlag = false;
111 this.p = null;
112 this.or = null;
113 this.skipper = null;
114 Clazz.instantialize (this, arguments);
115 }, com.stevesoft.pat, "Regex", com.stevesoft.pat.RegRes, [jalview.jsdev.api.RegExpInterface, Cloneable]);
116 Clazz.prepareFields (c$, function () {
117 this.thePattern = com.stevesoft.pat.Regex.none;
118 this.minMatch =  new com.stevesoft.pat.patInt (0);
119 this.pt =  new com.stevesoft.pat.Pthings ();
120 });
121 Clazz.makeConstructor (c$, 
122 function (s, strRp) {
123 Clazz.superConstructor (this, com.stevesoft.pat.Regex, []);
124 try {
125 if (s != null) this.compile (s);
126 if (strRp.length > 0) this.rep = com.stevesoft.pat.ReplaceRule.perlCode (strRp);
127 } catch (rs) {
128 if (Clazz.exceptionOf (rs, com.stevesoft.pat.RegSyntax)) {
129 } else {
130 throw rs;
131 }
132 }
133 }, "~S,~S");
134 Clazz.overrideMethod (c$, "clone", 
135 function () {
136 return  new com.stevesoft.pat.Regex (null, "").cloneFrom (this);
137 });
138 Clazz.defineMethod (c$, "cloneFrom", 
139 function (r) {
140 this.copyOutOf (r);
141 this.dontMatchInQuotes = r.dontMatchInQuotes;
142 this.esc = r.esc;
143 this.ignoreCase = r.ignoreCase;
144 this.gFlag = r.gFlag;
145 if (r.rep == null) {
146 this.rep = null;
147 } else {
148 this.rep = r.rep.clone ();
149 }this.thePattern = r.thePattern.clone ( new java.util.Hashtable ());
150 this.minMatch = r.minMatch;
151 this.skipper = r.skipper;
152 return this;
153 }, "com.stevesoft.pat.Regex");
154 Clazz.defineMethod (c$, "setDontMatchInQuotes", 
155 function (b) {
156 this.dontMatchInQuotes = b;
157 }, "~B");
158 Clazz.defineMethod (c$, "getDontMatchInQuotes", 
159 function () {
160 return this.dontMatchInQuotes;
161 });
162 Clazz.overrideMethod (c$, "setIgnoreCase", 
163 function (b) {
164 this.ignoreCase = b;
165 }, "~B");
166 Clazz.defineMethod (c$, "getIgnoreCase", 
167 function () {
168 return this.ignoreCase;
169 });
170 c$.setDefaultMFlag = Clazz.defineMethod (c$, "setDefaultMFlag", 
171 function (mFlag) {
172 com.stevesoft.pat.Regex.defaultMFlag = mFlag;
173 }, "~B");
174 c$.getDefaultMFlag = Clazz.defineMethod (c$, "getDefaultMFlag", 
175 function () {
176 return com.stevesoft.pat.Regex.defaultMFlag;
177 });
178 Clazz.defineMethod (c$, "setReplaceRuleStr", 
179 function (rp) {
180 this.rep = com.stevesoft.pat.ReplaceRule.perlCode (rp);
181 this.repr = null;
182 }, "~S");
183 Clazz.defineMethod (c$, "setReplaceRule", 
184 function (rp) {
185 this.rep = rp;
186 }, "com.stevesoft.pat.ReplaceRule");
187 c$.isDefined = Clazz.defineMethod (c$, "isDefined", 
188 function (nm) {
189 return com.stevesoft.pat.Regex.validators.get (nm) != null;
190 }, "~S");
191 c$.undefine = Clazz.defineMethod (c$, "undefine", 
192 function (nm) {
193 com.stevesoft.pat.Regex.validators.remove (nm);
194 }, "~S");
195 c$.defineV = Clazz.defineMethod (c$, "defineV", 
196 function (nm, pat, v) {
197 v.pattern = pat;
198 com.stevesoft.pat.Regex.validators.put (nm, v);
199 }, "~S,~S,com.stevesoft.pat.Validator");
200 c$.define = Clazz.defineMethod (c$, "define", 
201 function (nm, pat) {
202 com.stevesoft.pat.Regex.validators.put (nm, pat);
203 }, "~S,~S");
204 Clazz.defineMethod (c$, "getReplaceRule", 
205 function () {
206 return this.rep;
207 });
208 Clazz.defineMethod (c$, "_getReplacer", 
209 function () {
210 return this.repr == null ? this.repr =  new com.stevesoft.pat.Replacer () : this.repr;
211 });
212 Clazz.defineMethod (c$, "getReplacer", 
213 function () {
214 if (this.repr == null) {
215 this.repr =  new com.stevesoft.pat.Replacer ();
216 }this.repr.rh.me = this;
217 this.repr.rh.prev = null;
218 return this.repr;
219 });
220 Clazz.defineMethod (c$, "replaceFirst", 
221 function (s) {
222 return this._getReplacer ().replaceFirstRegion (s, this, 0, s.length).toString ();
223 }, "~S");
224 Clazz.defineMethod (c$, "replaceFirstFrom", 
225 function (s, pos) {
226 return this._getReplacer ().replaceFirstRegion (s, this, pos, s.length).toString ();
227 }, "~S,~N");
228 Clazz.defineMethod (c$, "replaceFirstRegion", 
229 function (s, start, end) {
230 return this._getReplacer ().replaceFirstRegion (s, this, start, end).toString ();
231 }, "~S,~N,~N");
232 Clazz.overrideMethod (c$, "replaceAll", 
233 function (s) {
234 return this._getReplacer ().replaceAllRegion (s, this, 0, s.length).toString ();
235 }, "~S");
236 Clazz.defineMethod (c$, "replaceAllLike", 
237 function (s) {
238 return this._getReplacer ().replaceAllRegion (s, this, 0, s.length ());
239 }, "com.stevesoft.pat.StringLike");
240 Clazz.defineMethod (c$, "replaceAllFrom", 
241 function (s, pos) {
242 return this._getReplacer ().replaceAllRegion (s, this, pos, s.length).toString ();
243 }, "~S,~N");
244 Clazz.defineMethod (c$, "replaceAllRegion", 
245 function (s, start, end) {
246 return this._getReplacer ().replaceAllRegion (s, this, start, end).toString ();
247 }, "~S,~N,~N");
248 Clazz.defineMethod (c$, "compile", 
249 function (prepat) {
250 var postpat = com.stevesoft.pat.parsePerl.codify (prepat, true);
251 var pat = postpat == null ? prepat : postpat;
252 this.minMatch = null;
253 this.ignoreCase = false;
254 this.dontMatchInQuotes = false;
255 var mk =  new com.stevesoft.pat.Rthings (this);
256 var offset = mk.val;
257 var newpat = pat;
258 this.thePattern = com.stevesoft.pat.Regex.none;
259 this.p = null;
260 this.or = null;
261 this.minMatch =  new com.stevesoft.pat.patInt (0);
262 var sp =  new com.stevesoft.pat.StrPos (pat, 0);
263 if (sp.incMatch ("(?e=")) {
264 var newEsc = sp.c;
265 sp.inc ();
266 if (sp.match (')')) {
267 newpat = com.stevesoft.pat.Regex.reEscape (pat.substring (6), newEsc, '\\');
268 }} else if (this.esc != '\\') {
269 newpat = com.stevesoft.pat.Regex.reEscape (pat, this.esc, '\\');
270 }this.thePattern = this._compile (newpat, mk);
271 this.numSubs_ = mk.val - offset;
272 mk.set (this);
273 }, "~S");
274 Clazz.defineMethod (c$, "equals", 
275 function (o) {
276 if (Clazz.instanceOf (o, com.stevesoft.pat.Regex)) {
277 if (this.toString ().equals (o.toString ())) {
278 return Clazz.superCall (this, com.stevesoft.pat.Regex, "equals", [o]);
279 } else {
280 return false;
281 }} else {
282 return Clazz.superCall (this, com.stevesoft.pat.Regex, "equals", [o]);
283 }}, "~O");
284 Clazz.defineMethod (c$, "prep", 
285 function (s) {
286 this.pt.lastPos = this.matchedTo ();
287 if (this.pt.lastPos < 0) {
288 this.pt.lastPos = 0;
289 }if ((s == null ? null : s.unwrap ()) !== (this.src == null ? null : s.unwrap ())) {
290 this.pt.lastPos = 0;
291 }this.src = s;
292 this.pt.dotDoesntMatchCR = com.stevesoft.pat.Regex.dotDoesntMatchCR && (!this.sFlag);
293 this.pt.mFlag = ( new Boolean (this.mFlag | com.stevesoft.pat.Regex.defaultMFlag).valueOf ());
294 this.pt.ignoreCase = this.ignoreCase;
295 this.pt.no_check = false;
296 if (this.pt.marks != null) {
297 for (var i = 0; i < this.pt.marks.length; i++) {
298 this.pt.marks[i] = -1;
299 }
300 }this.pt.marks = null;
301 this.pt.nMarks = this.numSubs_;
302 this.pt.src = s;
303 if (this.dontMatchInQuotes) {
304 com.stevesoft.pat.Regex.setCbits (s, this.pt);
305 } else {
306 this.pt.cbits = null;
307 }return this.pt;
308 }, "com.stevesoft.pat.StringLike");
309 Clazz.defineMethod (c$, "matchAt", 
310 function (s, start_pos) {
311 return this._search (s, start_pos, start_pos);
312 }, "~S,~N");
313 Clazz.defineMethod (c$, "matchAtLike", 
314 function (s, start_pos) {
315 return this._searchLike (s, start_pos, start_pos);
316 }, "com.stevesoft.pat.StringLike,~N");
317 Clazz.overrideMethod (c$, "search", 
318 function (s) {
319 if (s == null) {
320 throw  new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_given_to_regex_search"));
321 }return this._search (s, 0, s.length);
322 }, "~S");
323 Clazz.defineMethod (c$, "searchLike", 
324 function (sl) {
325 if (sl == null) {
326 throw  new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search"));
327 }return this._searchLike (sl, 0, sl.length ());
328 }, "com.stevesoft.pat.StringLike");
329 Clazz.defineMethod (c$, "reverseSearch", 
330 function (s) {
331 if (s == null) {
332 throw  new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_given_to_regex_reverse_search"));
333 }return this._reverseSearch (s, 0, s.length);
334 }, "~S");
335 Clazz.defineMethod (c$, "reverseSearchLike", 
336 function (sl) {
337 if (sl == null) {
338 throw  new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_reverse_search"));
339 }return this._reverseSearchLike (sl, 0, sl.length ());
340 }, "com.stevesoft.pat.StringLike");
341 Clazz.overrideMethod (c$, "searchFrom", 
342 function (s, start) {
343 if (s == null) {
344 throw  new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search_from"));
345 }return this._search (s, start, s.length);
346 }, "~S,~N");
347 Clazz.defineMethod (c$, "searchFromLike", 
348 function (s, start) {
349 if (s == null) {
350 throw  new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search_from"));
351 }return this._searchLike (s, start, s.length ());
352 }, "com.stevesoft.pat.StringLike,~N");
353 Clazz.defineMethod (c$, "searchRegion", 
354 function (s, start, end) {
355 if (s == null) {
356 throw  new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search_region"));
357 }return this._search (s, start, end);
358 }, "~S,~N,~N");
359 Clazz.defineMethod (c$, "setGFlag", 
360 function (b) {
361 this.gFlag = b;
362 }, "~B");
363 Clazz.defineMethod (c$, "getGFlag", 
364 function () {
365 return this.gFlag;
366 });
367 Clazz.defineMethod (c$, "getSFlag", 
368 function () {
369 return this.sFlag;
370 });
371 Clazz.defineMethod (c$, "getMFlag", 
372 function () {
373 return this.mFlag;
374 });
375 Clazz.defineMethod (c$, "_search", 
376 function (s, start, end) {
377 return this._searchLike ( new com.stevesoft.pat.wrap.StringWrap (s), start, end);
378 }, "~S,~N,~N");
379 Clazz.defineMethod (c$, "_searchLike", 
380 function (s, start, end) {
381 if (this.gFlag && this.gFlagto > 0 && this.gFlags != null && s.unwrap () === this.gFlags.unwrap ()) {
382 start = this.gFlagto;
383 }this.gFlags = null;
384 var pt = this.prep (s);
385 var up = (this.minMatch == null ? end : end - this.minMatch.i);
386 if (up < start && end >= start) {
387 up = start;
388 }if (this.skipper == null) {
389 for (var i = start; i <= up; i++) {
390 this.charsMatched_ = this.thePattern.matchAt (s, i, pt);
391 if (this.charsMatched_ >= 0) {
392 this.matchFrom_ = this.thePattern.mfrom;
393 this.marks = pt.marks;
394 this.gFlagto = this.matchFrom_ + this.charsMatched_;
395 this.gFlags = s;
396 return this.didMatch_ = true;
397 }}
398 } else {
399 pt.no_check = true;
400 for (var i = start; i <= up; i++) {
401 i = this.skipper.find (this.src, i, up);
402 if (i < 0) {
403 this.charsMatched_ = this.matchFrom_ = -1;
404 return this.didMatch_ = false;
405 }this.charsMatched_ = this.thePattern.matchAt (s, i, pt);
406 if (this.charsMatched_ >= 0) {
407 this.matchFrom_ = this.thePattern.mfrom;
408 this.marks = pt.marks;
409 this.gFlagto = this.matchFrom_ + this.charsMatched_;
410 this.gFlags = s;
411 return this.didMatch_ = true;
412 }}
413 }return this.didMatch_ = false;
414 }, "com.stevesoft.pat.StringLike,~N,~N");
415 Clazz.defineMethod (c$, "_reverseSearch", 
416 function (s, start, end) {
417 return this._reverseSearchLike ( new com.stevesoft.pat.wrap.StringWrap (s), start, end);
418 }, "~S,~N,~N");
419 Clazz.defineMethod (c$, "_reverseSearchLike", 
420 function (s, start, end) {
421 if (this.gFlag && this.gFlagto > 0 && s.unwrap () === this.gFlags.unwrap ()) {
422 end = this.gFlagto;
423 }this.gFlags = null;
424 var pt = this.prep (s);
425 for (var i = end; i >= start; i--) {
426 this.charsMatched_ = this.thePattern.matchAt (s, i, pt);
427 if (this.charsMatched_ >= 0) {
428 this.matchFrom_ = this.thePattern.mfrom;
429 this.marks = pt.marks;
430 this.gFlagto = this.matchFrom_ - 1;
431 this.gFlags = s;
432 return this.didMatch_ = true;
433 }}
434 return this.didMatch_ = false;
435 }, "com.stevesoft.pat.StringLike,~N,~N");
436 c$.setCbits = Clazz.defineMethod (c$, "setCbits", 
437 function (s, pt) {
438 if (s === com.stevesoft.pat.Regex.lasts) {
439 pt.cbits = com.stevesoft.pat.Regex.lastbs;
440 return;
441 }var bs =  new java.util.BitSet (s.length ());
442 var qc = ' ';
443 var setBit = false;
444 for (var i = 0; i < s.length (); i++) {
445 if (setBit) {
446 bs.set (i);
447 }var c = s.charAt (i);
448 if (!setBit && c == '"') {
449 qc = c;
450 setBit = true;
451 bs.set (i);
452 } else if (!setBit && c == '\'') {
453 qc = c;
454 setBit = true;
455 bs.set (i);
456 } else if (setBit && c == qc) {
457 setBit = false;
458 } else if (setBit && c == '\\' && i + 1 < s.length ()) {
459 i++;
460 if (setBit) {
461 bs.set (i);
462 }}}
463 pt.cbits = com.stevesoft.pat.Regex.lastbs = bs;
464 com.stevesoft.pat.Regex.lasts = s;
465 }, "com.stevesoft.pat.StringLike,com.stevesoft.pat.Pthings");
466 Clazz.defineMethod (c$, "add", 
467 function (p2) {
468 if (this.p == null) {
469 this.p = p2;
470 } else {
471 this.p.add (p2);
472 p2 = this.p;
473 }}, "com.stevesoft.pat.Pattern");
474 Clazz.defineMethod (c$, "compileSP", 
475 function (sp, mk) {
476 if (sp.match ('[')) {
477 sp.inc ();
478 this.add (this.matchBracket (sp));
479 } else if (sp.match ('|')) {
480 if (this.or == null) {
481 this.or =  new com.stevesoft.pat.Or ();
482 }if (this.p == null) {
483 this.p =  new com.stevesoft.pat.NullPattern ();
484 }this.or.addOr (this.p);
485 this.p = null;
486 } else if (sp.incMatch ("(?<")) {
487 var i = sp.getPatInt ();
488 if (i == null) {
489 com.stevesoft.pat.RegSyntaxError.endItAll ("No int after (?<");
490 }this.add ( new com.stevesoft.pat.Backup (i.intValue ()));
491 if (!sp.match (')')) {
492 com.stevesoft.pat.RegSyntaxError.endItAll ("No ) after (?<");
493 }} else if (sp.incMatch ("(?>")) {
494 var i = sp.getPatInt ();
495 if (i == null) {
496 com.stevesoft.pat.RegSyntaxError.endItAll ("No int after (?>");
497 }this.add ( new com.stevesoft.pat.Backup (-i.intValue ()));
498 if (!sp.match (')')) {
499 com.stevesoft.pat.RegSyntaxError.endItAll ("No ) after (?<");
500 }} else if (sp.incMatch ("(?@")) {
501 var op = sp.c;
502 sp.inc ();
503 var cl = sp.c;
504 sp.inc ();
505 if (!sp.match (')')) {
506 com.stevesoft.pat.RegSyntaxError.endItAll ("(?@ does not have closing paren");
507 }this.add ( new com.stevesoft.pat.Group (op, cl));
508 } else if (sp.incMatch ("(?#")) {
509 while (!sp.match (')')) {
510 sp.inc ();
511 }
512 } else if (sp.dontMatch && sp.c == 'w') {
513 var b =  new com.stevesoft.pat.Bracket (false);
514 b.addOr ( new com.stevesoft.pat.Range ('a', 'z'));
515 b.addOr ( new com.stevesoft.pat.Range ('A', 'Z'));
516 b.addOr ( new com.stevesoft.pat.Range ('0', '9'));
517 b.addOr ( new com.stevesoft.pat.oneChar ('_'));
518 this.add (b);
519 } else if (sp.dontMatch && sp.c == 'G') {
520 this.add ( new com.stevesoft.pat.BackG ());
521 } else if (sp.dontMatch && sp.c == 's') {
522 var b =  new com.stevesoft.pat.Bracket (false);
523 b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (32)));
524 b.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (8), String.fromCharCode (10)));
525 b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (13)));
526 this.add (b);
527 } else if (sp.dontMatch && sp.c == 'd') {
528 var digit =  new com.stevesoft.pat.Range ('0', '9');
529 digit.printBrackets = true;
530 this.add (digit);
531 } else if (sp.dontMatch && sp.c == 'W') {
532 var b =  new com.stevesoft.pat.Bracket (true);
533 b.addOr ( new com.stevesoft.pat.Range ('a', 'z'));
534 b.addOr ( new com.stevesoft.pat.Range ('A', 'Z'));
535 b.addOr ( new com.stevesoft.pat.Range ('0', '9'));
536 b.addOr ( new com.stevesoft.pat.oneChar ('_'));
537 this.add (b);
538 } else if (sp.dontMatch && sp.c == 'S') {
539 var b =  new com.stevesoft.pat.Bracket (true);
540 b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (32)));
541 b.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (8), String.fromCharCode (10)));
542 b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (13)));
543 this.add (b);
544 } else if (sp.dontMatch && sp.c == 'D') {
545 var b =  new com.stevesoft.pat.Bracket (true);
546 b.addOr ( new com.stevesoft.pat.Range ('0', '9'));
547 this.add (b);
548 } else if (sp.dontMatch && sp.c == 'B') {
549 var r =  new com.stevesoft.pat.Regex (null, "");
550 r._compile ("(?!\\b)", mk);
551 this.add (r.thePattern);
552 } else if (this.isOctalString (sp)) {
553 var d = sp.c.charCodeAt (0) - 48;
554 sp.inc ();
555 d = 8 * d + sp.c.charCodeAt (0) - 48;
556 var sp2 =  new com.stevesoft.pat.StrPos (sp);
557 sp2.inc ();
558 if (this.isOctalDigit (sp2, false)) {
559 sp.inc ();
560 d = 8 * d + sp.c.charCodeAt (0) - 48;
561 }this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (d)));
562 } else if (sp.dontMatch && sp.c >= '1' && sp.c <= '9') {
563 var iv = sp.c.charCodeAt (0) - 48;
564 var s2 =  new com.stevesoft.pat.StrPos (sp);
565 s2.inc ();
566 if (!s2.dontMatch && s2.c >= '0' && s2.c <= '9') {
567 iv = 10 * iv + (s2.c.charCodeAt (0) - 48);
568 sp.inc ();
569 }this.add ( new com.stevesoft.pat.BackMatch (iv));
570 } else if (sp.dontMatch && sp.c == 'b') {
571 this.add ( new com.stevesoft.pat.Boundary ());
572 } else if (sp.match ('\b')) {
573 this.add ( new com.stevesoft.pat.Boundary ());
574 } else if (sp.match ('$')) {
575 this.add ( new com.stevesoft.pat.End (true));
576 } else if (sp.dontMatch && sp.c == 'Z') {
577 this.add ( new com.stevesoft.pat.End (false));
578 } else if (sp.match ('.')) {
579 this.add ( new com.stevesoft.pat.Any ());
580 } else if (sp.incMatch ("(??")) {
581 var sb =  new StringBuffer ();
582 var sb2 =  new StringBuffer ();
583 while (!sp.match (')') && !sp.match (':')) {
584 sb.append (sp.c);
585 sp.inc ();
586 }
587 if (sp.incMatch (":")) {
588 while (!sp.match (')')) {
589 sb2.append (sp.c);
590 sp.inc ();
591 }
592 }var sbs = sb.toString ();
593 if (Clazz.instanceOf (com.stevesoft.pat.Regex.validators.get (sbs), String)) {
594 var pat = com.stevesoft.pat.Regex.validators.get (sbs);
595 var r =  new com.stevesoft.pat.Regex (null, "");
596 var rth =  new com.stevesoft.pat.Rthings (this);
597 rth.noBackRefs = true;
598 r._compile (pat, rth);
599 this.add (r.thePattern);
600 } else {
601 var cm =  new com.stevesoft.pat.Custom (sb.toString ());
602 if (cm.v != null) {
603 var v2 = cm.v.arg (sb2.toString ());
604 if (v2 != null) {
605 v2.argsave = sb2.toString ();
606 var p = cm.v.pattern;
607 cm.v = v2;
608 v2.pattern = p;
609 }var r =  new com.stevesoft.pat.Regex (null, "");
610 var rth =  new com.stevesoft.pat.Rthings (this);
611 rth.noBackRefs = true;
612 r._compile (cm.v.pattern, rth);
613 cm.sub = r.thePattern;
614 cm.sub.add ( new com.stevesoft.pat.CustomEndpoint (cm));
615 cm.sub.setParent (cm);
616 this.add (cm);
617 }}} else if (sp.match ('(')) {
618 mk.parenLevel++;
619 var r =  new com.stevesoft.pat.Regex (null, "");
620 sp.inc ();
621 if (sp.incMatch ("?:")) {
622 r.or =  new com.stevesoft.pat.Or ();
623 } else if (sp.incMatch ("?=")) {
624 r.or =  new com.stevesoft.pat.lookAhead (false);
625 } else if (sp.incMatch ("?!")) {
626 r.or =  new com.stevesoft.pat.lookAhead (true);
627 } else if (sp.match ('?')) {
628 sp.inc ();
629 do {
630 if (sp.c == 'i') {
631 mk.ignoreCase = true;
632 }if (sp.c == 'Q') {
633 mk.dontMatchInQuotes = true;
634 }if (sp.c == 'o') {
635 mk.optimizeMe = true;
636 }if (sp.c == 'g') {
637 mk.gFlag = true;
638 }if (sp.c == 's') {
639 mk.sFlag = true;
640 }if (sp.c == 'm') {
641 mk.mFlag = true;
642 }sp.inc ();
643 } while (!sp.match (')') && !sp.$eos);
644 r = null;
645 mk.parenLevel--;
646 if (sp.$eos) {
647 com.stevesoft.pat.RegSyntaxError.endItAll ("Unclosed ()");
648 }} else {
649 r.or = mk.noBackRefs ?  new com.stevesoft.pat.Or () :  new com.stevesoft.pat.OrMark (mk.val++);
650 }if (r != null) {
651 this.add (r._compileSP (sp, mk));
652 }} else if (sp.match ('^')) {
653 this.add ( new com.stevesoft.pat.Start (true));
654 } else if (sp.dontMatch && sp.c == 'A') {
655 this.add ( new com.stevesoft.pat.Start (false));
656 } else if (sp.match ('*')) {
657 this.addMulti ( new com.stevesoft.pat.patInt (0),  new com.stevesoft.pat.patInf ());
658 } else if (sp.match ('+')) {
659 this.addMulti ( new com.stevesoft.pat.patInt (1),  new com.stevesoft.pat.patInf ());
660 } else if (sp.match ('?')) {
661 this.addMulti ( new com.stevesoft.pat.patInt (0),  new com.stevesoft.pat.patInt (1));
662 } else if (sp.match ('{')) {
663 var bad = false;
664 var sp2 =  new com.stevesoft.pat.StrPos (sp);
665 sp.inc ();
666 var i1 = sp.getPatInt ();
667 var i2 = null;
668 if (sp.match ('}')) {
669 i2 = i1;
670 } else {
671 if (!sp.match (',')) {
672 bad = true;
673 }sp.inc ();
674 if (sp.match ('}')) {
675 i2 =  new com.stevesoft.pat.patInf ();
676 } else {
677 i2 = sp.getPatInt ();
678 }}if (i1 == null || i2 == null) {
679 bad = true;
680 }if (bad) {
681 sp.dup (sp2);
682 this.add ( new com.stevesoft.pat.oneChar (sp.c));
683 } else {
684 this.addMulti (i1, i2);
685 }} else if (sp.escMatch ('x') && this.next2Hex (sp)) {
686 sp.inc ();
687 var d = this.getHexDigit (sp);
688 sp.inc ();
689 d = 16 * d + this.getHexDigit (sp);
690 this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (d)));
691 } else if (sp.escMatch ('c')) {
692 sp.inc ();
693 if (sp.c.charCodeAt (0) < com.stevesoft.pat.Ctrl.cmap.length) {
694 this.add ( new com.stevesoft.pat.oneChar (com.stevesoft.pat.Ctrl.cmap[sp.c.charCodeAt (0)]));
695 } else {
696 this.add ( new com.stevesoft.pat.oneChar (sp.c));
697 }} else if (sp.escMatch ('f')) {
698 this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (12)));
699 } else if (sp.escMatch ('a')) {
700 this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (7)));
701 } else if (sp.escMatch ('t')) {
702 this.add ( new com.stevesoft.pat.oneChar ('\t'));
703 } else if (sp.escMatch ('n')) {
704 this.add ( new com.stevesoft.pat.oneChar ('\n'));
705 } else if (sp.escMatch ('r')) {
706 this.add ( new com.stevesoft.pat.oneChar ('\r'));
707 } else if (sp.escMatch ('b')) {
708 this.add ( new com.stevesoft.pat.oneChar ('\b'));
709 } else if (sp.escMatch ('e')) {
710 this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (27)));
711 } else {
712 this.add ( new com.stevesoft.pat.oneChar (sp.c));
713 if (sp.match (')')) {
714 com.stevesoft.pat.RegSyntaxError.endItAll ("Unmatched right paren in pattern");
715 }}}, "com.stevesoft.pat.StrPos,com.stevesoft.pat.Rthings");
716 Clazz.defineMethod (c$, "_compile", 
717 ($fz = function (pat, mk) {
718 this.minMatch = null;
719 this.sFlag = this.mFlag = this.ignoreCase = this.gFlag = false;
720 var sp =  new com.stevesoft.pat.StrPos (pat, 0);
721 this.thePattern = this._compileSP (sp, mk);
722 this.pt.marks = null;
723 return this.thePattern;
724 }, $fz.isPrivate = true, $fz), "~S,com.stevesoft.pat.Rthings");
725 Clazz.defineMethod (c$, "_compileSP", 
726 function (sp, mk) {
727 while (!(sp.$eos || (this.or != null && sp.match (')')))) {
728 this.compileSP (sp, mk);
729 sp.inc ();
730 }
731 if (sp.match (')')) {
732 mk.parenLevel--;
733 } else if (sp.$eos && mk.parenLevel != 0) {
734 com.stevesoft.pat.RegSyntaxError.endItAll ("Unclosed Parenthesis! lvl=" + mk.parenLevel);
735 }if (this.or != null) {
736 if (this.p == null) {
737 this.p =  new com.stevesoft.pat.NullPattern ();
738 }this.or.addOr (this.p);
739 return this.or;
740 }return this.p == null ?  new com.stevesoft.pat.NullPattern () : this.p;
741 }, "com.stevesoft.pat.StrPos,com.stevesoft.pat.Rthings");
742 Clazz.defineMethod (c$, "addMulti", 
743 function (i1, i2) {
744 var last;
745 var last2;
746 for (last = this.p; last != null && last.next != null; last = last.next) {
747 ;}
748 if (last == null || last === this.p) {
749 last2 = null;
750 } else {
751 for (last2 = this.p; last2.next !== last; last2 = last2.next) {
752 ;}
753 }if (Clazz.instanceOf (last, com.stevesoft.pat.Multi) && i1.intValue () == 0 && i2.intValue () == 1) {
754 (last).matchFewest = true;
755 } else if (Clazz.instanceOf (last, com.stevesoft.pat.FastMulti) && i1.intValue () == 0 && i2.intValue () == 1) {
756 (last).matchFewest = true;
757 } else if (Clazz.instanceOf (last, com.stevesoft.pat.DotMulti) && i1.intValue () == 0 && i2.intValue () == 1) {
758 (last).matchFewest = true;
759 } else if (Clazz.instanceOf (last, com.stevesoft.pat.Multi) || Clazz.instanceOf (last, com.stevesoft.pat.DotMulti) || Clazz.instanceOf (last, com.stevesoft.pat.FastMulti)) {
760 throw  new com.stevesoft.pat.RegSyntax ("Syntax error.");
761 } else if (last2 == null) {
762 this.p = com.stevesoft.pat.Regex.mkMulti (i1, i2, this.p);
763 } else {
764 last2.next = com.stevesoft.pat.Regex.mkMulti (i1, i2, last);
765 }}, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt");
766 c$.mkMulti = Clazz.defineMethod (c$, "mkMulti", 
767 function (lo, hi, p) {
768 if (Clazz.instanceOf (p, com.stevesoft.pat.Any) && p.next == null) {
769 return  new com.stevesoft.pat.DotMulti (lo, hi);
770 }return com.stevesoft.pat.RegOpt.safe4fm (p) ?  new com.stevesoft.pat.FastMulti (lo, hi, p) :  new com.stevesoft.pat.Multi (lo, hi, p);
771 }, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt,com.stevesoft.pat.Pattern");
772 Clazz.defineMethod (c$, "matchBracket", 
773 function (sp) {
774 var ret;
775 if (sp.match ('^')) {
776 ret =  new com.stevesoft.pat.Bracket (true);
777 sp.inc ();
778 } else {
779 ret =  new com.stevesoft.pat.Bracket (false);
780 }if (sp.match (']')) {
781 com.stevesoft.pat.RegSyntaxError.endItAll ("Unmatched []");
782 }while (!sp.$eos && !sp.match (']')) {
783 var s1 =  new com.stevesoft.pat.StrPos (sp);
784 s1.inc ();
785 var s1_ =  new com.stevesoft.pat.StrPos (s1);
786 s1_.inc ();
787 if (s1.match ('-') && !s1_.match (']')) {
788 var s2 =  new com.stevesoft.pat.StrPos (s1);
789 s2.inc ();
790 if (!s2.$eos) {
791 ret.addOr ( new com.stevesoft.pat.Range (sp.c, s2.c));
792 }sp.inc ();
793 sp.inc ();
794 } else if (sp.escMatch ('Q')) {
795 sp.inc ();
796 while (!sp.escMatch ('E')) {
797 ret.addOr ( new com.stevesoft.pat.oneChar (sp.c));
798 sp.inc ();
799 }
800 } else if (sp.escMatch ('d')) {
801 ret.addOr ( new com.stevesoft.pat.Range ('0', '9'));
802 } else if (sp.escMatch ('s')) {
803 ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (32)));
804 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (8), String.fromCharCode (10)));
805 ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (13)));
806 } else if (sp.escMatch ('w')) {
807 ret.addOr ( new com.stevesoft.pat.Range ('a', 'z'));
808 ret.addOr ( new com.stevesoft.pat.Range ('A', 'Z'));
809 ret.addOr ( new com.stevesoft.pat.Range ('0', '9'));
810 ret.addOr ( new com.stevesoft.pat.oneChar ('_'));
811 } else if (sp.escMatch ('D')) {
812 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (0), String.fromCharCode (47)));
813 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (58), String.fromCharCode (65535)));
814 } else if (sp.escMatch ('S')) {
815 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (0), String.fromCharCode (7)));
816 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (11), String.fromCharCode (12)));
817 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (14), String.fromCharCode (31)));
818 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (33), String.fromCharCode (65535)));
819 } else if (sp.escMatch ('W')) {
820 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (0), String.fromCharCode (64)));
821 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (91), String.fromCharCode (94)));
822 ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (96)));
823 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (123), String.fromCharCode (65535)));
824 } else if (sp.escMatch ('x') && this.next2Hex (sp)) {
825 sp.inc ();
826 var d = this.getHexDigit (sp);
827 sp.inc ();
828 d = 16 * d + this.getHexDigit (sp);
829 ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (d)));
830 } else if (sp.escMatch ('a')) {
831 ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (7)));
832 } else if (sp.escMatch ('f')) {
833 ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (12)));
834 } else if (sp.escMatch ('e')) {
835 ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (27)));
836 } else if (sp.escMatch ('n')) {
837 ret.addOr ( new com.stevesoft.pat.oneChar ('\n'));
838 } else if (sp.escMatch ('t')) {
839 ret.addOr ( new com.stevesoft.pat.oneChar ('\t'));
840 } else if (sp.escMatch ('r')) {
841 ret.addOr ( new com.stevesoft.pat.oneChar ('\r'));
842 } else if (sp.escMatch ('c')) {
843 sp.inc ();
844 if (sp.c.charCodeAt (0) < com.stevesoft.pat.Ctrl.cmap.length) {
845 ret.addOr ( new com.stevesoft.pat.oneChar (com.stevesoft.pat.Ctrl.cmap[sp.c.charCodeAt (0)]));
846 } else {
847 ret.addOr ( new com.stevesoft.pat.oneChar (sp.c));
848 }} else if (this.isOctalString (sp)) {
849 var d = sp.c.charCodeAt (0) - 48;
850 sp.inc ();
851 d = 8 * d + sp.c.charCodeAt (0) - 48;
852 var sp2 =  new com.stevesoft.pat.StrPos (sp);
853 sp2.inc ();
854 if (this.isOctalDigit (sp2, false)) {
855 sp.inc ();
856 d = 8 * d + sp.c.charCodeAt (0) - 48;
857 }ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (d)));
858 } else {
859 ret.addOr ( new com.stevesoft.pat.oneChar (sp.c));
860 }sp.inc ();
861 }
862 return ret;
863 }, "com.stevesoft.pat.StrPos");
864 Clazz.overrideMethod (c$, "toString", 
865 function () {
866 {
867 var sb =  new StringBuffer ();
868 if (this.esc != '\\') {
869 sb.append ("(?e=");
870 sb.append (this.esc);
871 sb.append (")");
872 }if (this.gFlag || this.mFlag || !com.stevesoft.pat.Regex.dotDoesntMatchCR || this.sFlag || this.ignoreCase || this.dontMatchInQuotes || this.optimized ()) {
873 sb.append ("(?");
874 if (this.ignoreCase) {
875 sb.append ("i");
876 }if (this.mFlag) {
877 sb.append ("m");
878 }if (this.sFlag || !com.stevesoft.pat.Regex.dotDoesntMatchCR) {
879 sb.append ("s");
880 }if (this.dontMatchInQuotes) {
881 sb.append ("Q");
882 }if (this.optimized ()) {
883 sb.append ("o");
884 }if (this.gFlag) {
885 sb.append ("g");
886 }sb.append (")");
887 }var patstr = this.thePattern.toString ();
888 if (this.esc != '\\') {
889 patstr = com.stevesoft.pat.Regex.reEscape (patstr, '\\', this.esc);
890 }sb.append (patstr);
891 return sb.toString ();
892 }});
893 c$.reEscape = Clazz.defineMethod (c$, "reEscape", 
894 function (s, oldEsc, newEsc) {
895 if (oldEsc == newEsc) {
896 return s;
897 }var i;
898 var sb =  new StringBuffer ();
899 for (i = 0; i < s.length; i++) {
900 if (s.charAt (i) == oldEsc && i + 1 < s.length) {
901 if (s.charAt (i + 1) == oldEsc) {
902 sb.append (oldEsc);
903 } else {
904 sb.append (newEsc);
905 sb.append (s.charAt (i + 1));
906 }i++;
907 } else if (s.charAt (i) == newEsc) {
908 sb.append (newEsc);
909 sb.append (newEsc);
910 } else {
911 sb.append (s.charAt (i));
912 }}
913 return sb.toString ();
914 }, "~S,~S,~S");
915 Clazz.defineMethod (c$, "accept", 
916 function (dir, s) {
917 return this.search (s);
918 }, "java.io.File,~S");
919 c$.version = Clazz.defineMethod (c$, "version", 
920 function () {
921 return "lgpl release 1.5.3";
922 });
923 Clazz.defineMethod (c$, "optimize", 
924 function () {
925 if (this.optimized () || this.thePattern == null) {
926 return;
927 }this.minMatch =  new com.stevesoft.pat.patInt (0);
928 this.thePattern = com.stevesoft.pat.RegOpt.opt (this.thePattern, this.ignoreCase, this.dontMatchInQuotes);
929 this.skipper = com.stevesoft.pat.Skip.findSkipRegex (this);
930 return;
931 });
932 Clazz.defineMethod (c$, "optimized", 
933 function () {
934 return this.minMatch != null;
935 });
936 c$.perlCode = Clazz.defineMethod (c$, "perlCode", 
937 function (s) {
938 return com.stevesoft.pat.parsePerl.parse (s);
939 }, "~S");
940 Clazz.defineMethod (c$, "isLiteral", 
941 function () {
942 var x = this.thePattern;
943 while (x != null) {
944 if (Clazz.instanceOf (x, com.stevesoft.pat.oneChar)) {
945 ;} else if (Clazz.instanceOf (x, com.stevesoft.pat.Skipped)) {
946 ;} else {
947 return false;
948 }x = x.next;
949 }
950 return true;
951 });
952 Clazz.defineMethod (c$, "countMinChars", 
953 function () {
954 return this.thePattern.countMinChars ();
955 });
956 Clazz.defineMethod (c$, "countMaxChars", 
957 function () {
958 return this.thePattern.countMaxChars ();
959 });
960 Clazz.defineMethod (c$, "isHexDigit", 
961 function (sp) {
962 var r = !sp.$eos && !sp.dontMatch && ((sp.c >= '0' && sp.c <= '9') || (sp.c >= 'a' && sp.c <= 'f') || (sp.c >= 'A' && sp.c <= 'F'));
963 return r;
964 }, "com.stevesoft.pat.StrPos");
965 Clazz.defineMethod (c$, "isOctalDigit", 
966 function (sp, first) {
967 var r = !sp.$eos && !( new Boolean (first ^ sp.dontMatch).valueOf ()) && sp.c >= '0' && sp.c <= '7';
968 return r;
969 }, "com.stevesoft.pat.StrPos,~B");
970 Clazz.defineMethod (c$, "getHexDigit", 
971 function (sp) {
972 if (sp.c >= '0' && sp.c <= '9') {
973 return sp.c.charCodeAt (0) - 48;
974 }if (sp.c >= 'a' && sp.c <= 'f') {
975 return sp.c.charCodeAt (0) - 97 + 10;
976 }return sp.c.charCodeAt (0) - 65 + 10;
977 }, "com.stevesoft.pat.StrPos");
978 Clazz.defineMethod (c$, "next2Hex", 
979 function (sp) {
980 var sp2 =  new com.stevesoft.pat.StrPos (sp);
981 sp2.inc ();
982 if (!this.isHexDigit (sp2)) {
983 return false;
984 }sp2.inc ();
985 if (!this.isHexDigit (sp2)) {
986 return false;
987 }return true;
988 }, "com.stevesoft.pat.StrPos");
989 Clazz.defineMethod (c$, "isOctalString", 
990 function (sp) {
991 if (!this.isOctalDigit (sp, true)) {
992 return false;
993 }var sp2 =  new com.stevesoft.pat.StrPos (sp);
994 sp2.inc ();
995 if (!this.isOctalDigit (sp2, false)) {
996 return false;
997 }return true;
998 }, "com.stevesoft.pat.StrPos");
999 Clazz.defineStatics (c$,
1000 "BackRefOffset", 1);
1001 c$.none = c$.prototype.none =  new com.stevesoft.pat.NoPattern ();
1002 c$.validators = c$.prototype.validators =  new java.util.Hashtable ();
1003 {
1004 com.stevesoft.pat.Regex.defineV ("p", "(?>1)",  new com.stevesoft.pat.UnicodePunct ());
1005 com.stevesoft.pat.Regex.defineV ("P", "(?>1)",  new com.stevesoft.pat.NUnicodePunct ());
1006 com.stevesoft.pat.Regex.defineV ("s", "(?>1)",  new com.stevesoft.pat.UnicodeWhite ());
1007 com.stevesoft.pat.Regex.defineV ("S", "(?>1)",  new com.stevesoft.pat.NUnicodeWhite ());
1008 com.stevesoft.pat.Regex.defineV ("w", "(?>1)",  new com.stevesoft.pat.UnicodeW ());
1009 com.stevesoft.pat.Regex.defineV ("W", "(?>1)",  new com.stevesoft.pat.NUnicodeW ());
1010 com.stevesoft.pat.Regex.defineV ("d", "(?>1)",  new com.stevesoft.pat.UnicodeDigit ());
1011 com.stevesoft.pat.Regex.defineV ("D", "(?>1)",  new com.stevesoft.pat.NUnicodeDigit ());
1012 com.stevesoft.pat.Regex.defineV ("m", "(?>1)",  new com.stevesoft.pat.UnicodeMath ());
1013 com.stevesoft.pat.Regex.defineV ("M", "(?>1)",  new com.stevesoft.pat.NUnicodeMath ());
1014 com.stevesoft.pat.Regex.defineV ("c", "(?>1)",  new com.stevesoft.pat.UnicodeCurrency ());
1015 com.stevesoft.pat.Regex.defineV ("C", "(?>1)",  new com.stevesoft.pat.NUnicodeCurrency ());
1016 com.stevesoft.pat.Regex.defineV ("a", "(?>1)",  new com.stevesoft.pat.UnicodeAlpha ());
1017 com.stevesoft.pat.Regex.defineV ("A", "(?>1)",  new com.stevesoft.pat.NUnicodeAlpha ());
1018 com.stevesoft.pat.Regex.defineV ("uc", "(?>1)",  new com.stevesoft.pat.UnicodeUpper ());
1019 com.stevesoft.pat.Regex.defineV ("lc", "(?>1)",  new com.stevesoft.pat.UnicodeLower ());
1020 }Clazz.defineStatics (c$,
1021 "defaultMFlag", false,
1022 "dotDoesntMatchCR", true,
1023 "lasts", null,
1024 "lastbs", null,
1025 "back_slash", '\\');
1026 });