1 Clazz.declarePackage ("com.stevesoft.pat");
\r
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 () {
\r
3 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodePunct", com.stevesoft.pat.UniValidator);
\r
4 Clazz.overrideMethod (c$, "validate",
\r
5 function (s, from, to) {
\r
6 return from < s.length () && com.stevesoft.pat.Prop.isPunct (s.charAt (from)) ? to : -1;
\r
7 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
8 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeWhite", com.stevesoft.pat.UniValidator);
\r
9 Clazz.overrideMethod (c$, "validate",
\r
10 function (s, from, to) {
\r
11 return from < s.length () && com.stevesoft.pat.Prop.isWhite (s.charAt (from)) ? to : -1;
\r
12 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
13 c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodePunct", com.stevesoft.pat.UniValidator);
\r
14 Clazz.overrideMethod (c$, "validate",
\r
15 function (s, from, to) {
\r
16 return from < s.length () && !com.stevesoft.pat.Prop.isPunct (s.charAt (from)) ? to : -1;
\r
17 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
18 c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeWhite", com.stevesoft.pat.UniValidator);
\r
19 Clazz.overrideMethod (c$, "validate",
\r
20 function (s, from, to) {
\r
21 return from < s.length () && !com.stevesoft.pat.Prop.isWhite (s.charAt (from)) ? to : -1;
\r
22 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
23 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeW", com.stevesoft.pat.UniValidator);
\r
24 Clazz.overrideMethod (c$, "validate",
\r
25 function (s, from, to) {
\r
26 if (from >= s.length ()) {
\r
28 }var c = s.charAt (from);
\r
29 return (com.stevesoft.pat.Prop.isAlphabetic (c) || com.stevesoft.pat.Prop.isDecimalDigit (c) || c == '_') ? to : -1;
\r
30 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
31 c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeW", com.stevesoft.pat.UniValidator);
\r
32 Clazz.overrideMethod (c$, "validate",
\r
33 function (s, from, to) {
\r
34 if (from >= s.length ()) {
\r
36 }var c = s.charAt (from);
\r
37 return !(com.stevesoft.pat.Prop.isAlphabetic (c) || com.stevesoft.pat.Prop.isDecimalDigit (c) || c == '_') ? to : -1;
\r
38 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
39 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeDigit", com.stevesoft.pat.UniValidator);
\r
40 Clazz.overrideMethod (c$, "validate",
\r
41 function (s, from, to) {
\r
42 return from < s.length () && com.stevesoft.pat.Prop.isDecimalDigit (s.charAt (from)) ? to : -1;
\r
43 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
44 c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeDigit", com.stevesoft.pat.UniValidator);
\r
45 Clazz.overrideMethod (c$, "validate",
\r
46 function (s, from, to) {
\r
47 return from < s.length () && !com.stevesoft.pat.Prop.isDecimalDigit (s.charAt (from)) ? to : -1;
\r
48 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
49 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeMath", com.stevesoft.pat.UniValidator);
\r
50 Clazz.overrideMethod (c$, "validate",
\r
51 function (s, from, to) {
\r
52 return from < s.length () && com.stevesoft.pat.Prop.isMath (s.charAt (from)) ? to : -1;
\r
53 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
54 c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeMath", com.stevesoft.pat.UniValidator);
\r
55 Clazz.overrideMethod (c$, "validate",
\r
56 function (s, from, to) {
\r
57 return from < s.length () && !com.stevesoft.pat.Prop.isMath (s.charAt (from)) ? to : -1;
\r
58 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
59 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeCurrency", com.stevesoft.pat.UniValidator);
\r
60 Clazz.overrideMethod (c$, "validate",
\r
61 function (s, from, to) {
\r
62 return from < s.length () && com.stevesoft.pat.Prop.isCurrency (s.charAt (from)) ? to : -1;
\r
63 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
64 c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeCurrency", com.stevesoft.pat.UniValidator);
\r
65 Clazz.overrideMethod (c$, "validate",
\r
66 function (s, from, to) {
\r
67 return from < s.length () && !com.stevesoft.pat.Prop.isCurrency (s.charAt (from)) ? to : -1;
\r
68 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
69 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeAlpha", com.stevesoft.pat.UniValidator);
\r
70 Clazz.overrideMethod (c$, "validate",
\r
71 function (s, from, to) {
\r
72 return from < s.length () && com.stevesoft.pat.Prop.isAlphabetic (s.charAt (from)) ? to : -1;
\r
73 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
74 c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeAlpha", com.stevesoft.pat.UniValidator);
\r
75 Clazz.overrideMethod (c$, "validate",
\r
76 function (s, from, to) {
\r
77 return from < s.length () && !com.stevesoft.pat.Prop.isAlphabetic (s.charAt (from)) ? to : -1;
\r
78 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
79 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeUpper", com.stevesoft.pat.UniValidator);
\r
80 Clazz.overrideMethod (c$, "validate",
\r
81 function (s, from, to) {
\r
82 return from < s.length () && this.isUpper (s.charAt (from)) ? to : -1;
\r
83 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
84 Clazz.defineMethod (c$, "isUpper",
\r
86 return c == com.stevesoft.pat.CaseMgr.toUpperCaseC (c) && c != com.stevesoft.pat.CaseMgr.toLowerCaseC (c);
\r
88 c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeLower", com.stevesoft.pat.UniValidator);
\r
89 Clazz.overrideMethod (c$, "validate",
\r
90 function (s, from, to) {
\r
91 return from < s.length () && this.isLower (s.charAt (from)) ? to : -1;
\r
92 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
93 Clazz.defineMethod (c$, "isLower",
\r
95 return c != com.stevesoft.pat.CaseMgr.toUpperCaseC (c) && c == com.stevesoft.pat.CaseMgr.toLowerCaseC (c);
\r
97 c$ = Clazz.decorateAsClass (function () {
\r
98 this.thePattern = null;
\r
99 this.minMatch = null;
\r
101 this.dontMatchInQuotes = false;
\r
102 this.ignoreCase = false;
\r
106 this.gFlags = null;
\r
108 this.gFlag = false;
\r
109 this.sFlag = false;
\r
110 this.mFlag = false;
\r
113 this.skipper = null;
\r
114 Clazz.instantialize (this, arguments);
\r
115 }, com.stevesoft.pat, "Regex", com.stevesoft.pat.RegRes, [jalview.jsdev.api.RegExpInterface, Cloneable]);
\r
116 Clazz.prepareFields (c$, function () {
\r
117 this.thePattern = com.stevesoft.pat.Regex.none;
\r
118 this.minMatch = new com.stevesoft.pat.patInt (0);
\r
119 this.pt = new com.stevesoft.pat.Pthings ();
\r
121 Clazz.makeConstructor (c$,
\r
122 function (s, strRp) {
\r
123 Clazz.superConstructor (this, com.stevesoft.pat.Regex, []);
\r
125 if (s != null) this.compile (s);
\r
126 if (strRp.length > 0) this.rep = com.stevesoft.pat.ReplaceRule.perlCode (strRp);
\r
128 if (Clazz.exceptionOf (rs, com.stevesoft.pat.RegSyntax)) {
\r
134 Clazz.overrideMethod (c$, "clone",
\r
136 return new com.stevesoft.pat.Regex (null, "").cloneFrom (this);
\r
138 Clazz.defineMethod (c$, "cloneFrom",
\r
140 this.copyOutOf (r);
\r
141 this.dontMatchInQuotes = r.dontMatchInQuotes;
\r
143 this.ignoreCase = r.ignoreCase;
\r
144 this.gFlag = r.gFlag;
\r
145 if (r.rep == null) {
\r
148 this.rep = r.rep.clone ();
\r
149 }this.thePattern = r.thePattern.clone ( new java.util.Hashtable ());
\r
150 this.minMatch = r.minMatch;
\r
151 this.skipper = r.skipper;
\r
153 }, "com.stevesoft.pat.Regex");
\r
154 Clazz.defineMethod (c$, "setDontMatchInQuotes",
\r
156 this.dontMatchInQuotes = b;
\r
158 Clazz.defineMethod (c$, "getDontMatchInQuotes",
\r
160 return this.dontMatchInQuotes;
\r
162 Clazz.overrideMethod (c$, "setIgnoreCase",
\r
164 this.ignoreCase = b;
\r
166 Clazz.defineMethod (c$, "getIgnoreCase",
\r
168 return this.ignoreCase;
\r
170 c$.setDefaultMFlag = Clazz.defineMethod (c$, "setDefaultMFlag",
\r
172 com.stevesoft.pat.Regex.defaultMFlag = mFlag;
\r
174 c$.getDefaultMFlag = Clazz.defineMethod (c$, "getDefaultMFlag",
\r
176 return com.stevesoft.pat.Regex.defaultMFlag;
\r
178 Clazz.defineMethod (c$, "setReplaceRuleStr",
\r
180 this.rep = com.stevesoft.pat.ReplaceRule.perlCode (rp);
\r
183 Clazz.defineMethod (c$, "setReplaceRule",
\r
186 }, "com.stevesoft.pat.ReplaceRule");
\r
187 c$.isDefined = Clazz.defineMethod (c$, "isDefined",
\r
189 return com.stevesoft.pat.Regex.validators.get (nm) != null;
\r
191 c$.undefine = Clazz.defineMethod (c$, "undefine",
\r
193 com.stevesoft.pat.Regex.validators.remove (nm);
\r
195 c$.defineV = Clazz.defineMethod (c$, "defineV",
\r
196 function (nm, pat, v) {
\r
198 com.stevesoft.pat.Regex.validators.put (nm, v);
\r
199 }, "~S,~S,com.stevesoft.pat.Validator");
\r
200 c$.define = Clazz.defineMethod (c$, "define",
\r
201 function (nm, pat) {
\r
202 com.stevesoft.pat.Regex.validators.put (nm, pat);
\r
204 Clazz.defineMethod (c$, "getReplaceRule",
\r
208 Clazz.defineMethod (c$, "_getReplacer",
\r
210 return this.repr == null ? this.repr = new com.stevesoft.pat.Replacer () : this.repr;
\r
212 Clazz.defineMethod (c$, "getReplacer",
\r
214 if (this.repr == null) {
\r
215 this.repr = new com.stevesoft.pat.Replacer ();
\r
216 }this.repr.rh.me = this;
\r
217 this.repr.rh.prev = null;
\r
220 Clazz.defineMethod (c$, "replaceFirst",
\r
222 return this._getReplacer ().replaceFirstRegion (s, this, 0, s.length).toString ();
\r
224 Clazz.defineMethod (c$, "replaceFirstFrom",
\r
225 function (s, pos) {
\r
226 return this._getReplacer ().replaceFirstRegion (s, this, pos, s.length).toString ();
\r
228 Clazz.defineMethod (c$, "replaceFirstRegion",
\r
229 function (s, start, end) {
\r
230 return this._getReplacer ().replaceFirstRegion (s, this, start, end).toString ();
\r
232 Clazz.overrideMethod (c$, "replaceAll",
\r
234 return this._getReplacer ().replaceAllRegion (s, this, 0, s.length).toString ();
\r
236 Clazz.defineMethod (c$, "replaceAllLike",
\r
238 return this._getReplacer ().replaceAllRegion (s, this, 0, s.length ());
\r
239 }, "com.stevesoft.pat.StringLike");
\r
240 Clazz.defineMethod (c$, "replaceAllFrom",
\r
241 function (s, pos) {
\r
242 return this._getReplacer ().replaceAllRegion (s, this, pos, s.length).toString ();
\r
244 Clazz.defineMethod (c$, "replaceAllRegion",
\r
245 function (s, start, end) {
\r
246 return this._getReplacer ().replaceAllRegion (s, this, start, end).toString ();
\r
248 Clazz.defineMethod (c$, "compile",
\r
249 function (prepat) {
\r
250 var postpat = com.stevesoft.pat.parsePerl.codify (prepat, true);
\r
251 var pat = postpat == null ? prepat : postpat;
\r
252 this.minMatch = null;
\r
253 this.ignoreCase = false;
\r
254 this.dontMatchInQuotes = false;
\r
255 var mk = new com.stevesoft.pat.Rthings (this);
\r
256 var offset = mk.val;
\r
258 this.thePattern = com.stevesoft.pat.Regex.none;
\r
261 this.minMatch = new com.stevesoft.pat.patInt (0);
\r
262 var sp = new com.stevesoft.pat.StrPos (pat, 0);
\r
263 if (sp.incMatch ("(?e=")) {
\r
266 if (sp.match (')')) {
\r
267 newpat = com.stevesoft.pat.Regex.reEscape (pat.substring (6), newEsc, '\\');
\r
268 }} else if (this.esc != '\\') {
\r
269 newpat = com.stevesoft.pat.Regex.reEscape (pat, this.esc, '\\');
\r
270 }this.thePattern = this._compile (newpat, mk);
\r
271 this.numSubs_ = mk.val - offset;
\r
274 Clazz.defineMethod (c$, "equals",
\r
276 if (Clazz.instanceOf (o, com.stevesoft.pat.Regex)) {
\r
277 if (this.toString ().equals (o.toString ())) {
\r
278 return Clazz.superCall (this, com.stevesoft.pat.Regex, "equals", [o]);
\r
282 return Clazz.superCall (this, com.stevesoft.pat.Regex, "equals", [o]);
\r
284 Clazz.defineMethod (c$, "prep",
\r
286 this.pt.lastPos = this.matchedTo ();
\r
287 if (this.pt.lastPos < 0) {
\r
288 this.pt.lastPos = 0;
\r
289 }if ((s == null ? null : s.unwrap ()) !== (this.src == null ? null : s.unwrap ())) {
\r
290 this.pt.lastPos = 0;
\r
292 this.pt.dotDoesntMatchCR = com.stevesoft.pat.Regex.dotDoesntMatchCR && (!this.sFlag);
\r
293 this.pt.mFlag = ( new Boolean (this.mFlag | com.stevesoft.pat.Regex.defaultMFlag).valueOf ());
\r
294 this.pt.ignoreCase = this.ignoreCase;
\r
295 this.pt.no_check = false;
\r
296 if (this.pt.marks != null) {
\r
297 for (var i = 0; i < this.pt.marks.length; i++) {
\r
298 this.pt.marks[i] = -1;
\r
300 }this.pt.marks = null;
\r
301 this.pt.nMarks = this.numSubs_;
\r
303 if (this.dontMatchInQuotes) {
\r
304 com.stevesoft.pat.Regex.setCbits (s, this.pt);
\r
306 this.pt.cbits = null;
\r
308 }, "com.stevesoft.pat.StringLike");
\r
309 Clazz.defineMethod (c$, "matchAt",
\r
310 function (s, start_pos) {
\r
311 return this._search (s, start_pos, start_pos);
\r
313 Clazz.defineMethod (c$, "matchAtLike",
\r
314 function (s, start_pos) {
\r
315 return this._searchLike (s, start_pos, start_pos);
\r
316 }, "com.stevesoft.pat.StringLike,~N");
\r
317 Clazz.overrideMethod (c$, "search",
\r
320 throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_given_to_regex_search"));
\r
321 }return this._search (s, 0, s.length);
\r
323 Clazz.defineMethod (c$, "searchLike",
\r
326 throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search"));
\r
327 }return this._searchLike (sl, 0, sl.length ());
\r
328 }, "com.stevesoft.pat.StringLike");
\r
329 Clazz.defineMethod (c$, "reverseSearch",
\r
332 throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_given_to_regex_reverse_search"));
\r
333 }return this._reverseSearch (s, 0, s.length);
\r
335 Clazz.defineMethod (c$, "reverseSearchLike",
\r
338 throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_reverse_search"));
\r
339 }return this._reverseSearchLike (sl, 0, sl.length ());
\r
340 }, "com.stevesoft.pat.StringLike");
\r
341 Clazz.overrideMethod (c$, "searchFrom",
\r
342 function (s, start) {
\r
344 throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search_from"));
\r
345 }return this._search (s, start, s.length);
\r
347 Clazz.defineMethod (c$, "searchFromLike",
\r
348 function (s, start) {
\r
350 throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search_from"));
\r
351 }return this._searchLike (s, start, s.length ());
\r
352 }, "com.stevesoft.pat.StringLike,~N");
\r
353 Clazz.defineMethod (c$, "searchRegion",
\r
354 function (s, start, end) {
\r
356 throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search_region"));
\r
357 }return this._search (s, start, end);
\r
359 Clazz.defineMethod (c$, "setGFlag",
\r
363 Clazz.defineMethod (c$, "getGFlag",
\r
367 Clazz.defineMethod (c$, "getSFlag",
\r
371 Clazz.defineMethod (c$, "getMFlag",
\r
375 Clazz.defineMethod (c$, "_search",
\r
376 function (s, start, end) {
\r
377 return this._searchLike ( new com.stevesoft.pat.wrap.StringWrap (s), start, end);
\r
379 Clazz.defineMethod (c$, "_searchLike",
\r
380 function (s, start, end) {
\r
381 if (this.gFlag && this.gFlagto > 0 && this.gFlags != null && s.unwrap () === this.gFlags.unwrap ()) {
\r
382 start = this.gFlagto;
\r
383 }this.gFlags = null;
\r
384 var pt = this.prep (s);
\r
385 var up = (this.minMatch == null ? end : end - this.minMatch.i);
\r
386 if (up < start && end >= start) {
\r
388 }if (this.skipper == null) {
\r
389 for (var i = start; i <= up; i++) {
\r
390 this.charsMatched_ = this.thePattern.matchAt (s, i, pt);
\r
391 if (this.charsMatched_ >= 0) {
\r
392 this.matchFrom_ = this.thePattern.mfrom;
\r
393 this.marks = pt.marks;
\r
394 this.gFlagto = this.matchFrom_ + this.charsMatched_;
\r
396 return this.didMatch_ = true;
\r
399 pt.no_check = true;
\r
400 for (var i = start; i <= up; i++) {
\r
401 i = this.skipper.find (this.src, i, up);
\r
403 this.charsMatched_ = this.matchFrom_ = -1;
\r
404 return this.didMatch_ = false;
\r
405 }this.charsMatched_ = this.thePattern.matchAt (s, i, pt);
\r
406 if (this.charsMatched_ >= 0) {
\r
407 this.matchFrom_ = this.thePattern.mfrom;
\r
408 this.marks = pt.marks;
\r
409 this.gFlagto = this.matchFrom_ + this.charsMatched_;
\r
411 return this.didMatch_ = true;
\r
413 }return this.didMatch_ = false;
\r
414 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
415 Clazz.defineMethod (c$, "_reverseSearch",
\r
416 function (s, start, end) {
\r
417 return this._reverseSearchLike ( new com.stevesoft.pat.wrap.StringWrap (s), start, end);
\r
419 Clazz.defineMethod (c$, "_reverseSearchLike",
\r
420 function (s, start, end) {
\r
421 if (this.gFlag && this.gFlagto > 0 && s.unwrap () === this.gFlags.unwrap ()) {
\r
422 end = this.gFlagto;
\r
423 }this.gFlags = null;
\r
424 var pt = this.prep (s);
\r
425 for (var i = end; i >= start; i--) {
\r
426 this.charsMatched_ = this.thePattern.matchAt (s, i, pt);
\r
427 if (this.charsMatched_ >= 0) {
\r
428 this.matchFrom_ = this.thePattern.mfrom;
\r
429 this.marks = pt.marks;
\r
430 this.gFlagto = this.matchFrom_ - 1;
\r
432 return this.didMatch_ = true;
\r
434 return this.didMatch_ = false;
\r
435 }, "com.stevesoft.pat.StringLike,~N,~N");
\r
436 c$.setCbits = Clazz.defineMethod (c$, "setCbits",
\r
438 if (s === com.stevesoft.pat.Regex.lasts) {
\r
439 pt.cbits = com.stevesoft.pat.Regex.lastbs;
\r
441 }var bs = new java.util.BitSet (s.length ());
\r
443 var setBit = false;
\r
444 for (var i = 0; i < s.length (); i++) {
\r
447 }var c = s.charAt (i);
\r
448 if (!setBit && c == '"') {
\r
452 } else if (!setBit && c == '\'') {
\r
456 } else if (setBit && c == qc) {
\r
458 } else if (setBit && c == '\\' && i + 1 < s.length ()) {
\r
463 pt.cbits = com.stevesoft.pat.Regex.lastbs = bs;
\r
464 com.stevesoft.pat.Regex.lasts = s;
\r
465 }, "com.stevesoft.pat.StringLike,com.stevesoft.pat.Pthings");
\r
466 Clazz.defineMethod (c$, "add",
\r
468 if (this.p == null) {
\r
473 }}, "com.stevesoft.pat.Pattern");
\r
474 Clazz.defineMethod (c$, "compileSP",
\r
475 function (sp, mk) {
\r
476 if (sp.match ('[')) {
\r
478 this.add (this.matchBracket (sp));
\r
479 } else if (sp.match ('|')) {
\r
480 if (this.or == null) {
\r
481 this.or = new com.stevesoft.pat.Or ();
\r
482 }if (this.p == null) {
\r
483 this.p = new com.stevesoft.pat.NullPattern ();
\r
484 }this.or.addOr (this.p);
\r
486 } else if (sp.incMatch ("(?<")) {
\r
487 var i = sp.getPatInt ();
\r
489 com.stevesoft.pat.RegSyntaxError.endItAll ("No int after (?<");
\r
490 }this.add ( new com.stevesoft.pat.Backup (i.intValue ()));
\r
491 if (!sp.match (')')) {
\r
492 com.stevesoft.pat.RegSyntaxError.endItAll ("No ) after (?<");
\r
493 }} else if (sp.incMatch ("(?>")) {
\r
494 var i = sp.getPatInt ();
\r
496 com.stevesoft.pat.RegSyntaxError.endItAll ("No int after (?>");
\r
497 }this.add ( new com.stevesoft.pat.Backup (-i.intValue ()));
\r
498 if (!sp.match (')')) {
\r
499 com.stevesoft.pat.RegSyntaxError.endItAll ("No ) after (?<");
\r
500 }} else if (sp.incMatch ("(?@")) {
\r
505 if (!sp.match (')')) {
\r
506 com.stevesoft.pat.RegSyntaxError.endItAll ("(?@ does not have closing paren");
\r
507 }this.add ( new com.stevesoft.pat.Group (op, cl));
\r
508 } else if (sp.incMatch ("(?#")) {
\r
509 while (!sp.match (')')) {
\r
512 } else if (sp.dontMatch && sp.c == 'w') {
\r
513 var b = new com.stevesoft.pat.Bracket (false);
\r
514 b.addOr ( new com.stevesoft.pat.Range ('a', 'z'));
\r
515 b.addOr ( new com.stevesoft.pat.Range ('A', 'Z'));
\r
516 b.addOr ( new com.stevesoft.pat.Range ('0', '9'));
\r
517 b.addOr ( new com.stevesoft.pat.oneChar ('_'));
\r
519 } else if (sp.dontMatch && sp.c == 'G') {
\r
520 this.add ( new com.stevesoft.pat.BackG ());
\r
521 } else if (sp.dontMatch && sp.c == 's') {
\r
522 var b = new com.stevesoft.pat.Bracket (false);
\r
523 b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (32)));
\r
524 b.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (8), String.fromCharCode (10)));
\r
525 b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (13)));
\r
527 } else if (sp.dontMatch && sp.c == 'd') {
\r
528 var digit = new com.stevesoft.pat.Range ('0', '9');
\r
529 digit.printBrackets = true;
\r
531 } else if (sp.dontMatch && sp.c == 'W') {
\r
532 var b = new com.stevesoft.pat.Bracket (true);
\r
533 b.addOr ( new com.stevesoft.pat.Range ('a', 'z'));
\r
534 b.addOr ( new com.stevesoft.pat.Range ('A', 'Z'));
\r
535 b.addOr ( new com.stevesoft.pat.Range ('0', '9'));
\r
536 b.addOr ( new com.stevesoft.pat.oneChar ('_'));
\r
538 } else if (sp.dontMatch && sp.c == 'S') {
\r
539 var b = new com.stevesoft.pat.Bracket (true);
\r
540 b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (32)));
\r
541 b.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (8), String.fromCharCode (10)));
\r
542 b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (13)));
\r
544 } else if (sp.dontMatch && sp.c == 'D') {
\r
545 var b = new com.stevesoft.pat.Bracket (true);
\r
546 b.addOr ( new com.stevesoft.pat.Range ('0', '9'));
\r
548 } else if (sp.dontMatch && sp.c == 'B') {
\r
549 var r = new com.stevesoft.pat.Regex (null, "");
\r
550 r._compile ("(?!\\b)", mk);
\r
551 this.add (r.thePattern);
\r
552 } else if (this.isOctalString (sp)) {
\r
553 var d = sp.c.charCodeAt (0) - 48;
\r
555 d = 8 * d + sp.c.charCodeAt (0) - 48;
\r
556 var sp2 = new com.stevesoft.pat.StrPos (sp);
\r
558 if (this.isOctalDigit (sp2, false)) {
\r
560 d = 8 * d + sp.c.charCodeAt (0) - 48;
\r
561 }this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (d)));
\r
562 } else if (sp.dontMatch && sp.c >= '1' && sp.c <= '9') {
\r
563 var iv = sp.c.charCodeAt (0) - 48;
\r
564 var s2 = new com.stevesoft.pat.StrPos (sp);
\r
566 if (!s2.dontMatch && s2.c >= '0' && s2.c <= '9') {
\r
567 iv = 10 * iv + (s2.c.charCodeAt (0) - 48);
\r
569 }this.add ( new com.stevesoft.pat.BackMatch (iv));
\r
570 } else if (sp.dontMatch && sp.c == 'b') {
\r
571 this.add ( new com.stevesoft.pat.Boundary ());
\r
572 } else if (sp.match ('\b')) {
\r
573 this.add ( new com.stevesoft.pat.Boundary ());
\r
574 } else if (sp.match ('$')) {
\r
575 this.add ( new com.stevesoft.pat.End (true));
\r
576 } else if (sp.dontMatch && sp.c == 'Z') {
\r
577 this.add ( new com.stevesoft.pat.End (false));
\r
578 } else if (sp.match ('.')) {
\r
579 this.add ( new com.stevesoft.pat.Any ());
\r
580 } else if (sp.incMatch ("(??")) {
\r
581 var sb = new StringBuffer ();
\r
582 var sb2 = new StringBuffer ();
\r
583 while (!sp.match (')') && !sp.match (':')) {
\r
587 if (sp.incMatch (":")) {
\r
588 while (!sp.match (')')) {
\r
592 }var sbs = sb.toString ();
\r
593 if (Clazz.instanceOf (com.stevesoft.pat.Regex.validators.get (sbs), String)) {
\r
594 var pat = com.stevesoft.pat.Regex.validators.get (sbs);
\r
595 var r = new com.stevesoft.pat.Regex (null, "");
\r
596 var rth = new com.stevesoft.pat.Rthings (this);
\r
597 rth.noBackRefs = true;
\r
598 r._compile (pat, rth);
\r
599 this.add (r.thePattern);
\r
601 var cm = new com.stevesoft.pat.Custom (sb.toString ());
\r
602 if (cm.v != null) {
\r
603 var v2 = cm.v.arg (sb2.toString ());
\r
605 v2.argsave = sb2.toString ();
\r
606 var p = cm.v.pattern;
\r
609 }var r = new com.stevesoft.pat.Regex (null, "");
\r
610 var rth = new com.stevesoft.pat.Rthings (this);
\r
611 rth.noBackRefs = true;
\r
612 r._compile (cm.v.pattern, rth);
\r
613 cm.sub = r.thePattern;
\r
614 cm.sub.add ( new com.stevesoft.pat.CustomEndpoint (cm));
\r
615 cm.sub.setParent (cm);
\r
617 }}} else if (sp.match ('(')) {
\r
619 var r = new com.stevesoft.pat.Regex (null, "");
\r
621 if (sp.incMatch ("?:")) {
\r
622 r.or = new com.stevesoft.pat.Or ();
\r
623 } else if (sp.incMatch ("?=")) {
\r
624 r.or = new com.stevesoft.pat.lookAhead (false);
\r
625 } else if (sp.incMatch ("?!")) {
\r
626 r.or = new com.stevesoft.pat.lookAhead (true);
\r
627 } else if (sp.match ('?')) {
\r
631 mk.ignoreCase = true;
\r
632 }if (sp.c == 'Q') {
\r
633 mk.dontMatchInQuotes = true;
\r
634 }if (sp.c == 'o') {
\r
635 mk.optimizeMe = true;
\r
636 }if (sp.c == 'g') {
\r
638 }if (sp.c == 's') {
\r
640 }if (sp.c == 'm') {
\r
643 } while (!sp.match (')') && !sp.$eos);
\r
647 com.stevesoft.pat.RegSyntaxError.endItAll ("Unclosed ()");
\r
649 r.or = mk.noBackRefs ? new com.stevesoft.pat.Or () : new com.stevesoft.pat.OrMark (mk.val++);
\r
651 this.add (r._compileSP (sp, mk));
\r
652 }} else if (sp.match ('^')) {
\r
653 this.add ( new com.stevesoft.pat.Start (true));
\r
654 } else if (sp.dontMatch && sp.c == 'A') {
\r
655 this.add ( new com.stevesoft.pat.Start (false));
\r
656 } else if (sp.match ('*')) {
\r
657 this.addMulti ( new com.stevesoft.pat.patInt (0), new com.stevesoft.pat.patInf ());
\r
658 } else if (sp.match ('+')) {
\r
659 this.addMulti ( new com.stevesoft.pat.patInt (1), new com.stevesoft.pat.patInf ());
\r
660 } else if (sp.match ('?')) {
\r
661 this.addMulti ( new com.stevesoft.pat.patInt (0), new com.stevesoft.pat.patInt (1));
\r
662 } else if (sp.match ('{')) {
\r
664 var sp2 = new com.stevesoft.pat.StrPos (sp);
\r
666 var i1 = sp.getPatInt ();
\r
668 if (sp.match ('}')) {
\r
671 if (!sp.match (',')) {
\r
674 if (sp.match ('}')) {
\r
675 i2 = new com.stevesoft.pat.patInf ();
\r
677 i2 = sp.getPatInt ();
\r
678 }}if (i1 == null || i2 == null) {
\r
682 this.add ( new com.stevesoft.pat.oneChar (sp.c));
\r
684 this.addMulti (i1, i2);
\r
685 }} else if (sp.escMatch ('x') && this.next2Hex (sp)) {
\r
687 var d = this.getHexDigit (sp);
\r
689 d = 16 * d + this.getHexDigit (sp);
\r
690 this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (d)));
\r
691 } else if (sp.escMatch ('c')) {
\r
693 if (sp.c.charCodeAt (0) < com.stevesoft.pat.Ctrl.cmap.length) {
\r
694 this.add ( new com.stevesoft.pat.oneChar (com.stevesoft.pat.Ctrl.cmap[sp.c.charCodeAt (0)]));
\r
696 this.add ( new com.stevesoft.pat.oneChar (sp.c));
\r
697 }} else if (sp.escMatch ('f')) {
\r
698 this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (12)));
\r
699 } else if (sp.escMatch ('a')) {
\r
700 this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (7)));
\r
701 } else if (sp.escMatch ('t')) {
\r
702 this.add ( new com.stevesoft.pat.oneChar ('\t'));
\r
703 } else if (sp.escMatch ('n')) {
\r
704 this.add ( new com.stevesoft.pat.oneChar ('\n'));
\r
705 } else if (sp.escMatch ('r')) {
\r
706 this.add ( new com.stevesoft.pat.oneChar ('\r'));
\r
707 } else if (sp.escMatch ('b')) {
\r
708 this.add ( new com.stevesoft.pat.oneChar ('\b'));
\r
709 } else if (sp.escMatch ('e')) {
\r
710 this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (27)));
\r
712 this.add ( new com.stevesoft.pat.oneChar (sp.c));
\r
713 if (sp.match (')')) {
\r
714 com.stevesoft.pat.RegSyntaxError.endItAll ("Unmatched right paren in pattern");
\r
715 }}}, "com.stevesoft.pat.StrPos,com.stevesoft.pat.Rthings");
\r
716 Clazz.defineMethod (c$, "_compile",
\r
717 ($fz = function (pat, mk) {
\r
718 this.minMatch = null;
\r
719 this.sFlag = this.mFlag = this.ignoreCase = this.gFlag = false;
\r
720 var sp = new com.stevesoft.pat.StrPos (pat, 0);
\r
721 this.thePattern = this._compileSP (sp, mk);
\r
722 this.pt.marks = null;
\r
723 return this.thePattern;
\r
724 }, $fz.isPrivate = true, $fz), "~S,com.stevesoft.pat.Rthings");
\r
725 Clazz.defineMethod (c$, "_compileSP",
\r
726 function (sp, mk) {
\r
727 while (!(sp.$eos || (this.or != null && sp.match (')')))) {
\r
728 this.compileSP (sp, mk);
\r
731 if (sp.match (')')) {
\r
733 } else if (sp.$eos && mk.parenLevel != 0) {
\r
734 com.stevesoft.pat.RegSyntaxError.endItAll ("Unclosed Parenthesis! lvl=" + mk.parenLevel);
\r
735 }if (this.or != null) {
\r
736 if (this.p == null) {
\r
737 this.p = new com.stevesoft.pat.NullPattern ();
\r
738 }this.or.addOr (this.p);
\r
740 }return this.p == null ? new com.stevesoft.pat.NullPattern () : this.p;
\r
741 }, "com.stevesoft.pat.StrPos,com.stevesoft.pat.Rthings");
\r
742 Clazz.defineMethod (c$, "addMulti",
\r
743 function (i1, i2) {
\r
746 for (last = this.p; last != null && last.next != null; last = last.next) {
\r
748 if (last == null || last === this.p) {
\r
751 for (last2 = this.p; last2.next !== last; last2 = last2.next) {
\r
753 }if (Clazz.instanceOf (last, com.stevesoft.pat.Multi) && i1.intValue () == 0 && i2.intValue () == 1) {
\r
754 (last).matchFewest = true;
\r
755 } else if (Clazz.instanceOf (last, com.stevesoft.pat.FastMulti) && i1.intValue () == 0 && i2.intValue () == 1) {
\r
756 (last).matchFewest = true;
\r
757 } else if (Clazz.instanceOf (last, com.stevesoft.pat.DotMulti) && i1.intValue () == 0 && i2.intValue () == 1) {
\r
758 (last).matchFewest = true;
\r
759 } else if (Clazz.instanceOf (last, com.stevesoft.pat.Multi) || Clazz.instanceOf (last, com.stevesoft.pat.DotMulti) || Clazz.instanceOf (last, com.stevesoft.pat.FastMulti)) {
\r
760 throw new com.stevesoft.pat.RegSyntax ("Syntax error.");
\r
761 } else if (last2 == null) {
\r
762 this.p = com.stevesoft.pat.Regex.mkMulti (i1, i2, this.p);
\r
764 last2.next = com.stevesoft.pat.Regex.mkMulti (i1, i2, last);
\r
765 }}, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt");
\r
766 c$.mkMulti = Clazz.defineMethod (c$, "mkMulti",
\r
767 function (lo, hi, p) {
\r
768 if (Clazz.instanceOf (p, com.stevesoft.pat.Any) && p.next == null) {
\r
769 return new com.stevesoft.pat.DotMulti (lo, hi);
\r
770 }return com.stevesoft.pat.RegOpt.safe4fm (p) ? new com.stevesoft.pat.FastMulti (lo, hi, p) : new com.stevesoft.pat.Multi (lo, hi, p);
\r
771 }, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt,com.stevesoft.pat.Pattern");
\r
772 Clazz.defineMethod (c$, "matchBracket",
\r
775 if (sp.match ('^')) {
\r
776 ret = new com.stevesoft.pat.Bracket (true);
\r
779 ret = new com.stevesoft.pat.Bracket (false);
\r
780 }if (sp.match (']')) {
\r
781 com.stevesoft.pat.RegSyntaxError.endItAll ("Unmatched []");
\r
782 }while (!sp.$eos && !sp.match (']')) {
\r
783 var s1 = new com.stevesoft.pat.StrPos (sp);
\r
785 var s1_ = new com.stevesoft.pat.StrPos (s1);
\r
787 if (s1.match ('-') && !s1_.match (']')) {
\r
788 var s2 = new com.stevesoft.pat.StrPos (s1);
\r
791 ret.addOr ( new com.stevesoft.pat.Range (sp.c, s2.c));
\r
794 } else if (sp.escMatch ('Q')) {
\r
796 while (!sp.escMatch ('E')) {
\r
797 ret.addOr ( new com.stevesoft.pat.oneChar (sp.c));
\r
800 } else if (sp.escMatch ('d')) {
\r
801 ret.addOr ( new com.stevesoft.pat.Range ('0', '9'));
\r
802 } else if (sp.escMatch ('s')) {
\r
803 ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (32)));
\r
804 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (8), String.fromCharCode (10)));
\r
805 ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (13)));
\r
806 } else if (sp.escMatch ('w')) {
\r
807 ret.addOr ( new com.stevesoft.pat.Range ('a', 'z'));
\r
808 ret.addOr ( new com.stevesoft.pat.Range ('A', 'Z'));
\r
809 ret.addOr ( new com.stevesoft.pat.Range ('0', '9'));
\r
810 ret.addOr ( new com.stevesoft.pat.oneChar ('_'));
\r
811 } else if (sp.escMatch ('D')) {
\r
812 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (0), String.fromCharCode (47)));
\r
813 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (58), String.fromCharCode (65535)));
\r
814 } else if (sp.escMatch ('S')) {
\r
815 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (0), String.fromCharCode (7)));
\r
816 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (11), String.fromCharCode (12)));
\r
817 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (14), String.fromCharCode (31)));
\r
818 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (33), String.fromCharCode (65535)));
\r
819 } else if (sp.escMatch ('W')) {
\r
820 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (0), String.fromCharCode (64)));
\r
821 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (91), String.fromCharCode (94)));
\r
822 ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (96)));
\r
823 ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (123), String.fromCharCode (65535)));
\r
824 } else if (sp.escMatch ('x') && this.next2Hex (sp)) {
\r
826 var d = this.getHexDigit (sp);
\r
828 d = 16 * d + this.getHexDigit (sp);
\r
829 ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (d)));
\r
830 } else if (sp.escMatch ('a')) {
\r
831 ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (7)));
\r
832 } else if (sp.escMatch ('f')) {
\r
833 ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (12)));
\r
834 } else if (sp.escMatch ('e')) {
\r
835 ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (27)));
\r
836 } else if (sp.escMatch ('n')) {
\r
837 ret.addOr ( new com.stevesoft.pat.oneChar ('\n'));
\r
838 } else if (sp.escMatch ('t')) {
\r
839 ret.addOr ( new com.stevesoft.pat.oneChar ('\t'));
\r
840 } else if (sp.escMatch ('r')) {
\r
841 ret.addOr ( new com.stevesoft.pat.oneChar ('\r'));
\r
842 } else if (sp.escMatch ('c')) {
\r
844 if (sp.c.charCodeAt (0) < com.stevesoft.pat.Ctrl.cmap.length) {
\r
845 ret.addOr ( new com.stevesoft.pat.oneChar (com.stevesoft.pat.Ctrl.cmap[sp.c.charCodeAt (0)]));
\r
847 ret.addOr ( new com.stevesoft.pat.oneChar (sp.c));
\r
848 }} else if (this.isOctalString (sp)) {
\r
849 var d = sp.c.charCodeAt (0) - 48;
\r
851 d = 8 * d + sp.c.charCodeAt (0) - 48;
\r
852 var sp2 = new com.stevesoft.pat.StrPos (sp);
\r
854 if (this.isOctalDigit (sp2, false)) {
\r
856 d = 8 * d + sp.c.charCodeAt (0) - 48;
\r
857 }ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (d)));
\r
859 ret.addOr ( new com.stevesoft.pat.oneChar (sp.c));
\r
863 }, "com.stevesoft.pat.StrPos");
\r
864 Clazz.overrideMethod (c$, "toString",
\r
867 var sb = new StringBuffer ();
\r
868 if (this.esc != '\\') {
\r
869 sb.append ("(?e=");
\r
870 sb.append (this.esc);
\r
872 }if (this.gFlag || this.mFlag || !com.stevesoft.pat.Regex.dotDoesntMatchCR || this.sFlag || this.ignoreCase || this.dontMatchInQuotes || this.optimized ()) {
\r
874 if (this.ignoreCase) {
\r
878 }if (this.sFlag || !com.stevesoft.pat.Regex.dotDoesntMatchCR) {
\r
880 }if (this.dontMatchInQuotes) {
\r
882 }if (this.optimized ()) {
\r
887 }var patstr = this.thePattern.toString ();
\r
888 if (this.esc != '\\') {
\r
889 patstr = com.stevesoft.pat.Regex.reEscape (patstr, '\\', this.esc);
\r
890 }sb.append (patstr);
\r
891 return sb.toString ();
\r
893 c$.reEscape = Clazz.defineMethod (c$, "reEscape",
\r
894 function (s, oldEsc, newEsc) {
\r
895 if (oldEsc == newEsc) {
\r
898 var sb = new StringBuffer ();
\r
899 for (i = 0; i < s.length; i++) {
\r
900 if (s.charAt (i) == oldEsc && i + 1 < s.length) {
\r
901 if (s.charAt (i + 1) == oldEsc) {
\r
902 sb.append (oldEsc);
\r
904 sb.append (newEsc);
\r
905 sb.append (s.charAt (i + 1));
\r
907 } else if (s.charAt (i) == newEsc) {
\r
908 sb.append (newEsc);
\r
909 sb.append (newEsc);
\r
911 sb.append (s.charAt (i));
\r
913 return sb.toString ();
\r
915 Clazz.defineMethod (c$, "accept",
\r
916 function (dir, s) {
\r
917 return this.search (s);
\r
918 }, "java.io.File,~S");
\r
919 c$.version = Clazz.defineMethod (c$, "version",
\r
921 return "lgpl release 1.5.3";
\r
923 Clazz.defineMethod (c$, "optimize",
\r
925 if (this.optimized () || this.thePattern == null) {
\r
927 }this.minMatch = new com.stevesoft.pat.patInt (0);
\r
928 this.thePattern = com.stevesoft.pat.RegOpt.opt (this.thePattern, this.ignoreCase, this.dontMatchInQuotes);
\r
929 this.skipper = com.stevesoft.pat.Skip.findSkipRegex (this);
\r
932 Clazz.defineMethod (c$, "optimized",
\r
934 return this.minMatch != null;
\r
936 c$.perlCode = Clazz.defineMethod (c$, "perlCode",
\r
938 return com.stevesoft.pat.parsePerl.parse (s);
\r
940 Clazz.defineMethod (c$, "isLiteral",
\r
942 var x = this.thePattern;
\r
943 while (x != null) {
\r
944 if (Clazz.instanceOf (x, com.stevesoft.pat.oneChar)) {
\r
945 ;} else if (Clazz.instanceOf (x, com.stevesoft.pat.Skipped)) {
\r
952 Clazz.defineMethod (c$, "countMinChars",
\r
954 return this.thePattern.countMinChars ();
\r
956 Clazz.defineMethod (c$, "countMaxChars",
\r
958 return this.thePattern.countMaxChars ();
\r
960 Clazz.defineMethod (c$, "isHexDigit",
\r
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'));
\r
964 }, "com.stevesoft.pat.StrPos");
\r
965 Clazz.defineMethod (c$, "isOctalDigit",
\r
966 function (sp, first) {
\r
967 var r = !sp.$eos && !( new Boolean (first ^ sp.dontMatch).valueOf ()) && sp.c >= '0' && sp.c <= '7';
\r
969 }, "com.stevesoft.pat.StrPos,~B");
\r
970 Clazz.defineMethod (c$, "getHexDigit",
\r
972 if (sp.c >= '0' && sp.c <= '9') {
\r
973 return sp.c.charCodeAt (0) - 48;
\r
974 }if (sp.c >= 'a' && sp.c <= 'f') {
\r
975 return sp.c.charCodeAt (0) - 97 + 10;
\r
976 }return sp.c.charCodeAt (0) - 65 + 10;
\r
977 }, "com.stevesoft.pat.StrPos");
\r
978 Clazz.defineMethod (c$, "next2Hex",
\r
980 var sp2 = new com.stevesoft.pat.StrPos (sp);
\r
982 if (!this.isHexDigit (sp2)) {
\r
985 if (!this.isHexDigit (sp2)) {
\r
988 }, "com.stevesoft.pat.StrPos");
\r
989 Clazz.defineMethod (c$, "isOctalString",
\r
991 if (!this.isOctalDigit (sp, true)) {
\r
993 }var sp2 = new com.stevesoft.pat.StrPos (sp);
\r
995 if (!this.isOctalDigit (sp2, false)) {
\r
998 }, "com.stevesoft.pat.StrPos");
\r
999 Clazz.defineStatics (c$,
\r
1000 "BackRefOffset", 1);
\r
1001 c$.none = c$.prototype.none = new com.stevesoft.pat.NoPattern ();
\r
1002 c$.validators = c$.prototype.validators = new java.util.Hashtable ();
\r
1004 com.stevesoft.pat.Regex.defineV ("p", "(?>1)", new com.stevesoft.pat.UnicodePunct ());
\r
1005 com.stevesoft.pat.Regex.defineV ("P", "(?>1)", new com.stevesoft.pat.NUnicodePunct ());
\r
1006 com.stevesoft.pat.Regex.defineV ("s", "(?>1)", new com.stevesoft.pat.UnicodeWhite ());
\r
1007 com.stevesoft.pat.Regex.defineV ("S", "(?>1)", new com.stevesoft.pat.NUnicodeWhite ());
\r
1008 com.stevesoft.pat.Regex.defineV ("w", "(?>1)", new com.stevesoft.pat.UnicodeW ());
\r
1009 com.stevesoft.pat.Regex.defineV ("W", "(?>1)", new com.stevesoft.pat.NUnicodeW ());
\r
1010 com.stevesoft.pat.Regex.defineV ("d", "(?>1)", new com.stevesoft.pat.UnicodeDigit ());
\r
1011 com.stevesoft.pat.Regex.defineV ("D", "(?>1)", new com.stevesoft.pat.NUnicodeDigit ());
\r
1012 com.stevesoft.pat.Regex.defineV ("m", "(?>1)", new com.stevesoft.pat.UnicodeMath ());
\r
1013 com.stevesoft.pat.Regex.defineV ("M", "(?>1)", new com.stevesoft.pat.NUnicodeMath ());
\r
1014 com.stevesoft.pat.Regex.defineV ("c", "(?>1)", new com.stevesoft.pat.UnicodeCurrency ());
\r
1015 com.stevesoft.pat.Regex.defineV ("C", "(?>1)", new com.stevesoft.pat.NUnicodeCurrency ());
\r
1016 com.stevesoft.pat.Regex.defineV ("a", "(?>1)", new com.stevesoft.pat.UnicodeAlpha ());
\r
1017 com.stevesoft.pat.Regex.defineV ("A", "(?>1)", new com.stevesoft.pat.NUnicodeAlpha ());
\r
1018 com.stevesoft.pat.Regex.defineV ("uc", "(?>1)", new com.stevesoft.pat.UnicodeUpper ());
\r
1019 com.stevesoft.pat.Regex.defineV ("lc", "(?>1)", new com.stevesoft.pat.UnicodeLower ());
\r
1020 }Clazz.defineStatics (c$,
\r
1021 "defaultMFlag", false,
\r
1022 "dotDoesntMatchCR", true,
\r
1025 "back_slash", '\\');
\r