X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=bin%2Fcom%2Fstevesoft%2Fpat%2FRegex.js;h=893eaa7e4327955bafa8847324198cde112d164f;hp=d05b95e3dc9313c3a802cfc731d0395f4b169106;hb=7301a2415adab88038b291fc54caeeb3a5a47a44;hpb=6154cb57a6eac3bb1344b8342495f5bb701ee921 diff --git a/bin/com/stevesoft/pat/Regex.js b/bin/com/stevesoft/pat/Regex.js index d05b95e..893eaa7 100644 --- a/bin/com/stevesoft/pat/Regex.js +++ b/bin/com/stevesoft/pat/Regex.js @@ -1,1026 +1,1026 @@ -Clazz.declarePackage ("com.stevesoft.pat"); -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 () { -c$ = Clazz.declareType (com.stevesoft.pat, "UnicodePunct", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -return from < s.length () && com.stevesoft.pat.Prop.isPunct (s.charAt (from)) ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeWhite", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -return from < s.length () && com.stevesoft.pat.Prop.isWhite (s.charAt (from)) ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodePunct", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -return from < s.length () && !com.stevesoft.pat.Prop.isPunct (s.charAt (from)) ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeWhite", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -return from < s.length () && !com.stevesoft.pat.Prop.isWhite (s.charAt (from)) ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeW", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -if (from >= s.length ()) { -return -1; -}var c = s.charAt (from); -return (com.stevesoft.pat.Prop.isAlphabetic (c) || com.stevesoft.pat.Prop.isDecimalDigit (c) || c == '_') ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeW", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -if (from >= s.length ()) { -return -1; -}var c = s.charAt (from); -return !(com.stevesoft.pat.Prop.isAlphabetic (c) || com.stevesoft.pat.Prop.isDecimalDigit (c) || c == '_') ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeDigit", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -return from < s.length () && com.stevesoft.pat.Prop.isDecimalDigit (s.charAt (from)) ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeDigit", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -return from < s.length () && !com.stevesoft.pat.Prop.isDecimalDigit (s.charAt (from)) ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeMath", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -return from < s.length () && com.stevesoft.pat.Prop.isMath (s.charAt (from)) ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeMath", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -return from < s.length () && !com.stevesoft.pat.Prop.isMath (s.charAt (from)) ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeCurrency", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -return from < s.length () && com.stevesoft.pat.Prop.isCurrency (s.charAt (from)) ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeCurrency", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -return from < s.length () && !com.stevesoft.pat.Prop.isCurrency (s.charAt (from)) ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeAlpha", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -return from < s.length () && com.stevesoft.pat.Prop.isAlphabetic (s.charAt (from)) ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeAlpha", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -return from < s.length () && !com.stevesoft.pat.Prop.isAlphabetic (s.charAt (from)) ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeUpper", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -return from < s.length () && this.isUpper (s.charAt (from)) ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -Clazz.defineMethod (c$, "isUpper", -function (c) { -return c == com.stevesoft.pat.CaseMgr.toUpperCaseC (c) && c != com.stevesoft.pat.CaseMgr.toLowerCaseC (c); -}, "~S"); -c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeLower", com.stevesoft.pat.UniValidator); -Clazz.overrideMethod (c$, "validate", -function (s, from, to) { -return from < s.length () && this.isLower (s.charAt (from)) ? to : -1; -}, "com.stevesoft.pat.StringLike,~N,~N"); -Clazz.defineMethod (c$, "isLower", -function (c) { -return c != com.stevesoft.pat.CaseMgr.toUpperCaseC (c) && c == com.stevesoft.pat.CaseMgr.toLowerCaseC (c); -}, "~S"); -c$ = Clazz.decorateAsClass (function () { -this.thePattern = null; -this.minMatch = null; -this.rep = null; -this.dontMatchInQuotes = false; -this.ignoreCase = false; -this.repr = null; -this.esc = '\\'; -this.pt = null; -this.gFlags = null; -this.gFlagto = 0; -this.gFlag = false; -this.sFlag = false; -this.mFlag = false; -this.p = null; -this.or = null; -this.skipper = null; -Clazz.instantialize (this, arguments); -}, com.stevesoft.pat, "Regex", com.stevesoft.pat.RegRes, [jalview.jsdev.api.RegExpInterface, Cloneable]); -Clazz.prepareFields (c$, function () { -this.thePattern = com.stevesoft.pat.Regex.none; -this.minMatch = new com.stevesoft.pat.patInt (0); -this.pt = new com.stevesoft.pat.Pthings (); -}); -Clazz.makeConstructor (c$, -function (s, strRp) { -Clazz.superConstructor (this, com.stevesoft.pat.Regex, []); -try { -if (s != null) this.compile (s); -if (strRp.length > 0) this.rep = com.stevesoft.pat.ReplaceRule.perlCode (strRp); -} catch (rs) { -if (Clazz.exceptionOf (rs, com.stevesoft.pat.RegSyntax)) { -} else { -throw rs; -} -} -}, "~S,~S"); -Clazz.overrideMethod (c$, "clone", -function () { -return new com.stevesoft.pat.Regex (null, "").cloneFrom (this); -}); -Clazz.defineMethod (c$, "cloneFrom", -function (r) { -this.copyOutOf (r); -this.dontMatchInQuotes = r.dontMatchInQuotes; -this.esc = r.esc; -this.ignoreCase = r.ignoreCase; -this.gFlag = r.gFlag; -if (r.rep == null) { -this.rep = null; -} else { -this.rep = r.rep.clone (); -}this.thePattern = r.thePattern.clone ( new java.util.Hashtable ()); -this.minMatch = r.minMatch; -this.skipper = r.skipper; -return this; -}, "com.stevesoft.pat.Regex"); -Clazz.defineMethod (c$, "setDontMatchInQuotes", -function (b) { -this.dontMatchInQuotes = b; -}, "~B"); -Clazz.defineMethod (c$, "getDontMatchInQuotes", -function () { -return this.dontMatchInQuotes; -}); -Clazz.overrideMethod (c$, "setIgnoreCase", -function (b) { -this.ignoreCase = b; -}, "~B"); -Clazz.defineMethod (c$, "getIgnoreCase", -function () { -return this.ignoreCase; -}); -c$.setDefaultMFlag = Clazz.defineMethod (c$, "setDefaultMFlag", -function (mFlag) { -com.stevesoft.pat.Regex.defaultMFlag = mFlag; -}, "~B"); -c$.getDefaultMFlag = Clazz.defineMethod (c$, "getDefaultMFlag", -function () { -return com.stevesoft.pat.Regex.defaultMFlag; -}); -Clazz.defineMethod (c$, "setReplaceRuleStr", -function (rp) { -this.rep = com.stevesoft.pat.ReplaceRule.perlCode (rp); -this.repr = null; -}, "~S"); -Clazz.defineMethod (c$, "setReplaceRule", -function (rp) { -this.rep = rp; -}, "com.stevesoft.pat.ReplaceRule"); -c$.isDefined = Clazz.defineMethod (c$, "isDefined", -function (nm) { -return com.stevesoft.pat.Regex.validators.get (nm) != null; -}, "~S"); -c$.undefine = Clazz.defineMethod (c$, "undefine", -function (nm) { -com.stevesoft.pat.Regex.validators.remove (nm); -}, "~S"); -c$.defineV = Clazz.defineMethod (c$, "defineV", -function (nm, pat, v) { -v.pattern = pat; -com.stevesoft.pat.Regex.validators.put (nm, v); -}, "~S,~S,com.stevesoft.pat.Validator"); -c$.define = Clazz.defineMethod (c$, "define", -function (nm, pat) { -com.stevesoft.pat.Regex.validators.put (nm, pat); -}, "~S,~S"); -Clazz.defineMethod (c$, "getReplaceRule", -function () { -return this.rep; -}); -Clazz.defineMethod (c$, "_getReplacer", -function () { -return this.repr == null ? this.repr = new com.stevesoft.pat.Replacer () : this.repr; -}); -Clazz.defineMethod (c$, "getReplacer", -function () { -if (this.repr == null) { -this.repr = new com.stevesoft.pat.Replacer (); -}this.repr.rh.me = this; -this.repr.rh.prev = null; -return this.repr; -}); -Clazz.defineMethod (c$, "replaceFirst", -function (s) { -return this._getReplacer ().replaceFirstRegion (s, this, 0, s.length).toString (); -}, "~S"); -Clazz.defineMethod (c$, "replaceFirstFrom", -function (s, pos) { -return this._getReplacer ().replaceFirstRegion (s, this, pos, s.length).toString (); -}, "~S,~N"); -Clazz.defineMethod (c$, "replaceFirstRegion", -function (s, start, end) { -return this._getReplacer ().replaceFirstRegion (s, this, start, end).toString (); -}, "~S,~N,~N"); -Clazz.overrideMethod (c$, "replaceAll", -function (s) { -return this._getReplacer ().replaceAllRegion (s, this, 0, s.length).toString (); -}, "~S"); -Clazz.defineMethod (c$, "replaceAllLike", -function (s) { -return this._getReplacer ().replaceAllRegion (s, this, 0, s.length ()); -}, "com.stevesoft.pat.StringLike"); -Clazz.defineMethod (c$, "replaceAllFrom", -function (s, pos) { -return this._getReplacer ().replaceAllRegion (s, this, pos, s.length).toString (); -}, "~S,~N"); -Clazz.defineMethod (c$, "replaceAllRegion", -function (s, start, end) { -return this._getReplacer ().replaceAllRegion (s, this, start, end).toString (); -}, "~S,~N,~N"); -Clazz.defineMethod (c$, "compile", -function (prepat) { -var postpat = com.stevesoft.pat.parsePerl.codify (prepat, true); -var pat = postpat == null ? prepat : postpat; -this.minMatch = null; -this.ignoreCase = false; -this.dontMatchInQuotes = false; -var mk = new com.stevesoft.pat.Rthings (this); -var offset = mk.val; -var newpat = pat; -this.thePattern = com.stevesoft.pat.Regex.none; -this.p = null; -this.or = null; -this.minMatch = new com.stevesoft.pat.patInt (0); -var sp = new com.stevesoft.pat.StrPos (pat, 0); -if (sp.incMatch ("(?e=")) { -var newEsc = sp.c; -sp.inc (); -if (sp.match (')')) { -newpat = com.stevesoft.pat.Regex.reEscape (pat.substring (6), newEsc, '\\'); -}} else if (this.esc != '\\') { -newpat = com.stevesoft.pat.Regex.reEscape (pat, this.esc, '\\'); -}this.thePattern = this._compile (newpat, mk); -this.numSubs_ = mk.val - offset; -mk.set (this); -}, "~S"); -Clazz.defineMethod (c$, "equals", -function (o) { -if (Clazz.instanceOf (o, com.stevesoft.pat.Regex)) { -if (this.toString ().equals (o.toString ())) { -return Clazz.superCall (this, com.stevesoft.pat.Regex, "equals", [o]); -} else { -return false; -}} else { -return Clazz.superCall (this, com.stevesoft.pat.Regex, "equals", [o]); -}}, "~O"); -Clazz.defineMethod (c$, "prep", -function (s) { -this.pt.lastPos = this.matchedTo (); -if (this.pt.lastPos < 0) { -this.pt.lastPos = 0; -}if ((s == null ? null : s.unwrap ()) !== (this.src == null ? null : s.unwrap ())) { -this.pt.lastPos = 0; -}this.src = s; -this.pt.dotDoesntMatchCR = com.stevesoft.pat.Regex.dotDoesntMatchCR && (!this.sFlag); -this.pt.mFlag = ( new Boolean (this.mFlag | com.stevesoft.pat.Regex.defaultMFlag).valueOf ()); -this.pt.ignoreCase = this.ignoreCase; -this.pt.no_check = false; -if (this.pt.marks != null) { -for (var i = 0; i < this.pt.marks.length; i++) { -this.pt.marks[i] = -1; -} -}this.pt.marks = null; -this.pt.nMarks = this.numSubs_; -this.pt.src = s; -if (this.dontMatchInQuotes) { -com.stevesoft.pat.Regex.setCbits (s, this.pt); -} else { -this.pt.cbits = null; -}return this.pt; -}, "com.stevesoft.pat.StringLike"); -Clazz.defineMethod (c$, "matchAt", -function (s, start_pos) { -return this._search (s, start_pos, start_pos); -}, "~S,~N"); -Clazz.defineMethod (c$, "matchAtLike", -function (s, start_pos) { -return this._searchLike (s, start_pos, start_pos); -}, "com.stevesoft.pat.StringLike,~N"); -Clazz.overrideMethod (c$, "search", -function (s) { -if (s == null) { -throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_given_to_regex_search")); -}return this._search (s, 0, s.length); -}, "~S"); -Clazz.defineMethod (c$, "searchLike", -function (sl) { -if (sl == null) { -throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search")); -}return this._searchLike (sl, 0, sl.length ()); -}, "com.stevesoft.pat.StringLike"); -Clazz.defineMethod (c$, "reverseSearch", -function (s) { -if (s == null) { -throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_given_to_regex_reverse_search")); -}return this._reverseSearch (s, 0, s.length); -}, "~S"); -Clazz.defineMethod (c$, "reverseSearchLike", -function (sl) { -if (sl == null) { -throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_reverse_search")); -}return this._reverseSearchLike (sl, 0, sl.length ()); -}, "com.stevesoft.pat.StringLike"); -Clazz.overrideMethod (c$, "searchFrom", -function (s, start) { -if (s == null) { -throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search_from")); -}return this._search (s, start, s.length); -}, "~S,~N"); -Clazz.defineMethod (c$, "searchFromLike", -function (s, start) { -if (s == null) { -throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search_from")); -}return this._searchLike (s, start, s.length ()); -}, "com.stevesoft.pat.StringLike,~N"); -Clazz.defineMethod (c$, "searchRegion", -function (s, start, end) { -if (s == null) { -throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search_region")); -}return this._search (s, start, end); -}, "~S,~N,~N"); -Clazz.defineMethod (c$, "setGFlag", -function (b) { -this.gFlag = b; -}, "~B"); -Clazz.defineMethod (c$, "getGFlag", -function () { -return this.gFlag; -}); -Clazz.defineMethod (c$, "getSFlag", -function () { -return this.sFlag; -}); -Clazz.defineMethod (c$, "getMFlag", -function () { -return this.mFlag; -}); -Clazz.defineMethod (c$, "_search", -function (s, start, end) { -return this._searchLike ( new com.stevesoft.pat.wrap.StringWrap (s), start, end); -}, "~S,~N,~N"); -Clazz.defineMethod (c$, "_searchLike", -function (s, start, end) { -if (this.gFlag && this.gFlagto > 0 && this.gFlags != null && s.unwrap () === this.gFlags.unwrap ()) { -start = this.gFlagto; -}this.gFlags = null; -var pt = this.prep (s); -var up = (this.minMatch == null ? end : end - this.minMatch.i); -if (up < start && end >= start) { -up = start; -}if (this.skipper == null) { -for (var i = start; i <= up; i++) { -this.charsMatched_ = this.thePattern.matchAt (s, i, pt); -if (this.charsMatched_ >= 0) { -this.matchFrom_ = this.thePattern.mfrom; -this.marks = pt.marks; -this.gFlagto = this.matchFrom_ + this.charsMatched_; -this.gFlags = s; -return this.didMatch_ = true; -}} -} else { -pt.no_check = true; -for (var i = start; i <= up; i++) { -i = this.skipper.find (this.src, i, up); -if (i < 0) { -this.charsMatched_ = this.matchFrom_ = -1; -return this.didMatch_ = false; -}this.charsMatched_ = this.thePattern.matchAt (s, i, pt); -if (this.charsMatched_ >= 0) { -this.matchFrom_ = this.thePattern.mfrom; -this.marks = pt.marks; -this.gFlagto = this.matchFrom_ + this.charsMatched_; -this.gFlags = s; -return this.didMatch_ = true; -}} -}return this.didMatch_ = false; -}, "com.stevesoft.pat.StringLike,~N,~N"); -Clazz.defineMethod (c$, "_reverseSearch", -function (s, start, end) { -return this._reverseSearchLike ( new com.stevesoft.pat.wrap.StringWrap (s), start, end); -}, "~S,~N,~N"); -Clazz.defineMethod (c$, "_reverseSearchLike", -function (s, start, end) { -if (this.gFlag && this.gFlagto > 0 && s.unwrap () === this.gFlags.unwrap ()) { -end = this.gFlagto; -}this.gFlags = null; -var pt = this.prep (s); -for (var i = end; i >= start; i--) { -this.charsMatched_ = this.thePattern.matchAt (s, i, pt); -if (this.charsMatched_ >= 0) { -this.matchFrom_ = this.thePattern.mfrom; -this.marks = pt.marks; -this.gFlagto = this.matchFrom_ - 1; -this.gFlags = s; -return this.didMatch_ = true; -}} -return this.didMatch_ = false; -}, "com.stevesoft.pat.StringLike,~N,~N"); -c$.setCbits = Clazz.defineMethod (c$, "setCbits", -function (s, pt) { -if (s === com.stevesoft.pat.Regex.lasts) { -pt.cbits = com.stevesoft.pat.Regex.lastbs; -return; -}var bs = new java.util.BitSet (s.length ()); -var qc = ' '; -var setBit = false; -for (var i = 0; i < s.length (); i++) { -if (setBit) { -bs.set (i); -}var c = s.charAt (i); -if (!setBit && c == '"') { -qc = c; -setBit = true; -bs.set (i); -} else if (!setBit && c == '\'') { -qc = c; -setBit = true; -bs.set (i); -} else if (setBit && c == qc) { -setBit = false; -} else if (setBit && c == '\\' && i + 1 < s.length ()) { -i++; -if (setBit) { -bs.set (i); -}}} -pt.cbits = com.stevesoft.pat.Regex.lastbs = bs; -com.stevesoft.pat.Regex.lasts = s; -}, "com.stevesoft.pat.StringLike,com.stevesoft.pat.Pthings"); -Clazz.defineMethod (c$, "add", -function (p2) { -if (this.p == null) { -this.p = p2; -} else { -this.p.add (p2); -p2 = this.p; -}}, "com.stevesoft.pat.Pattern"); -Clazz.defineMethod (c$, "compileSP", -function (sp, mk) { -if (sp.match ('[')) { -sp.inc (); -this.add (this.matchBracket (sp)); -} else if (sp.match ('|')) { -if (this.or == null) { -this.or = new com.stevesoft.pat.Or (); -}if (this.p == null) { -this.p = new com.stevesoft.pat.NullPattern (); -}this.or.addOr (this.p); -this.p = null; -} else if (sp.incMatch ("(?<")) { -var i = sp.getPatInt (); -if (i == null) { -com.stevesoft.pat.RegSyntaxError.endItAll ("No int after (?<"); -}this.add ( new com.stevesoft.pat.Backup (i.intValue ())); -if (!sp.match (')')) { -com.stevesoft.pat.RegSyntaxError.endItAll ("No ) after (?<"); -}} else if (sp.incMatch ("(?>")) { -var i = sp.getPatInt (); -if (i == null) { -com.stevesoft.pat.RegSyntaxError.endItAll ("No int after (?>"); -}this.add ( new com.stevesoft.pat.Backup (-i.intValue ())); -if (!sp.match (')')) { -com.stevesoft.pat.RegSyntaxError.endItAll ("No ) after (?<"); -}} else if (sp.incMatch ("(?@")) { -var op = sp.c; -sp.inc (); -var cl = sp.c; -sp.inc (); -if (!sp.match (')')) { -com.stevesoft.pat.RegSyntaxError.endItAll ("(?@ does not have closing paren"); -}this.add ( new com.stevesoft.pat.Group (op, cl)); -} else if (sp.incMatch ("(?#")) { -while (!sp.match (')')) { -sp.inc (); -} -} else if (sp.dontMatch && sp.c == 'w') { -var b = new com.stevesoft.pat.Bracket (false); -b.addOr ( new com.stevesoft.pat.Range ('a', 'z')); -b.addOr ( new com.stevesoft.pat.Range ('A', 'Z')); -b.addOr ( new com.stevesoft.pat.Range ('0', '9')); -b.addOr ( new com.stevesoft.pat.oneChar ('_')); -this.add (b); -} else if (sp.dontMatch && sp.c == 'G') { -this.add ( new com.stevesoft.pat.BackG ()); -} else if (sp.dontMatch && sp.c == 's') { -var b = new com.stevesoft.pat.Bracket (false); -b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (32))); -b.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (8), String.fromCharCode (10))); -b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (13))); -this.add (b); -} else if (sp.dontMatch && sp.c == 'd') { -var digit = new com.stevesoft.pat.Range ('0', '9'); -digit.printBrackets = true; -this.add (digit); -} else if (sp.dontMatch && sp.c == 'W') { -var b = new com.stevesoft.pat.Bracket (true); -b.addOr ( new com.stevesoft.pat.Range ('a', 'z')); -b.addOr ( new com.stevesoft.pat.Range ('A', 'Z')); -b.addOr ( new com.stevesoft.pat.Range ('0', '9')); -b.addOr ( new com.stevesoft.pat.oneChar ('_')); -this.add (b); -} else if (sp.dontMatch && sp.c == 'S') { -var b = new com.stevesoft.pat.Bracket (true); -b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (32))); -b.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (8), String.fromCharCode (10))); -b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (13))); -this.add (b); -} else if (sp.dontMatch && sp.c == 'D') { -var b = new com.stevesoft.pat.Bracket (true); -b.addOr ( new com.stevesoft.pat.Range ('0', '9')); -this.add (b); -} else if (sp.dontMatch && sp.c == 'B') { -var r = new com.stevesoft.pat.Regex (null, ""); -r._compile ("(?!\\b)", mk); -this.add (r.thePattern); -} else if (this.isOctalString (sp)) { -var d = sp.c.charCodeAt (0) - 48; -sp.inc (); -d = 8 * d + sp.c.charCodeAt (0) - 48; -var sp2 = new com.stevesoft.pat.StrPos (sp); -sp2.inc (); -if (this.isOctalDigit (sp2, false)) { -sp.inc (); -d = 8 * d + sp.c.charCodeAt (0) - 48; -}this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (d))); -} else if (sp.dontMatch && sp.c >= '1' && sp.c <= '9') { -var iv = sp.c.charCodeAt (0) - 48; -var s2 = new com.stevesoft.pat.StrPos (sp); -s2.inc (); -if (!s2.dontMatch && s2.c >= '0' && s2.c <= '9') { -iv = 10 * iv + (s2.c.charCodeAt (0) - 48); -sp.inc (); -}this.add ( new com.stevesoft.pat.BackMatch (iv)); -} else if (sp.dontMatch && sp.c == 'b') { -this.add ( new com.stevesoft.pat.Boundary ()); -} else if (sp.match ('\b')) { -this.add ( new com.stevesoft.pat.Boundary ()); -} else if (sp.match ('$')) { -this.add ( new com.stevesoft.pat.End (true)); -} else if (sp.dontMatch && sp.c == 'Z') { -this.add ( new com.stevesoft.pat.End (false)); -} else if (sp.match ('.')) { -this.add ( new com.stevesoft.pat.Any ()); -} else if (sp.incMatch ("(??")) { -var sb = new StringBuffer (); -var sb2 = new StringBuffer (); -while (!sp.match (')') && !sp.match (':')) { -sb.append (sp.c); -sp.inc (); -} -if (sp.incMatch (":")) { -while (!sp.match (')')) { -sb2.append (sp.c); -sp.inc (); -} -}var sbs = sb.toString (); -if (Clazz.instanceOf (com.stevesoft.pat.Regex.validators.get (sbs), String)) { -var pat = com.stevesoft.pat.Regex.validators.get (sbs); -var r = new com.stevesoft.pat.Regex (null, ""); -var rth = new com.stevesoft.pat.Rthings (this); -rth.noBackRefs = true; -r._compile (pat, rth); -this.add (r.thePattern); -} else { -var cm = new com.stevesoft.pat.Custom (sb.toString ()); -if (cm.v != null) { -var v2 = cm.v.arg (sb2.toString ()); -if (v2 != null) { -v2.argsave = sb2.toString (); -var p = cm.v.pattern; -cm.v = v2; -v2.pattern = p; -}var r = new com.stevesoft.pat.Regex (null, ""); -var rth = new com.stevesoft.pat.Rthings (this); -rth.noBackRefs = true; -r._compile (cm.v.pattern, rth); -cm.sub = r.thePattern; -cm.sub.add ( new com.stevesoft.pat.CustomEndpoint (cm)); -cm.sub.setParent (cm); -this.add (cm); -}}} else if (sp.match ('(')) { -mk.parenLevel++; -var r = new com.stevesoft.pat.Regex (null, ""); -sp.inc (); -if (sp.incMatch ("?:")) { -r.or = new com.stevesoft.pat.Or (); -} else if (sp.incMatch ("?=")) { -r.or = new com.stevesoft.pat.lookAhead (false); -} else if (sp.incMatch ("?!")) { -r.or = new com.stevesoft.pat.lookAhead (true); -} else if (sp.match ('?')) { -sp.inc (); -do { -if (sp.c == 'i') { -mk.ignoreCase = true; -}if (sp.c == 'Q') { -mk.dontMatchInQuotes = true; -}if (sp.c == 'o') { -mk.optimizeMe = true; -}if (sp.c == 'g') { -mk.gFlag = true; -}if (sp.c == 's') { -mk.sFlag = true; -}if (sp.c == 'm') { -mk.mFlag = true; -}sp.inc (); -} while (!sp.match (')') && !sp.$eos); -r = null; -mk.parenLevel--; -if (sp.$eos) { -com.stevesoft.pat.RegSyntaxError.endItAll ("Unclosed ()"); -}} else { -r.or = mk.noBackRefs ? new com.stevesoft.pat.Or () : new com.stevesoft.pat.OrMark (mk.val++); -}if (r != null) { -this.add (r._compileSP (sp, mk)); -}} else if (sp.match ('^')) { -this.add ( new com.stevesoft.pat.Start (true)); -} else if (sp.dontMatch && sp.c == 'A') { -this.add ( new com.stevesoft.pat.Start (false)); -} else if (sp.match ('*')) { -this.addMulti ( new com.stevesoft.pat.patInt (0), new com.stevesoft.pat.patInf ()); -} else if (sp.match ('+')) { -this.addMulti ( new com.stevesoft.pat.patInt (1), new com.stevesoft.pat.patInf ()); -} else if (sp.match ('?')) { -this.addMulti ( new com.stevesoft.pat.patInt (0), new com.stevesoft.pat.patInt (1)); -} else if (sp.match ('{')) { -var bad = false; -var sp2 = new com.stevesoft.pat.StrPos (sp); -sp.inc (); -var i1 = sp.getPatInt (); -var i2 = null; -if (sp.match ('}')) { -i2 = i1; -} else { -if (!sp.match (',')) { -bad = true; -}sp.inc (); -if (sp.match ('}')) { -i2 = new com.stevesoft.pat.patInf (); -} else { -i2 = sp.getPatInt (); -}}if (i1 == null || i2 == null) { -bad = true; -}if (bad) { -sp.dup (sp2); -this.add ( new com.stevesoft.pat.oneChar (sp.c)); -} else { -this.addMulti (i1, i2); -}} else if (sp.escMatch ('x') && this.next2Hex (sp)) { -sp.inc (); -var d = this.getHexDigit (sp); -sp.inc (); -d = 16 * d + this.getHexDigit (sp); -this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (d))); -} else if (sp.escMatch ('c')) { -sp.inc (); -if (sp.c.charCodeAt (0) < com.stevesoft.pat.Ctrl.cmap.length) { -this.add ( new com.stevesoft.pat.oneChar (com.stevesoft.pat.Ctrl.cmap[sp.c.charCodeAt (0)])); -} else { -this.add ( new com.stevesoft.pat.oneChar (sp.c)); -}} else if (sp.escMatch ('f')) { -this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (12))); -} else if (sp.escMatch ('a')) { -this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (7))); -} else if (sp.escMatch ('t')) { -this.add ( new com.stevesoft.pat.oneChar ('\t')); -} else if (sp.escMatch ('n')) { -this.add ( new com.stevesoft.pat.oneChar ('\n')); -} else if (sp.escMatch ('r')) { -this.add ( new com.stevesoft.pat.oneChar ('\r')); -} else if (sp.escMatch ('b')) { -this.add ( new com.stevesoft.pat.oneChar ('\b')); -} else if (sp.escMatch ('e')) { -this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (27))); -} else { -this.add ( new com.stevesoft.pat.oneChar (sp.c)); -if (sp.match (')')) { -com.stevesoft.pat.RegSyntaxError.endItAll ("Unmatched right paren in pattern"); -}}}, "com.stevesoft.pat.StrPos,com.stevesoft.pat.Rthings"); -Clazz.defineMethod (c$, "_compile", -($fz = function (pat, mk) { -this.minMatch = null; -this.sFlag = this.mFlag = this.ignoreCase = this.gFlag = false; -var sp = new com.stevesoft.pat.StrPos (pat, 0); -this.thePattern = this._compileSP (sp, mk); -this.pt.marks = null; -return this.thePattern; -}, $fz.isPrivate = true, $fz), "~S,com.stevesoft.pat.Rthings"); -Clazz.defineMethod (c$, "_compileSP", -function (sp, mk) { -while (!(sp.$eos || (this.or != null && sp.match (')')))) { -this.compileSP (sp, mk); -sp.inc (); -} -if (sp.match (')')) { -mk.parenLevel--; -} else if (sp.$eos && mk.parenLevel != 0) { -com.stevesoft.pat.RegSyntaxError.endItAll ("Unclosed Parenthesis! lvl=" + mk.parenLevel); -}if (this.or != null) { -if (this.p == null) { -this.p = new com.stevesoft.pat.NullPattern (); -}this.or.addOr (this.p); -return this.or; -}return this.p == null ? new com.stevesoft.pat.NullPattern () : this.p; -}, "com.stevesoft.pat.StrPos,com.stevesoft.pat.Rthings"); -Clazz.defineMethod (c$, "addMulti", -function (i1, i2) { -var last; -var last2; -for (last = this.p; last != null && last.next != null; last = last.next) { -;} -if (last == null || last === this.p) { -last2 = null; -} else { -for (last2 = this.p; last2.next !== last; last2 = last2.next) { -;} -}if (Clazz.instanceOf (last, com.stevesoft.pat.Multi) && i1.intValue () == 0 && i2.intValue () == 1) { -(last).matchFewest = true; -} else if (Clazz.instanceOf (last, com.stevesoft.pat.FastMulti) && i1.intValue () == 0 && i2.intValue () == 1) { -(last).matchFewest = true; -} else if (Clazz.instanceOf (last, com.stevesoft.pat.DotMulti) && i1.intValue () == 0 && i2.intValue () == 1) { -(last).matchFewest = true; -} else if (Clazz.instanceOf (last, com.stevesoft.pat.Multi) || Clazz.instanceOf (last, com.stevesoft.pat.DotMulti) || Clazz.instanceOf (last, com.stevesoft.pat.FastMulti)) { -throw new com.stevesoft.pat.RegSyntax ("Syntax error."); -} else if (last2 == null) { -this.p = com.stevesoft.pat.Regex.mkMulti (i1, i2, this.p); -} else { -last2.next = com.stevesoft.pat.Regex.mkMulti (i1, i2, last); -}}, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt"); -c$.mkMulti = Clazz.defineMethod (c$, "mkMulti", -function (lo, hi, p) { -if (Clazz.instanceOf (p, com.stevesoft.pat.Any) && p.next == null) { -return new com.stevesoft.pat.DotMulti (lo, hi); -}return com.stevesoft.pat.RegOpt.safe4fm (p) ? new com.stevesoft.pat.FastMulti (lo, hi, p) : new com.stevesoft.pat.Multi (lo, hi, p); -}, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt,com.stevesoft.pat.Pattern"); -Clazz.defineMethod (c$, "matchBracket", -function (sp) { -var ret; -if (sp.match ('^')) { -ret = new com.stevesoft.pat.Bracket (true); -sp.inc (); -} else { -ret = new com.stevesoft.pat.Bracket (false); -}if (sp.match (']')) { -com.stevesoft.pat.RegSyntaxError.endItAll ("Unmatched []"); -}while (!sp.$eos && !sp.match (']')) { -var s1 = new com.stevesoft.pat.StrPos (sp); -s1.inc (); -var s1_ = new com.stevesoft.pat.StrPos (s1); -s1_.inc (); -if (s1.match ('-') && !s1_.match (']')) { -var s2 = new com.stevesoft.pat.StrPos (s1); -s2.inc (); -if (!s2.$eos) { -ret.addOr ( new com.stevesoft.pat.Range (sp.c, s2.c)); -}sp.inc (); -sp.inc (); -} else if (sp.escMatch ('Q')) { -sp.inc (); -while (!sp.escMatch ('E')) { -ret.addOr ( new com.stevesoft.pat.oneChar (sp.c)); -sp.inc (); -} -} else if (sp.escMatch ('d')) { -ret.addOr ( new com.stevesoft.pat.Range ('0', '9')); -} else if (sp.escMatch ('s')) { -ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (32))); -ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (8), String.fromCharCode (10))); -ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (13))); -} else if (sp.escMatch ('w')) { -ret.addOr ( new com.stevesoft.pat.Range ('a', 'z')); -ret.addOr ( new com.stevesoft.pat.Range ('A', 'Z')); -ret.addOr ( new com.stevesoft.pat.Range ('0', '9')); -ret.addOr ( new com.stevesoft.pat.oneChar ('_')); -} else if (sp.escMatch ('D')) { -ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (0), String.fromCharCode (47))); -ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (58), String.fromCharCode (65535))); -} else if (sp.escMatch ('S')) { -ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (0), String.fromCharCode (7))); -ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (11), String.fromCharCode (12))); -ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (14), String.fromCharCode (31))); -ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (33), String.fromCharCode (65535))); -} else if (sp.escMatch ('W')) { -ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (0), String.fromCharCode (64))); -ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (91), String.fromCharCode (94))); -ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (96))); -ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (123), String.fromCharCode (65535))); -} else if (sp.escMatch ('x') && this.next2Hex (sp)) { -sp.inc (); -var d = this.getHexDigit (sp); -sp.inc (); -d = 16 * d + this.getHexDigit (sp); -ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (d))); -} else if (sp.escMatch ('a')) { -ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (7))); -} else if (sp.escMatch ('f')) { -ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (12))); -} else if (sp.escMatch ('e')) { -ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (27))); -} else if (sp.escMatch ('n')) { -ret.addOr ( new com.stevesoft.pat.oneChar ('\n')); -} else if (sp.escMatch ('t')) { -ret.addOr ( new com.stevesoft.pat.oneChar ('\t')); -} else if (sp.escMatch ('r')) { -ret.addOr ( new com.stevesoft.pat.oneChar ('\r')); -} else if (sp.escMatch ('c')) { -sp.inc (); -if (sp.c.charCodeAt (0) < com.stevesoft.pat.Ctrl.cmap.length) { -ret.addOr ( new com.stevesoft.pat.oneChar (com.stevesoft.pat.Ctrl.cmap[sp.c.charCodeAt (0)])); -} else { -ret.addOr ( new com.stevesoft.pat.oneChar (sp.c)); -}} else if (this.isOctalString (sp)) { -var d = sp.c.charCodeAt (0) - 48; -sp.inc (); -d = 8 * d + sp.c.charCodeAt (0) - 48; -var sp2 = new com.stevesoft.pat.StrPos (sp); -sp2.inc (); -if (this.isOctalDigit (sp2, false)) { -sp.inc (); -d = 8 * d + sp.c.charCodeAt (0) - 48; -}ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (d))); -} else { -ret.addOr ( new com.stevesoft.pat.oneChar (sp.c)); -}sp.inc (); -} -return ret; -}, "com.stevesoft.pat.StrPos"); -Clazz.overrideMethod (c$, "toString", -function () { -{ -var sb = new StringBuffer (); -if (this.esc != '\\') { -sb.append ("(?e="); -sb.append (this.esc); -sb.append (")"); -}if (this.gFlag || this.mFlag || !com.stevesoft.pat.Regex.dotDoesntMatchCR || this.sFlag || this.ignoreCase || this.dontMatchInQuotes || this.optimized ()) { -sb.append ("(?"); -if (this.ignoreCase) { -sb.append ("i"); -}if (this.mFlag) { -sb.append ("m"); -}if (this.sFlag || !com.stevesoft.pat.Regex.dotDoesntMatchCR) { -sb.append ("s"); -}if (this.dontMatchInQuotes) { -sb.append ("Q"); -}if (this.optimized ()) { -sb.append ("o"); -}if (this.gFlag) { -sb.append ("g"); -}sb.append (")"); -}var patstr = this.thePattern.toString (); -if (this.esc != '\\') { -patstr = com.stevesoft.pat.Regex.reEscape (patstr, '\\', this.esc); -}sb.append (patstr); -return sb.toString (); -}}); -c$.reEscape = Clazz.defineMethod (c$, "reEscape", -function (s, oldEsc, newEsc) { -if (oldEsc == newEsc) { -return s; -}var i; -var sb = new StringBuffer (); -for (i = 0; i < s.length; i++) { -if (s.charAt (i) == oldEsc && i + 1 < s.length) { -if (s.charAt (i + 1) == oldEsc) { -sb.append (oldEsc); -} else { -sb.append (newEsc); -sb.append (s.charAt (i + 1)); -}i++; -} else if (s.charAt (i) == newEsc) { -sb.append (newEsc); -sb.append (newEsc); -} else { -sb.append (s.charAt (i)); -}} -return sb.toString (); -}, "~S,~S,~S"); -Clazz.defineMethod (c$, "accept", -function (dir, s) { -return this.search (s); -}, "java.io.File,~S"); -c$.version = Clazz.defineMethod (c$, "version", -function () { -return "lgpl release 1.5.3"; -}); -Clazz.defineMethod (c$, "optimize", -function () { -if (this.optimized () || this.thePattern == null) { -return; -}this.minMatch = new com.stevesoft.pat.patInt (0); -this.thePattern = com.stevesoft.pat.RegOpt.opt (this.thePattern, this.ignoreCase, this.dontMatchInQuotes); -this.skipper = com.stevesoft.pat.Skip.findSkipRegex (this); -return; -}); -Clazz.defineMethod (c$, "optimized", -function () { -return this.minMatch != null; -}); -c$.perlCode = Clazz.defineMethod (c$, "perlCode", -function (s) { -return com.stevesoft.pat.parsePerl.parse (s); -}, "~S"); -Clazz.defineMethod (c$, "isLiteral", -function () { -var x = this.thePattern; -while (x != null) { -if (Clazz.instanceOf (x, com.stevesoft.pat.oneChar)) { -;} else if (Clazz.instanceOf (x, com.stevesoft.pat.Skipped)) { -;} else { -return false; -}x = x.next; -} -return true; -}); -Clazz.defineMethod (c$, "countMinChars", -function () { -return this.thePattern.countMinChars (); -}); -Clazz.defineMethod (c$, "countMaxChars", -function () { -return this.thePattern.countMaxChars (); -}); -Clazz.defineMethod (c$, "isHexDigit", -function (sp) { -var r = !sp.$eos && !sp.dontMatch && ((sp.c >= '0' && sp.c <= '9') || (sp.c >= 'a' && sp.c <= 'f') || (sp.c >= 'A' && sp.c <= 'F')); -return r; -}, "com.stevesoft.pat.StrPos"); -Clazz.defineMethod (c$, "isOctalDigit", -function (sp, first) { -var r = !sp.$eos && !( new Boolean (first ^ sp.dontMatch).valueOf ()) && sp.c >= '0' && sp.c <= '7'; -return r; -}, "com.stevesoft.pat.StrPos,~B"); -Clazz.defineMethod (c$, "getHexDigit", -function (sp) { -if (sp.c >= '0' && sp.c <= '9') { -return sp.c.charCodeAt (0) - 48; -}if (sp.c >= 'a' && sp.c <= 'f') { -return sp.c.charCodeAt (0) - 97 + 10; -}return sp.c.charCodeAt (0) - 65 + 10; -}, "com.stevesoft.pat.StrPos"); -Clazz.defineMethod (c$, "next2Hex", -function (sp) { -var sp2 = new com.stevesoft.pat.StrPos (sp); -sp2.inc (); -if (!this.isHexDigit (sp2)) { -return false; -}sp2.inc (); -if (!this.isHexDigit (sp2)) { -return false; -}return true; -}, "com.stevesoft.pat.StrPos"); -Clazz.defineMethod (c$, "isOctalString", -function (sp) { -if (!this.isOctalDigit (sp, true)) { -return false; -}var sp2 = new com.stevesoft.pat.StrPos (sp); -sp2.inc (); -if (!this.isOctalDigit (sp2, false)) { -return false; -}return true; -}, "com.stevesoft.pat.StrPos"); -Clazz.defineStatics (c$, -"BackRefOffset", 1); -c$.none = c$.prototype.none = new com.stevesoft.pat.NoPattern (); -c$.validators = c$.prototype.validators = new java.util.Hashtable (); -{ -com.stevesoft.pat.Regex.defineV ("p", "(?>1)", new com.stevesoft.pat.UnicodePunct ()); -com.stevesoft.pat.Regex.defineV ("P", "(?>1)", new com.stevesoft.pat.NUnicodePunct ()); -com.stevesoft.pat.Regex.defineV ("s", "(?>1)", new com.stevesoft.pat.UnicodeWhite ()); -com.stevesoft.pat.Regex.defineV ("S", "(?>1)", new com.stevesoft.pat.NUnicodeWhite ()); -com.stevesoft.pat.Regex.defineV ("w", "(?>1)", new com.stevesoft.pat.UnicodeW ()); -com.stevesoft.pat.Regex.defineV ("W", "(?>1)", new com.stevesoft.pat.NUnicodeW ()); -com.stevesoft.pat.Regex.defineV ("d", "(?>1)", new com.stevesoft.pat.UnicodeDigit ()); -com.stevesoft.pat.Regex.defineV ("D", "(?>1)", new com.stevesoft.pat.NUnicodeDigit ()); -com.stevesoft.pat.Regex.defineV ("m", "(?>1)", new com.stevesoft.pat.UnicodeMath ()); -com.stevesoft.pat.Regex.defineV ("M", "(?>1)", new com.stevesoft.pat.NUnicodeMath ()); -com.stevesoft.pat.Regex.defineV ("c", "(?>1)", new com.stevesoft.pat.UnicodeCurrency ()); -com.stevesoft.pat.Regex.defineV ("C", "(?>1)", new com.stevesoft.pat.NUnicodeCurrency ()); -com.stevesoft.pat.Regex.defineV ("a", "(?>1)", new com.stevesoft.pat.UnicodeAlpha ()); -com.stevesoft.pat.Regex.defineV ("A", "(?>1)", new com.stevesoft.pat.NUnicodeAlpha ()); -com.stevesoft.pat.Regex.defineV ("uc", "(?>1)", new com.stevesoft.pat.UnicodeUpper ()); -com.stevesoft.pat.Regex.defineV ("lc", "(?>1)", new com.stevesoft.pat.UnicodeLower ()); -}Clazz.defineStatics (c$, -"defaultMFlag", false, -"dotDoesntMatchCR", true, -"lasts", null, -"lastbs", null, -"back_slash", '\\'); -}); +Clazz.declarePackage ("com.stevesoft.pat"); +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 () { +c$ = Clazz.declareType (com.stevesoft.pat, "UnicodePunct", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +return from < s.length () && com.stevesoft.pat.Prop.isPunct (s.charAt (from)) ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeWhite", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +return from < s.length () && com.stevesoft.pat.Prop.isWhite (s.charAt (from)) ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodePunct", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +return from < s.length () && !com.stevesoft.pat.Prop.isPunct (s.charAt (from)) ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeWhite", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +return from < s.length () && !com.stevesoft.pat.Prop.isWhite (s.charAt (from)) ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeW", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +if (from >= s.length ()) { +return -1; +}var c = s.charAt (from); +return (com.stevesoft.pat.Prop.isAlphabetic (c) || com.stevesoft.pat.Prop.isDecimalDigit (c) || c == '_') ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeW", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +if (from >= s.length ()) { +return -1; +}var c = s.charAt (from); +return !(com.stevesoft.pat.Prop.isAlphabetic (c) || com.stevesoft.pat.Prop.isDecimalDigit (c) || c == '_') ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeDigit", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +return from < s.length () && com.stevesoft.pat.Prop.isDecimalDigit (s.charAt (from)) ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeDigit", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +return from < s.length () && !com.stevesoft.pat.Prop.isDecimalDigit (s.charAt (from)) ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeMath", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +return from < s.length () && com.stevesoft.pat.Prop.isMath (s.charAt (from)) ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeMath", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +return from < s.length () && !com.stevesoft.pat.Prop.isMath (s.charAt (from)) ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeCurrency", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +return from < s.length () && com.stevesoft.pat.Prop.isCurrency (s.charAt (from)) ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeCurrency", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +return from < s.length () && !com.stevesoft.pat.Prop.isCurrency (s.charAt (from)) ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeAlpha", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +return from < s.length () && com.stevesoft.pat.Prop.isAlphabetic (s.charAt (from)) ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$ = Clazz.declareType (com.stevesoft.pat, "NUnicodeAlpha", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +return from < s.length () && !com.stevesoft.pat.Prop.isAlphabetic (s.charAt (from)) ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeUpper", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +return from < s.length () && this.isUpper (s.charAt (from)) ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +Clazz.defineMethod (c$, "isUpper", +function (c) { +return c == com.stevesoft.pat.CaseMgr.toUpperCaseC (c) && c != com.stevesoft.pat.CaseMgr.toLowerCaseC (c); +}, "~S"); +c$ = Clazz.declareType (com.stevesoft.pat, "UnicodeLower", com.stevesoft.pat.UniValidator); +Clazz.overrideMethod (c$, "validate", +function (s, from, to) { +return from < s.length () && this.isLower (s.charAt (from)) ? to : -1; +}, "com.stevesoft.pat.StringLike,~N,~N"); +Clazz.defineMethod (c$, "isLower", +function (c) { +return c != com.stevesoft.pat.CaseMgr.toUpperCaseC (c) && c == com.stevesoft.pat.CaseMgr.toLowerCaseC (c); +}, "~S"); +c$ = Clazz.decorateAsClass (function () { +this.thePattern = null; +this.minMatch = null; +this.rep = null; +this.dontMatchInQuotes = false; +this.ignoreCase = false; +this.repr = null; +this.esc = '\\'; +this.pt = null; +this.gFlags = null; +this.gFlagto = 0; +this.gFlag = false; +this.sFlag = false; +this.mFlag = false; +this.p = null; +this.or = null; +this.skipper = null; +Clazz.instantialize (this, arguments); +}, com.stevesoft.pat, "Regex", com.stevesoft.pat.RegRes, [jalview.jsdev.api.RegExpInterface, Cloneable]); +Clazz.prepareFields (c$, function () { +this.thePattern = com.stevesoft.pat.Regex.none; +this.minMatch = new com.stevesoft.pat.patInt (0); +this.pt = new com.stevesoft.pat.Pthings (); +}); +Clazz.makeConstructor (c$, +function (s, strRp) { +Clazz.superConstructor (this, com.stevesoft.pat.Regex, []); +try { +if (s != null) this.compile (s); +if (strRp.length > 0) this.rep = com.stevesoft.pat.ReplaceRule.perlCode (strRp); +} catch (rs) { +if (Clazz.exceptionOf (rs, com.stevesoft.pat.RegSyntax)) { +} else { +throw rs; +} +} +}, "~S,~S"); +Clazz.overrideMethod (c$, "clone", +function () { +return new com.stevesoft.pat.Regex (null, "").cloneFrom (this); +}); +Clazz.defineMethod (c$, "cloneFrom", +function (r) { +this.copyOutOf (r); +this.dontMatchInQuotes = r.dontMatchInQuotes; +this.esc = r.esc; +this.ignoreCase = r.ignoreCase; +this.gFlag = r.gFlag; +if (r.rep == null) { +this.rep = null; +} else { +this.rep = r.rep.clone (); +}this.thePattern = r.thePattern.clone ( new java.util.Hashtable ()); +this.minMatch = r.minMatch; +this.skipper = r.skipper; +return this; +}, "com.stevesoft.pat.Regex"); +Clazz.defineMethod (c$, "setDontMatchInQuotes", +function (b) { +this.dontMatchInQuotes = b; +}, "~B"); +Clazz.defineMethod (c$, "getDontMatchInQuotes", +function () { +return this.dontMatchInQuotes; +}); +Clazz.overrideMethod (c$, "setIgnoreCase", +function (b) { +this.ignoreCase = b; +}, "~B"); +Clazz.defineMethod (c$, "getIgnoreCase", +function () { +return this.ignoreCase; +}); +c$.setDefaultMFlag = Clazz.defineMethod (c$, "setDefaultMFlag", +function (mFlag) { +com.stevesoft.pat.Regex.defaultMFlag = mFlag; +}, "~B"); +c$.getDefaultMFlag = Clazz.defineMethod (c$, "getDefaultMFlag", +function () { +return com.stevesoft.pat.Regex.defaultMFlag; +}); +Clazz.defineMethod (c$, "setReplaceRuleStr", +function (rp) { +this.rep = com.stevesoft.pat.ReplaceRule.perlCode (rp); +this.repr = null; +}, "~S"); +Clazz.defineMethod (c$, "setReplaceRule", +function (rp) { +this.rep = rp; +}, "com.stevesoft.pat.ReplaceRule"); +c$.isDefined = Clazz.defineMethod (c$, "isDefined", +function (nm) { +return com.stevesoft.pat.Regex.validators.get (nm) != null; +}, "~S"); +c$.undefine = Clazz.defineMethod (c$, "undefine", +function (nm) { +com.stevesoft.pat.Regex.validators.remove (nm); +}, "~S"); +c$.defineV = Clazz.defineMethod (c$, "defineV", +function (nm, pat, v) { +v.pattern = pat; +com.stevesoft.pat.Regex.validators.put (nm, v); +}, "~S,~S,com.stevesoft.pat.Validator"); +c$.define = Clazz.defineMethod (c$, "define", +function (nm, pat) { +com.stevesoft.pat.Regex.validators.put (nm, pat); +}, "~S,~S"); +Clazz.defineMethod (c$, "getReplaceRule", +function () { +return this.rep; +}); +Clazz.defineMethod (c$, "_getReplacer", +function () { +return this.repr == null ? this.repr = new com.stevesoft.pat.Replacer () : this.repr; +}); +Clazz.defineMethod (c$, "getReplacer", +function () { +if (this.repr == null) { +this.repr = new com.stevesoft.pat.Replacer (); +}this.repr.rh.me = this; +this.repr.rh.prev = null; +return this.repr; +}); +Clazz.defineMethod (c$, "replaceFirst", +function (s) { +return this._getReplacer ().replaceFirstRegion (s, this, 0, s.length).toString (); +}, "~S"); +Clazz.defineMethod (c$, "replaceFirstFrom", +function (s, pos) { +return this._getReplacer ().replaceFirstRegion (s, this, pos, s.length).toString (); +}, "~S,~N"); +Clazz.defineMethod (c$, "replaceFirstRegion", +function (s, start, end) { +return this._getReplacer ().replaceFirstRegion (s, this, start, end).toString (); +}, "~S,~N,~N"); +Clazz.overrideMethod (c$, "replaceAll", +function (s) { +return this._getReplacer ().replaceAllRegion (s, this, 0, s.length).toString (); +}, "~S"); +Clazz.defineMethod (c$, "replaceAllLike", +function (s) { +return this._getReplacer ().replaceAllRegion (s, this, 0, s.length ()); +}, "com.stevesoft.pat.StringLike"); +Clazz.defineMethod (c$, "replaceAllFrom", +function (s, pos) { +return this._getReplacer ().replaceAllRegion (s, this, pos, s.length).toString (); +}, "~S,~N"); +Clazz.defineMethod (c$, "replaceAllRegion", +function (s, start, end) { +return this._getReplacer ().replaceAllRegion (s, this, start, end).toString (); +}, "~S,~N,~N"); +Clazz.defineMethod (c$, "compile", +function (prepat) { +var postpat = com.stevesoft.pat.parsePerl.codify (prepat, true); +var pat = postpat == null ? prepat : postpat; +this.minMatch = null; +this.ignoreCase = false; +this.dontMatchInQuotes = false; +var mk = new com.stevesoft.pat.Rthings (this); +var offset = mk.val; +var newpat = pat; +this.thePattern = com.stevesoft.pat.Regex.none; +this.p = null; +this.or = null; +this.minMatch = new com.stevesoft.pat.patInt (0); +var sp = new com.stevesoft.pat.StrPos (pat, 0); +if (sp.incMatch ("(?e=")) { +var newEsc = sp.c; +sp.inc (); +if (sp.match (')')) { +newpat = com.stevesoft.pat.Regex.reEscape (pat.substring (6), newEsc, '\\'); +}} else if (this.esc != '\\') { +newpat = com.stevesoft.pat.Regex.reEscape (pat, this.esc, '\\'); +}this.thePattern = this._compile (newpat, mk); +this.numSubs_ = mk.val - offset; +mk.set (this); +}, "~S"); +Clazz.defineMethod (c$, "equals", +function (o) { +if (Clazz.instanceOf (o, com.stevesoft.pat.Regex)) { +if (this.toString ().equals (o.toString ())) { +return Clazz.superCall (this, com.stevesoft.pat.Regex, "equals", [o]); +} else { +return false; +}} else { +return Clazz.superCall (this, com.stevesoft.pat.Regex, "equals", [o]); +}}, "~O"); +Clazz.defineMethod (c$, "prep", +function (s) { +this.pt.lastPos = this.matchedTo (); +if (this.pt.lastPos < 0) { +this.pt.lastPos = 0; +}if ((s == null ? null : s.unwrap ()) !== (this.src == null ? null : s.unwrap ())) { +this.pt.lastPos = 0; +}this.src = s; +this.pt.dotDoesntMatchCR = com.stevesoft.pat.Regex.dotDoesntMatchCR && (!this.sFlag); +this.pt.mFlag = ( new Boolean (this.mFlag | com.stevesoft.pat.Regex.defaultMFlag).valueOf ()); +this.pt.ignoreCase = this.ignoreCase; +this.pt.no_check = false; +if (this.pt.marks != null) { +for (var i = 0; i < this.pt.marks.length; i++) { +this.pt.marks[i] = -1; +} +}this.pt.marks = null; +this.pt.nMarks = this.numSubs_; +this.pt.src = s; +if (this.dontMatchInQuotes) { +com.stevesoft.pat.Regex.setCbits (s, this.pt); +} else { +this.pt.cbits = null; +}return this.pt; +}, "com.stevesoft.pat.StringLike"); +Clazz.defineMethod (c$, "matchAt", +function (s, start_pos) { +return this._search (s, start_pos, start_pos); +}, "~S,~N"); +Clazz.defineMethod (c$, "matchAtLike", +function (s, start_pos) { +return this._searchLike (s, start_pos, start_pos); +}, "com.stevesoft.pat.StringLike,~N"); +Clazz.overrideMethod (c$, "search", +function (s) { +if (s == null) { +throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_given_to_regex_search")); +}return this._search (s, 0, s.length); +}, "~S"); +Clazz.defineMethod (c$, "searchLike", +function (sl) { +if (sl == null) { +throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search")); +}return this._searchLike (sl, 0, sl.length ()); +}, "com.stevesoft.pat.StringLike"); +Clazz.defineMethod (c$, "reverseSearch", +function (s) { +if (s == null) { +throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_given_to_regex_reverse_search")); +}return this._reverseSearch (s, 0, s.length); +}, "~S"); +Clazz.defineMethod (c$, "reverseSearchLike", +function (sl) { +if (sl == null) { +throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_reverse_search")); +}return this._reverseSearchLike (sl, 0, sl.length ()); +}, "com.stevesoft.pat.StringLike"); +Clazz.overrideMethod (c$, "searchFrom", +function (s, start) { +if (s == null) { +throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search_from")); +}return this._search (s, start, s.length); +}, "~S,~N"); +Clazz.defineMethod (c$, "searchFromLike", +function (s, start) { +if (s == null) { +throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search_from")); +}return this._searchLike (s, start, s.length ()); +}, "com.stevesoft.pat.StringLike,~N"); +Clazz.defineMethod (c$, "searchRegion", +function (s, start, end) { +if (s == null) { +throw new NullPointerException (com.stevesoft.pat.MessageManager.getString ("exception.null_string_like_given_to_regex_search_region")); +}return this._search (s, start, end); +}, "~S,~N,~N"); +Clazz.defineMethod (c$, "setGFlag", +function (b) { +this.gFlag = b; +}, "~B"); +Clazz.defineMethod (c$, "getGFlag", +function () { +return this.gFlag; +}); +Clazz.defineMethod (c$, "getSFlag", +function () { +return this.sFlag; +}); +Clazz.defineMethod (c$, "getMFlag", +function () { +return this.mFlag; +}); +Clazz.defineMethod (c$, "_search", +function (s, start, end) { +return this._searchLike ( new com.stevesoft.pat.wrap.StringWrap (s), start, end); +}, "~S,~N,~N"); +Clazz.defineMethod (c$, "_searchLike", +function (s, start, end) { +if (this.gFlag && this.gFlagto > 0 && this.gFlags != null && s.unwrap () === this.gFlags.unwrap ()) { +start = this.gFlagto; +}this.gFlags = null; +var pt = this.prep (s); +var up = (this.minMatch == null ? end : end - this.minMatch.i); +if (up < start && end >= start) { +up = start; +}if (this.skipper == null) { +for (var i = start; i <= up; i++) { +this.charsMatched_ = this.thePattern.matchAt (s, i, pt); +if (this.charsMatched_ >= 0) { +this.matchFrom_ = this.thePattern.mfrom; +this.marks = pt.marks; +this.gFlagto = this.matchFrom_ + this.charsMatched_; +this.gFlags = s; +return this.didMatch_ = true; +}} +} else { +pt.no_check = true; +for (var i = start; i <= up; i++) { +i = this.skipper.find (this.src, i, up); +if (i < 0) { +this.charsMatched_ = this.matchFrom_ = -1; +return this.didMatch_ = false; +}this.charsMatched_ = this.thePattern.matchAt (s, i, pt); +if (this.charsMatched_ >= 0) { +this.matchFrom_ = this.thePattern.mfrom; +this.marks = pt.marks; +this.gFlagto = this.matchFrom_ + this.charsMatched_; +this.gFlags = s; +return this.didMatch_ = true; +}} +}return this.didMatch_ = false; +}, "com.stevesoft.pat.StringLike,~N,~N"); +Clazz.defineMethod (c$, "_reverseSearch", +function (s, start, end) { +return this._reverseSearchLike ( new com.stevesoft.pat.wrap.StringWrap (s), start, end); +}, "~S,~N,~N"); +Clazz.defineMethod (c$, "_reverseSearchLike", +function (s, start, end) { +if (this.gFlag && this.gFlagto > 0 && s.unwrap () === this.gFlags.unwrap ()) { +end = this.gFlagto; +}this.gFlags = null; +var pt = this.prep (s); +for (var i = end; i >= start; i--) { +this.charsMatched_ = this.thePattern.matchAt (s, i, pt); +if (this.charsMatched_ >= 0) { +this.matchFrom_ = this.thePattern.mfrom; +this.marks = pt.marks; +this.gFlagto = this.matchFrom_ - 1; +this.gFlags = s; +return this.didMatch_ = true; +}} +return this.didMatch_ = false; +}, "com.stevesoft.pat.StringLike,~N,~N"); +c$.setCbits = Clazz.defineMethod (c$, "setCbits", +function (s, pt) { +if (s === com.stevesoft.pat.Regex.lasts) { +pt.cbits = com.stevesoft.pat.Regex.lastbs; +return; +}var bs = new java.util.BitSet (s.length ()); +var qc = ' '; +var setBit = false; +for (var i = 0; i < s.length (); i++) { +if (setBit) { +bs.set (i); +}var c = s.charAt (i); +if (!setBit && c == '"') { +qc = c; +setBit = true; +bs.set (i); +} else if (!setBit && c == '\'') { +qc = c; +setBit = true; +bs.set (i); +} else if (setBit && c == qc) { +setBit = false; +} else if (setBit && c == '\\' && i + 1 < s.length ()) { +i++; +if (setBit) { +bs.set (i); +}}} +pt.cbits = com.stevesoft.pat.Regex.lastbs = bs; +com.stevesoft.pat.Regex.lasts = s; +}, "com.stevesoft.pat.StringLike,com.stevesoft.pat.Pthings"); +Clazz.defineMethod (c$, "add", +function (p2) { +if (this.p == null) { +this.p = p2; +} else { +this.p.add (p2); +p2 = this.p; +}}, "com.stevesoft.pat.Pattern"); +Clazz.defineMethod (c$, "compileSP", +function (sp, mk) { +if (sp.match ('[')) { +sp.inc (); +this.add (this.matchBracket (sp)); +} else if (sp.match ('|')) { +if (this.or == null) { +this.or = new com.stevesoft.pat.Or (); +}if (this.p == null) { +this.p = new com.stevesoft.pat.NullPattern (); +}this.or.addOr (this.p); +this.p = null; +} else if (sp.incMatch ("(?<")) { +var i = sp.getPatInt (); +if (i == null) { +com.stevesoft.pat.RegSyntaxError.endItAll ("No int after (?<"); +}this.add ( new com.stevesoft.pat.Backup (i.intValue ())); +if (!sp.match (')')) { +com.stevesoft.pat.RegSyntaxError.endItAll ("No ) after (?<"); +}} else if (sp.incMatch ("(?>")) { +var i = sp.getPatInt (); +if (i == null) { +com.stevesoft.pat.RegSyntaxError.endItAll ("No int after (?>"); +}this.add ( new com.stevesoft.pat.Backup (-i.intValue ())); +if (!sp.match (')')) { +com.stevesoft.pat.RegSyntaxError.endItAll ("No ) after (?<"); +}} else if (sp.incMatch ("(?@")) { +var op = sp.c; +sp.inc (); +var cl = sp.c; +sp.inc (); +if (!sp.match (')')) { +com.stevesoft.pat.RegSyntaxError.endItAll ("(?@ does not have closing paren"); +}this.add ( new com.stevesoft.pat.Group (op, cl)); +} else if (sp.incMatch ("(?#")) { +while (!sp.match (')')) { +sp.inc (); +} +} else if (sp.dontMatch && sp.c == 'w') { +var b = new com.stevesoft.pat.Bracket (false); +b.addOr ( new com.stevesoft.pat.Range ('a', 'z')); +b.addOr ( new com.stevesoft.pat.Range ('A', 'Z')); +b.addOr ( new com.stevesoft.pat.Range ('0', '9')); +b.addOr ( new com.stevesoft.pat.oneChar ('_')); +this.add (b); +} else if (sp.dontMatch && sp.c == 'G') { +this.add ( new com.stevesoft.pat.BackG ()); +} else if (sp.dontMatch && sp.c == 's') { +var b = new com.stevesoft.pat.Bracket (false); +b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (32))); +b.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (8), String.fromCharCode (10))); +b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (13))); +this.add (b); +} else if (sp.dontMatch && sp.c == 'd') { +var digit = new com.stevesoft.pat.Range ('0', '9'); +digit.printBrackets = true; +this.add (digit); +} else if (sp.dontMatch && sp.c == 'W') { +var b = new com.stevesoft.pat.Bracket (true); +b.addOr ( new com.stevesoft.pat.Range ('a', 'z')); +b.addOr ( new com.stevesoft.pat.Range ('A', 'Z')); +b.addOr ( new com.stevesoft.pat.Range ('0', '9')); +b.addOr ( new com.stevesoft.pat.oneChar ('_')); +this.add (b); +} else if (sp.dontMatch && sp.c == 'S') { +var b = new com.stevesoft.pat.Bracket (true); +b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (32))); +b.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (8), String.fromCharCode (10))); +b.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (13))); +this.add (b); +} else if (sp.dontMatch && sp.c == 'D') { +var b = new com.stevesoft.pat.Bracket (true); +b.addOr ( new com.stevesoft.pat.Range ('0', '9')); +this.add (b); +} else if (sp.dontMatch && sp.c == 'B') { +var r = new com.stevesoft.pat.Regex (null, ""); +r._compile ("(?!\\b)", mk); +this.add (r.thePattern); +} else if (this.isOctalString (sp)) { +var d = sp.c.charCodeAt (0) - 48; +sp.inc (); +d = 8 * d + sp.c.charCodeAt (0) - 48; +var sp2 = new com.stevesoft.pat.StrPos (sp); +sp2.inc (); +if (this.isOctalDigit (sp2, false)) { +sp.inc (); +d = 8 * d + sp.c.charCodeAt (0) - 48; +}this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (d))); +} else if (sp.dontMatch && sp.c >= '1' && sp.c <= '9') { +var iv = sp.c.charCodeAt (0) - 48; +var s2 = new com.stevesoft.pat.StrPos (sp); +s2.inc (); +if (!s2.dontMatch && s2.c >= '0' && s2.c <= '9') { +iv = 10 * iv + (s2.c.charCodeAt (0) - 48); +sp.inc (); +}this.add ( new com.stevesoft.pat.BackMatch (iv)); +} else if (sp.dontMatch && sp.c == 'b') { +this.add ( new com.stevesoft.pat.Boundary ()); +} else if (sp.match ('\b')) { +this.add ( new com.stevesoft.pat.Boundary ()); +} else if (sp.match ('$')) { +this.add ( new com.stevesoft.pat.End (true)); +} else if (sp.dontMatch && sp.c == 'Z') { +this.add ( new com.stevesoft.pat.End (false)); +} else if (sp.match ('.')) { +this.add ( new com.stevesoft.pat.Any ()); +} else if (sp.incMatch ("(??")) { +var sb = new StringBuffer (); +var sb2 = new StringBuffer (); +while (!sp.match (')') && !sp.match (':')) { +sb.append (sp.c); +sp.inc (); +} +if (sp.incMatch (":")) { +while (!sp.match (')')) { +sb2.append (sp.c); +sp.inc (); +} +}var sbs = sb.toString (); +if (Clazz.instanceOf (com.stevesoft.pat.Regex.validators.get (sbs), String)) { +var pat = com.stevesoft.pat.Regex.validators.get (sbs); +var r = new com.stevesoft.pat.Regex (null, ""); +var rth = new com.stevesoft.pat.Rthings (this); +rth.noBackRefs = true; +r._compile (pat, rth); +this.add (r.thePattern); +} else { +var cm = new com.stevesoft.pat.Custom (sb.toString ()); +if (cm.v != null) { +var v2 = cm.v.arg (sb2.toString ()); +if (v2 != null) { +v2.argsave = sb2.toString (); +var p = cm.v.pattern; +cm.v = v2; +v2.pattern = p; +}var r = new com.stevesoft.pat.Regex (null, ""); +var rth = new com.stevesoft.pat.Rthings (this); +rth.noBackRefs = true; +r._compile (cm.v.pattern, rth); +cm.sub = r.thePattern; +cm.sub.add ( new com.stevesoft.pat.CustomEndpoint (cm)); +cm.sub.setParent (cm); +this.add (cm); +}}} else if (sp.match ('(')) { +mk.parenLevel++; +var r = new com.stevesoft.pat.Regex (null, ""); +sp.inc (); +if (sp.incMatch ("?:")) { +r.or = new com.stevesoft.pat.Or (); +} else if (sp.incMatch ("?=")) { +r.or = new com.stevesoft.pat.lookAhead (false); +} else if (sp.incMatch ("?!")) { +r.or = new com.stevesoft.pat.lookAhead (true); +} else if (sp.match ('?')) { +sp.inc (); +do { +if (sp.c == 'i') { +mk.ignoreCase = true; +}if (sp.c == 'Q') { +mk.dontMatchInQuotes = true; +}if (sp.c == 'o') { +mk.optimizeMe = true; +}if (sp.c == 'g') { +mk.gFlag = true; +}if (sp.c == 's') { +mk.sFlag = true; +}if (sp.c == 'm') { +mk.mFlag = true; +}sp.inc (); +} while (!sp.match (')') && !sp.$eos); +r = null; +mk.parenLevel--; +if (sp.$eos) { +com.stevesoft.pat.RegSyntaxError.endItAll ("Unclosed ()"); +}} else { +r.or = mk.noBackRefs ? new com.stevesoft.pat.Or () : new com.stevesoft.pat.OrMark (mk.val++); +}if (r != null) { +this.add (r._compileSP (sp, mk)); +}} else if (sp.match ('^')) { +this.add ( new com.stevesoft.pat.Start (true)); +} else if (sp.dontMatch && sp.c == 'A') { +this.add ( new com.stevesoft.pat.Start (false)); +} else if (sp.match ('*')) { +this.addMulti ( new com.stevesoft.pat.patInt (0), new com.stevesoft.pat.patInf ()); +} else if (sp.match ('+')) { +this.addMulti ( new com.stevesoft.pat.patInt (1), new com.stevesoft.pat.patInf ()); +} else if (sp.match ('?')) { +this.addMulti ( new com.stevesoft.pat.patInt (0), new com.stevesoft.pat.patInt (1)); +} else if (sp.match ('{')) { +var bad = false; +var sp2 = new com.stevesoft.pat.StrPos (sp); +sp.inc (); +var i1 = sp.getPatInt (); +var i2 = null; +if (sp.match ('}')) { +i2 = i1; +} else { +if (!sp.match (',')) { +bad = true; +}sp.inc (); +if (sp.match ('}')) { +i2 = new com.stevesoft.pat.patInf (); +} else { +i2 = sp.getPatInt (); +}}if (i1 == null || i2 == null) { +bad = true; +}if (bad) { +sp.dup (sp2); +this.add ( new com.stevesoft.pat.oneChar (sp.c)); +} else { +this.addMulti (i1, i2); +}} else if (sp.escMatch ('x') && this.next2Hex (sp)) { +sp.inc (); +var d = this.getHexDigit (sp); +sp.inc (); +d = 16 * d + this.getHexDigit (sp); +this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (d))); +} else if (sp.escMatch ('c')) { +sp.inc (); +if (sp.c.charCodeAt (0) < com.stevesoft.pat.Ctrl.cmap.length) { +this.add ( new com.stevesoft.pat.oneChar (com.stevesoft.pat.Ctrl.cmap[sp.c.charCodeAt (0)])); +} else { +this.add ( new com.stevesoft.pat.oneChar (sp.c)); +}} else if (sp.escMatch ('f')) { +this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (12))); +} else if (sp.escMatch ('a')) { +this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (7))); +} else if (sp.escMatch ('t')) { +this.add ( new com.stevesoft.pat.oneChar ('\t')); +} else if (sp.escMatch ('n')) { +this.add ( new com.stevesoft.pat.oneChar ('\n')); +} else if (sp.escMatch ('r')) { +this.add ( new com.stevesoft.pat.oneChar ('\r')); +} else if (sp.escMatch ('b')) { +this.add ( new com.stevesoft.pat.oneChar ('\b')); +} else if (sp.escMatch ('e')) { +this.add ( new com.stevesoft.pat.oneChar (String.fromCharCode (27))); +} else { +this.add ( new com.stevesoft.pat.oneChar (sp.c)); +if (sp.match (')')) { +com.stevesoft.pat.RegSyntaxError.endItAll ("Unmatched right paren in pattern"); +}}}, "com.stevesoft.pat.StrPos,com.stevesoft.pat.Rthings"); +Clazz.defineMethod (c$, "_compile", +($fz = function (pat, mk) { +this.minMatch = null; +this.sFlag = this.mFlag = this.ignoreCase = this.gFlag = false; +var sp = new com.stevesoft.pat.StrPos (pat, 0); +this.thePattern = this._compileSP (sp, mk); +this.pt.marks = null; +return this.thePattern; +}, $fz.isPrivate = true, $fz), "~S,com.stevesoft.pat.Rthings"); +Clazz.defineMethod (c$, "_compileSP", +function (sp, mk) { +while (!(sp.$eos || (this.or != null && sp.match (')')))) { +this.compileSP (sp, mk); +sp.inc (); +} +if (sp.match (')')) { +mk.parenLevel--; +} else if (sp.$eos && mk.parenLevel != 0) { +com.stevesoft.pat.RegSyntaxError.endItAll ("Unclosed Parenthesis! lvl=" + mk.parenLevel); +}if (this.or != null) { +if (this.p == null) { +this.p = new com.stevesoft.pat.NullPattern (); +}this.or.addOr (this.p); +return this.or; +}return this.p == null ? new com.stevesoft.pat.NullPattern () : this.p; +}, "com.stevesoft.pat.StrPos,com.stevesoft.pat.Rthings"); +Clazz.defineMethod (c$, "addMulti", +function (i1, i2) { +var last; +var last2; +for (last = this.p; last != null && last.next != null; last = last.next) { +;} +if (last == null || last === this.p) { +last2 = null; +} else { +for (last2 = this.p; last2.next !== last; last2 = last2.next) { +;} +}if (Clazz.instanceOf (last, com.stevesoft.pat.Multi) && i1.intValue () == 0 && i2.intValue () == 1) { +(last).matchFewest = true; +} else if (Clazz.instanceOf (last, com.stevesoft.pat.FastMulti) && i1.intValue () == 0 && i2.intValue () == 1) { +(last).matchFewest = true; +} else if (Clazz.instanceOf (last, com.stevesoft.pat.DotMulti) && i1.intValue () == 0 && i2.intValue () == 1) { +(last).matchFewest = true; +} else if (Clazz.instanceOf (last, com.stevesoft.pat.Multi) || Clazz.instanceOf (last, com.stevesoft.pat.DotMulti) || Clazz.instanceOf (last, com.stevesoft.pat.FastMulti)) { +throw new com.stevesoft.pat.RegSyntax ("Syntax error."); +} else if (last2 == null) { +this.p = com.stevesoft.pat.Regex.mkMulti (i1, i2, this.p); +} else { +last2.next = com.stevesoft.pat.Regex.mkMulti (i1, i2, last); +}}, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt"); +c$.mkMulti = Clazz.defineMethod (c$, "mkMulti", +function (lo, hi, p) { +if (Clazz.instanceOf (p, com.stevesoft.pat.Any) && p.next == null) { +return new com.stevesoft.pat.DotMulti (lo, hi); +}return com.stevesoft.pat.RegOpt.safe4fm (p) ? new com.stevesoft.pat.FastMulti (lo, hi, p) : new com.stevesoft.pat.Multi (lo, hi, p); +}, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt,com.stevesoft.pat.Pattern"); +Clazz.defineMethod (c$, "matchBracket", +function (sp) { +var ret; +if (sp.match ('^')) { +ret = new com.stevesoft.pat.Bracket (true); +sp.inc (); +} else { +ret = new com.stevesoft.pat.Bracket (false); +}if (sp.match (']')) { +com.stevesoft.pat.RegSyntaxError.endItAll ("Unmatched []"); +}while (!sp.$eos && !sp.match (']')) { +var s1 = new com.stevesoft.pat.StrPos (sp); +s1.inc (); +var s1_ = new com.stevesoft.pat.StrPos (s1); +s1_.inc (); +if (s1.match ('-') && !s1_.match (']')) { +var s2 = new com.stevesoft.pat.StrPos (s1); +s2.inc (); +if (!s2.$eos) { +ret.addOr ( new com.stevesoft.pat.Range (sp.c, s2.c)); +}sp.inc (); +sp.inc (); +} else if (sp.escMatch ('Q')) { +sp.inc (); +while (!sp.escMatch ('E')) { +ret.addOr ( new com.stevesoft.pat.oneChar (sp.c)); +sp.inc (); +} +} else if (sp.escMatch ('d')) { +ret.addOr ( new com.stevesoft.pat.Range ('0', '9')); +} else if (sp.escMatch ('s')) { +ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (32))); +ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (8), String.fromCharCode (10))); +ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (13))); +} else if (sp.escMatch ('w')) { +ret.addOr ( new com.stevesoft.pat.Range ('a', 'z')); +ret.addOr ( new com.stevesoft.pat.Range ('A', 'Z')); +ret.addOr ( new com.stevesoft.pat.Range ('0', '9')); +ret.addOr ( new com.stevesoft.pat.oneChar ('_')); +} else if (sp.escMatch ('D')) { +ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (0), String.fromCharCode (47))); +ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (58), String.fromCharCode (65535))); +} else if (sp.escMatch ('S')) { +ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (0), String.fromCharCode (7))); +ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (11), String.fromCharCode (12))); +ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (14), String.fromCharCode (31))); +ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (33), String.fromCharCode (65535))); +} else if (sp.escMatch ('W')) { +ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (0), String.fromCharCode (64))); +ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (91), String.fromCharCode (94))); +ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (96))); +ret.addOr ( new com.stevesoft.pat.Range (String.fromCharCode (123), String.fromCharCode (65535))); +} else if (sp.escMatch ('x') && this.next2Hex (sp)) { +sp.inc (); +var d = this.getHexDigit (sp); +sp.inc (); +d = 16 * d + this.getHexDigit (sp); +ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (d))); +} else if (sp.escMatch ('a')) { +ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (7))); +} else if (sp.escMatch ('f')) { +ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (12))); +} else if (sp.escMatch ('e')) { +ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (27))); +} else if (sp.escMatch ('n')) { +ret.addOr ( new com.stevesoft.pat.oneChar ('\n')); +} else if (sp.escMatch ('t')) { +ret.addOr ( new com.stevesoft.pat.oneChar ('\t')); +} else if (sp.escMatch ('r')) { +ret.addOr ( new com.stevesoft.pat.oneChar ('\r')); +} else if (sp.escMatch ('c')) { +sp.inc (); +if (sp.c.charCodeAt (0) < com.stevesoft.pat.Ctrl.cmap.length) { +ret.addOr ( new com.stevesoft.pat.oneChar (com.stevesoft.pat.Ctrl.cmap[sp.c.charCodeAt (0)])); +} else { +ret.addOr ( new com.stevesoft.pat.oneChar (sp.c)); +}} else if (this.isOctalString (sp)) { +var d = sp.c.charCodeAt (0) - 48; +sp.inc (); +d = 8 * d + sp.c.charCodeAt (0) - 48; +var sp2 = new com.stevesoft.pat.StrPos (sp); +sp2.inc (); +if (this.isOctalDigit (sp2, false)) { +sp.inc (); +d = 8 * d + sp.c.charCodeAt (0) - 48; +}ret.addOr ( new com.stevesoft.pat.oneChar (String.fromCharCode (d))); +} else { +ret.addOr ( new com.stevesoft.pat.oneChar (sp.c)); +}sp.inc (); +} +return ret; +}, "com.stevesoft.pat.StrPos"); +Clazz.overrideMethod (c$, "toString", +function () { +{ +var sb = new StringBuffer (); +if (this.esc != '\\') { +sb.append ("(?e="); +sb.append (this.esc); +sb.append (")"); +}if (this.gFlag || this.mFlag || !com.stevesoft.pat.Regex.dotDoesntMatchCR || this.sFlag || this.ignoreCase || this.dontMatchInQuotes || this.optimized ()) { +sb.append ("(?"); +if (this.ignoreCase) { +sb.append ("i"); +}if (this.mFlag) { +sb.append ("m"); +}if (this.sFlag || !com.stevesoft.pat.Regex.dotDoesntMatchCR) { +sb.append ("s"); +}if (this.dontMatchInQuotes) { +sb.append ("Q"); +}if (this.optimized ()) { +sb.append ("o"); +}if (this.gFlag) { +sb.append ("g"); +}sb.append (")"); +}var patstr = this.thePattern.toString (); +if (this.esc != '\\') { +patstr = com.stevesoft.pat.Regex.reEscape (patstr, '\\', this.esc); +}sb.append (patstr); +return sb.toString (); +}}); +c$.reEscape = Clazz.defineMethod (c$, "reEscape", +function (s, oldEsc, newEsc) { +if (oldEsc == newEsc) { +return s; +}var i; +var sb = new StringBuffer (); +for (i = 0; i < s.length; i++) { +if (s.charAt (i) == oldEsc && i + 1 < s.length) { +if (s.charAt (i + 1) == oldEsc) { +sb.append (oldEsc); +} else { +sb.append (newEsc); +sb.append (s.charAt (i + 1)); +}i++; +} else if (s.charAt (i) == newEsc) { +sb.append (newEsc); +sb.append (newEsc); +} else { +sb.append (s.charAt (i)); +}} +return sb.toString (); +}, "~S,~S,~S"); +Clazz.defineMethod (c$, "accept", +function (dir, s) { +return this.search (s); +}, "java.io.File,~S"); +c$.version = Clazz.defineMethod (c$, "version", +function () { +return "lgpl release 1.5.3"; +}); +Clazz.defineMethod (c$, "optimize", +function () { +if (this.optimized () || this.thePattern == null) { +return; +}this.minMatch = new com.stevesoft.pat.patInt (0); +this.thePattern = com.stevesoft.pat.RegOpt.opt (this.thePattern, this.ignoreCase, this.dontMatchInQuotes); +this.skipper = com.stevesoft.pat.Skip.findSkipRegex (this); +return; +}); +Clazz.defineMethod (c$, "optimized", +function () { +return this.minMatch != null; +}); +c$.perlCode = Clazz.defineMethod (c$, "perlCode", +function (s) { +return com.stevesoft.pat.parsePerl.parse (s); +}, "~S"); +Clazz.defineMethod (c$, "isLiteral", +function () { +var x = this.thePattern; +while (x != null) { +if (Clazz.instanceOf (x, com.stevesoft.pat.oneChar)) { +;} else if (Clazz.instanceOf (x, com.stevesoft.pat.Skipped)) { +;} else { +return false; +}x = x.next; +} +return true; +}); +Clazz.defineMethod (c$, "countMinChars", +function () { +return this.thePattern.countMinChars (); +}); +Clazz.defineMethod (c$, "countMaxChars", +function () { +return this.thePattern.countMaxChars (); +}); +Clazz.defineMethod (c$, "isHexDigit", +function (sp) { +var r = !sp.$eos && !sp.dontMatch && ((sp.c >= '0' && sp.c <= '9') || (sp.c >= 'a' && sp.c <= 'f') || (sp.c >= 'A' && sp.c <= 'F')); +return r; +}, "com.stevesoft.pat.StrPos"); +Clazz.defineMethod (c$, "isOctalDigit", +function (sp, first) { +var r = !sp.$eos && !( new Boolean (first ^ sp.dontMatch).valueOf ()) && sp.c >= '0' && sp.c <= '7'; +return r; +}, "com.stevesoft.pat.StrPos,~B"); +Clazz.defineMethod (c$, "getHexDigit", +function (sp) { +if (sp.c >= '0' && sp.c <= '9') { +return sp.c.charCodeAt (0) - 48; +}if (sp.c >= 'a' && sp.c <= 'f') { +return sp.c.charCodeAt (0) - 97 + 10; +}return sp.c.charCodeAt (0) - 65 + 10; +}, "com.stevesoft.pat.StrPos"); +Clazz.defineMethod (c$, "next2Hex", +function (sp) { +var sp2 = new com.stevesoft.pat.StrPos (sp); +sp2.inc (); +if (!this.isHexDigit (sp2)) { +return false; +}sp2.inc (); +if (!this.isHexDigit (sp2)) { +return false; +}return true; +}, "com.stevesoft.pat.StrPos"); +Clazz.defineMethod (c$, "isOctalString", +function (sp) { +if (!this.isOctalDigit (sp, true)) { +return false; +}var sp2 = new com.stevesoft.pat.StrPos (sp); +sp2.inc (); +if (!this.isOctalDigit (sp2, false)) { +return false; +}return true; +}, "com.stevesoft.pat.StrPos"); +Clazz.defineStatics (c$, +"BackRefOffset", 1); +c$.none = c$.prototype.none = new com.stevesoft.pat.NoPattern (); +c$.validators = c$.prototype.validators = new java.util.Hashtable (); +{ +com.stevesoft.pat.Regex.defineV ("p", "(?>1)", new com.stevesoft.pat.UnicodePunct ()); +com.stevesoft.pat.Regex.defineV ("P", "(?>1)", new com.stevesoft.pat.NUnicodePunct ()); +com.stevesoft.pat.Regex.defineV ("s", "(?>1)", new com.stevesoft.pat.UnicodeWhite ()); +com.stevesoft.pat.Regex.defineV ("S", "(?>1)", new com.stevesoft.pat.NUnicodeWhite ()); +com.stevesoft.pat.Regex.defineV ("w", "(?>1)", new com.stevesoft.pat.UnicodeW ()); +com.stevesoft.pat.Regex.defineV ("W", "(?>1)", new com.stevesoft.pat.NUnicodeW ()); +com.stevesoft.pat.Regex.defineV ("d", "(?>1)", new com.stevesoft.pat.UnicodeDigit ()); +com.stevesoft.pat.Regex.defineV ("D", "(?>1)", new com.stevesoft.pat.NUnicodeDigit ()); +com.stevesoft.pat.Regex.defineV ("m", "(?>1)", new com.stevesoft.pat.UnicodeMath ()); +com.stevesoft.pat.Regex.defineV ("M", "(?>1)", new com.stevesoft.pat.NUnicodeMath ()); +com.stevesoft.pat.Regex.defineV ("c", "(?>1)", new com.stevesoft.pat.UnicodeCurrency ()); +com.stevesoft.pat.Regex.defineV ("C", "(?>1)", new com.stevesoft.pat.NUnicodeCurrency ()); +com.stevesoft.pat.Regex.defineV ("a", "(?>1)", new com.stevesoft.pat.UnicodeAlpha ()); +com.stevesoft.pat.Regex.defineV ("A", "(?>1)", new com.stevesoft.pat.NUnicodeAlpha ()); +com.stevesoft.pat.Regex.defineV ("uc", "(?>1)", new com.stevesoft.pat.UnicodeUpper ()); +com.stevesoft.pat.Regex.defineV ("lc", "(?>1)", new com.stevesoft.pat.UnicodeLower ()); +}Clazz.defineStatics (c$, +"defaultMFlag", false, +"dotDoesntMatchCR", true, +"lasts", null, +"lastbs", null, +"back_slash", '\\'); +});