From: Finn B. <bc...@us...> - 2001-11-27 13:51:41
|
Update of /cvsroot/jython/jython/org/python/modules/sre In directory usw-pr-cvs1:/tmp/cvs-serv9040/modules/sre Modified Files: MatchObject.java PatternObject.java SRE_REPEAT.java SRE_STATE.java ScannerObject.java Log Message: Whitespace normalization. Index: MatchObject.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/sre/MatchObject.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MatchObject.java 2001/10/28 15:11:47 1.4 --- MatchObject.java 2001/11/27 13:51:37 1.5 *************** *** 54,58 **** } - public PyObject groupdict(PyObject[] args, String[] kws) { ArgParser ap = new ArgParser("groupdict", args, kws, "default"); --- 54,57 ---- *************** *** 74,86 **** } - - - - public PyObject start() { return start(Py.Zero); } - public PyObject start(PyObject index_) { int index = getindex(index_); --- 73,80 ---- *************** *** 92,102 **** } - - public PyObject end() { return end(Py.Zero); } - public PyObject end(PyObject index_) { int index = getindex(index_); --- 86,93 ---- *************** *** 108,123 **** } - - - public PyTuple span() { return span(Py.Zero); } - public PyTuple span(PyObject index_) { int index = getindex(index_); ! if (index < 0 || index >= groups) throw Py.IndexError("no such group"); --- 99,110 ---- } public PyTuple span() { return span(Py.Zero); } public PyTuple span(PyObject index_) { int index = getindex(index_); ! if (index < 0 || index >= groups) throw Py.IndexError("no such group"); *************** *** 128,134 **** } - - - public PyObject regs() { --- 115,118 ---- *************** *** 143,163 **** - - - - PyTuple _pair(int i1, int i2) { return new PyTuple(new PyObject[] { Py.newInteger(i1), Py.newInteger(i2) }); } - - - private PyObject getslice(PyObject index, PyObject def) { return getslice_by_index(getindex(index), def); } - - private int getindex(PyObject index) { if (index instanceof PyInteger) --- 127,138 ---- *************** *** 175,184 **** } - - private PyObject getslice_by_index(int index, PyObject def) { ! if (index < 0 || index >= groups) throw Py.IndexError("no such group"); ! index *= 2; int start = mark[index]; --- 150,157 ---- } private PyObject getslice_by_index(int index, PyObject def) { ! if (index < 0 || index >= groups) throw Py.IndexError("no such group"); ! index *= 2; int start = mark[index]; *************** *** 192,200 **** return new PyString(string.substring(start, end)); } - - - - - public PyObject __findattr__(String key) { --- 165,168 ---- Index: PatternObject.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/sre/PatternObject.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PatternObject.java 2001/01/21 14:04:32 1.5 --- PatternObject.java 2001/11/27 13:51:37 1.6 *************** *** 40,45 **** } - - public MatchObject match(String string) { return match(string, 0, Integer.MAX_VALUE); --- 40,43 ---- *************** *** 82,89 **** int count = ap.getInt(2, 0); ! return call("_sub", new PyObject[] { ! Py.java2py(this), template, ! Py.newString(string), Py.newInteger(count) }); } --- 80,87 ---- int count = ap.getInt(2, 0); ! return call("_sub", new PyObject[] { ! Py.java2py(this), template, ! Py.newString(string), Py.newInteger(count) }); } *************** *** 96,103 **** int count = ap.getInt(2, 0); ! return call("_subn", new PyObject[] { ! Py.java2py(this), ! template, ! Py.newString(string), Py.newInteger(count) }); } --- 94,101 ---- int count = ap.getInt(2, 0); ! return call("_subn", new PyObject[] { ! Py.java2py(this), ! template, ! Py.newString(string), Py.newInteger(count) }); } *************** *** 109,115 **** int count = ap.getInt(1, 0); ! return call("_split", new PyObject[] { ! Py.java2py(this), ! Py.newString(string), Py.newInteger(count) }); } --- 107,113 ---- int count = ap.getInt(1, 0); ! return call("_split", new PyObject[] { ! Py.java2py(this), ! Py.newString(string), Py.newInteger(count) }); } *************** *** 165,169 **** if (status == 0) break; ! _error(status); } --- 163,167 ---- if (status == 0) break; ! _error(status); } *************** *** 187,191 **** self.string = string; return self; ! } --- 185,189 ---- self.string = string; return self; ! } Index: SRE_REPEAT.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/sre/SRE_REPEAT.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SRE_REPEAT.java 2000/10/17 19:14:20 1.2 --- SRE_REPEAT.java 2001/11/27 13:51:37 1.3 *************** *** 20,24 **** public class SRE_REPEAT { int count; ! int pidx; SRE_REPEAT prev; --- 20,24 ---- public class SRE_REPEAT { int count; ! int pidx; SRE_REPEAT prev; Index: SRE_STATE.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/sre/SRE_STATE.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SRE_STATE.java 2001/04/04 19:08:21 1.5 --- SRE_STATE.java 2001/11/27 13:51:37 1.6 *************** *** 21,25 **** public class SRE_STATE { ! public static final int SRE_ERROR_ILLEGAL = -1; /* illegal opcode */ public static final int SRE_ERROR_STATE = -2; /* illegal state */ public static final int SRE_ERROR_RECURSION_LIMIT = -3; /* runaway recursion */ --- 21,25 ---- public class SRE_STATE { ! public static final int SRE_ERROR_ILLEGAL = -1; /* illegal opcode */ public static final int SRE_ERROR_STATE = -2; /* illegal state */ public static final int SRE_ERROR_RECURSION_LIMIT = -3; /* runaway recursion */ *************** *** 141,145 **** this.str = str.toCharArray(); int size = str.length(); ! this.charsize = 1; --- 141,145 ---- this.str = str.toCharArray(); int size = str.length(); ! this.charsize = 1; *************** *** 240,244 **** case SRE_AT_BEGINNING_LINE: ! return (ptr == beginning || SRE_IS_LINEBREAK(str[ptr-1])); case SRE_AT_END: --- 240,244 ---- case SRE_AT_BEGINNING_LINE: ! return (ptr == beginning || SRE_IS_LINEBREAK(str[ptr-1])); case SRE_AT_END: *************** *** 292,296 **** final boolean SRE_CHARSET(char[] set, int setidx, char ch) { ! /* check if character is a member of the given set. return 1 if so, 0 otherwise */ --- 292,296 ---- final boolean SRE_CHARSET(char[] set, int setidx, char ch) { ! /* check if character is a member of the given set. return 1 if so, 0 otherwise */ *************** *** 313,317 **** setidx += 2; break; ! case SRE_OP_CHARSET: /* <CHARSET> <bitmap> (16 bits per code word) */ --- 313,317 ---- setidx += 2; break; ! case SRE_OP_CHARSET: /* <CHARSET> <bitmap> (16 bits per code word) */ *************** *** 395,399 **** ptr++; break; ! case SRE_OP_NOT_LITERAL_IGNORE: /* repeated non-literal */ --- 395,399 ---- ptr++; break; ! case SRE_OP_NOT_LITERAL_IGNORE: /* repeated non-literal */ *************** *** 442,447 **** //TRACE(pidx, ptr, "ENTER " + level); ! if (level > USE_RECURSION_LIMIT) ! return SRE_ERROR_RECURSION_LIMIT; if (pattern[pidx] == SRE_OP_INFO) { --- 442,447 ---- //TRACE(pidx, ptr, "ENTER " + level); ! if (level > USE_RECURSION_LIMIT) ! return SRE_ERROR_RECURSION_LIMIT; if (pattern[pidx] == SRE_OP_INFO) { *************** *** 550,554 **** if (ptr >= end || str[ptr] != str[p]) return 0; ! p++; ptr++; } --- 550,554 ---- if (ptr >= end || str[ptr] != str[p]) return 0; ! p++; ptr++; } *************** *** 711,715 **** chr = pattern[pidx + pattern[pidx]+1]; for (;;) { ! while (count >= mincount && (ptr >= end || str[ptr] != chr)) { ptr--; --- 711,715 ---- chr = pattern[pidx + pattern[pidx]+1]; for (;;) { ! while (count >= mincount && (ptr >= end || str[ptr] != chr)) { ptr--; *************** *** 806,810 **** this.ptr = ptr; } ! /* cannot match more repeated items here. make sure the tail matches */ --- 806,810 ---- this.ptr = ptr; } ! /* cannot match more repeated items here. make sure the tail matches */ *************** *** 821,825 **** /* minimizing repeat */ /* <REPEAT> <skip> <1=min> <2=max> item <MIN_UNTIL> tail */ ! rp = this.repeat; if (rp == null) --- 821,825 ---- /* minimizing repeat */ /* <REPEAT> <skip> <1=min> <2=max> item <MIN_UNTIL> tail */ ! rp = this.repeat; if (rp == null) *************** *** 897,901 **** int overlap = 0; int flags = 0; ! if (pattern[pidx] == SRE_OP_INFO) { /* optimization info block */ --- 897,901 ---- int overlap = 0; int flags = 0; ! if (pattern[pidx] == SRE_OP_INFO) { /* optimization info block */ *************** *** 957,961 **** break; } ! } ptr++; --- 957,961 ---- break; } ! } ptr++; *************** *** 964,968 **** } - if (pattern[pidx] == SRE_OP_LITERAL) { /* pattern starts with a literal */ --- 964,967 ---- *************** *** 1071,1075 **** } ! /* default character predicates (run sre_chars.py to regenerate tables) */ --- 1070,1074 ---- } ! /* default character predicates (run sre_chars.py to regenerate tables) */ Index: ScannerObject.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/sre/ScannerObject.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ScannerObject.java 2000/10/17 19:14:20 1.2 --- ScannerObject.java 2001/11/27 13:51:37 1.3 *************** *** 40,44 **** state.state_reset(); state.ptr = state.start; ! int status = state.SRE_SEARCH(pattern.code, 0); MatchObject match = pattern._pattern_new_match(state, string, status); --- 40,44 ---- state.state_reset(); state.ptr = state.start; ! int status = state.SRE_SEARCH(pattern.code, 0); MatchObject match = pattern._pattern_new_match(state, string, status); |