Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 1 | /*[clinic input] |
| 2 | preserve |
| 3 | [clinic start generated code]*/ |
| 4 | |
| 5 | PyDoc_STRVAR(_sre_getcodesize__doc__, |
| 6 | "getcodesize($module, /)\n" |
| 7 | "--\n" |
| 8 | "\n"); |
| 9 | |
| 10 | #define _SRE_GETCODESIZE_METHODDEF \ |
| 11 | {"getcodesize", (PyCFunction)_sre_getcodesize, METH_NOARGS, _sre_getcodesize__doc__}, |
| 12 | |
| 13 | static int |
| 14 | _sre_getcodesize_impl(PyModuleDef *module); |
| 15 | |
| 16 | static PyObject * |
| 17 | _sre_getcodesize(PyModuleDef *module, PyObject *Py_UNUSED(ignored)) |
| 18 | { |
| 19 | PyObject *return_value = NULL; |
| 20 | int _return_value; |
| 21 | |
| 22 | _return_value = _sre_getcodesize_impl(module); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 23 | if ((_return_value == -1) && PyErr_Occurred()) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 24 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 25 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 26 | return_value = PyLong_FromLong((long)_return_value); |
| 27 | |
| 28 | exit: |
| 29 | return return_value; |
| 30 | } |
| 31 | |
| 32 | PyDoc_STRVAR(_sre_getlower__doc__, |
| 33 | "getlower($module, character, flags, /)\n" |
| 34 | "--\n" |
| 35 | "\n"); |
| 36 | |
| 37 | #define _SRE_GETLOWER_METHODDEF \ |
| 38 | {"getlower", (PyCFunction)_sre_getlower, METH_VARARGS, _sre_getlower__doc__}, |
| 39 | |
| 40 | static int |
| 41 | _sre_getlower_impl(PyModuleDef *module, int character, int flags); |
| 42 | |
| 43 | static PyObject * |
| 44 | _sre_getlower(PyModuleDef *module, PyObject *args) |
| 45 | { |
| 46 | PyObject *return_value = NULL; |
| 47 | int character; |
| 48 | int flags; |
| 49 | int _return_value; |
| 50 | |
| 51 | if (!PyArg_ParseTuple(args, "ii:getlower", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 52 | &character, &flags)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 53 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 54 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 55 | _return_value = _sre_getlower_impl(module, character, flags); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 56 | if ((_return_value == -1) && PyErr_Occurred()) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 57 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 58 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 59 | return_value = PyLong_FromLong((long)_return_value); |
| 60 | |
| 61 | exit: |
| 62 | return return_value; |
| 63 | } |
| 64 | |
| 65 | PyDoc_STRVAR(_sre_SRE_Pattern_match__doc__, |
| 66 | "match($self, /, string=None, pos=0, endpos=sys.maxsize, *, pattern=None)\n" |
| 67 | "--\n" |
| 68 | "\n" |
| 69 | "Matches zero or more characters at the beginning of the string."); |
| 70 | |
| 71 | #define _SRE_SRE_PATTERN_MATCH_METHODDEF \ |
| 72 | {"match", (PyCFunction)_sre_SRE_Pattern_match, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_match__doc__}, |
| 73 | |
| 74 | static PyObject * |
| 75 | _sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string, |
| 76 | Py_ssize_t pos, Py_ssize_t endpos, |
| 77 | PyObject *pattern); |
| 78 | |
| 79 | static PyObject * |
| 80 | _sre_SRE_Pattern_match(PatternObject *self, PyObject *args, PyObject *kwargs) |
| 81 | { |
| 82 | PyObject *return_value = NULL; |
| 83 | static char *_keywords[] = {"string", "pos", "endpos", "pattern", NULL}; |
| 84 | PyObject *string = NULL; |
| 85 | Py_ssize_t pos = 0; |
| 86 | Py_ssize_t endpos = PY_SSIZE_T_MAX; |
| 87 | PyObject *pattern = NULL; |
| 88 | |
| 89 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:match", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 90 | &string, &pos, &endpos, &pattern)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 91 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 92 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 93 | return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos, pattern); |
| 94 | |
| 95 | exit: |
| 96 | return return_value; |
| 97 | } |
| 98 | |
| 99 | PyDoc_STRVAR(_sre_SRE_Pattern_fullmatch__doc__, |
| 100 | "fullmatch($self, /, string=None, pos=0, endpos=sys.maxsize, *,\n" |
| 101 | " pattern=None)\n" |
| 102 | "--\n" |
| 103 | "\n" |
| 104 | "Matches against all of the string"); |
| 105 | |
| 106 | #define _SRE_SRE_PATTERN_FULLMATCH_METHODDEF \ |
| 107 | {"fullmatch", (PyCFunction)_sre_SRE_Pattern_fullmatch, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_fullmatch__doc__}, |
| 108 | |
| 109 | static PyObject * |
| 110 | _sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string, |
| 111 | Py_ssize_t pos, Py_ssize_t endpos, |
| 112 | PyObject *pattern); |
| 113 | |
| 114 | static PyObject * |
| 115 | _sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject *args, PyObject *kwargs) |
| 116 | { |
| 117 | PyObject *return_value = NULL; |
| 118 | static char *_keywords[] = {"string", "pos", "endpos", "pattern", NULL}; |
| 119 | PyObject *string = NULL; |
| 120 | Py_ssize_t pos = 0; |
| 121 | Py_ssize_t endpos = PY_SSIZE_T_MAX; |
| 122 | PyObject *pattern = NULL; |
| 123 | |
| 124 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:fullmatch", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 125 | &string, &pos, &endpos, &pattern)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 126 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 127 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 128 | return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos, pattern); |
| 129 | |
| 130 | exit: |
| 131 | return return_value; |
| 132 | } |
| 133 | |
| 134 | PyDoc_STRVAR(_sre_SRE_Pattern_search__doc__, |
| 135 | "search($self, /, string=None, pos=0, endpos=sys.maxsize, *,\n" |
| 136 | " pattern=None)\n" |
| 137 | "--\n" |
| 138 | "\n" |
| 139 | "Scan through string looking for a match, and return a corresponding match object instance.\n" |
| 140 | "\n" |
| 141 | "Return None if no position in the string matches."); |
| 142 | |
| 143 | #define _SRE_SRE_PATTERN_SEARCH_METHODDEF \ |
| 144 | {"search", (PyCFunction)_sre_SRE_Pattern_search, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_search__doc__}, |
| 145 | |
| 146 | static PyObject * |
| 147 | _sre_SRE_Pattern_search_impl(PatternObject *self, PyObject *string, |
| 148 | Py_ssize_t pos, Py_ssize_t endpos, |
| 149 | PyObject *pattern); |
| 150 | |
| 151 | static PyObject * |
| 152 | _sre_SRE_Pattern_search(PatternObject *self, PyObject *args, PyObject *kwargs) |
| 153 | { |
| 154 | PyObject *return_value = NULL; |
| 155 | static char *_keywords[] = {"string", "pos", "endpos", "pattern", NULL}; |
| 156 | PyObject *string = NULL; |
| 157 | Py_ssize_t pos = 0; |
| 158 | Py_ssize_t endpos = PY_SSIZE_T_MAX; |
| 159 | PyObject *pattern = NULL; |
| 160 | |
| 161 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:search", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 162 | &string, &pos, &endpos, &pattern)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 163 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 164 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 165 | return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos, pattern); |
| 166 | |
| 167 | exit: |
| 168 | return return_value; |
| 169 | } |
| 170 | |
| 171 | PyDoc_STRVAR(_sre_SRE_Pattern_findall__doc__, |
| 172 | "findall($self, /, string=None, pos=0, endpos=sys.maxsize, *,\n" |
| 173 | " source=None)\n" |
| 174 | "--\n" |
| 175 | "\n" |
| 176 | "Return a list of all non-overlapping matches of pattern in string."); |
| 177 | |
| 178 | #define _SRE_SRE_PATTERN_FINDALL_METHODDEF \ |
| 179 | {"findall", (PyCFunction)_sre_SRE_Pattern_findall, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_findall__doc__}, |
| 180 | |
| 181 | static PyObject * |
| 182 | _sre_SRE_Pattern_findall_impl(PatternObject *self, PyObject *string, |
| 183 | Py_ssize_t pos, Py_ssize_t endpos, |
| 184 | PyObject *source); |
| 185 | |
| 186 | static PyObject * |
| 187 | _sre_SRE_Pattern_findall(PatternObject *self, PyObject *args, PyObject *kwargs) |
| 188 | { |
| 189 | PyObject *return_value = NULL; |
| 190 | static char *_keywords[] = {"string", "pos", "endpos", "source", NULL}; |
| 191 | PyObject *string = NULL; |
| 192 | Py_ssize_t pos = 0; |
| 193 | Py_ssize_t endpos = PY_SSIZE_T_MAX; |
| 194 | PyObject *source = NULL; |
| 195 | |
| 196 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:findall", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 197 | &string, &pos, &endpos, &source)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 198 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 199 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 200 | return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos, source); |
| 201 | |
| 202 | exit: |
| 203 | return return_value; |
| 204 | } |
| 205 | |
| 206 | PyDoc_STRVAR(_sre_SRE_Pattern_finditer__doc__, |
| 207 | "finditer($self, /, string, pos=0, endpos=sys.maxsize)\n" |
| 208 | "--\n" |
| 209 | "\n" |
| 210 | "Return an iterator over all non-overlapping matches for the RE pattern in string.\n" |
| 211 | "\n" |
| 212 | "For each match, the iterator returns a match object."); |
| 213 | |
| 214 | #define _SRE_SRE_PATTERN_FINDITER_METHODDEF \ |
| 215 | {"finditer", (PyCFunction)_sre_SRE_Pattern_finditer, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_finditer__doc__}, |
| 216 | |
| 217 | static PyObject * |
| 218 | _sre_SRE_Pattern_finditer_impl(PatternObject *self, PyObject *string, |
| 219 | Py_ssize_t pos, Py_ssize_t endpos); |
| 220 | |
| 221 | static PyObject * |
| 222 | _sre_SRE_Pattern_finditer(PatternObject *self, PyObject *args, PyObject *kwargs) |
| 223 | { |
| 224 | PyObject *return_value = NULL; |
| 225 | static char *_keywords[] = {"string", "pos", "endpos", NULL}; |
| 226 | PyObject *string; |
| 227 | Py_ssize_t pos = 0; |
| 228 | Py_ssize_t endpos = PY_SSIZE_T_MAX; |
| 229 | |
| 230 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|nn:finditer", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 231 | &string, &pos, &endpos)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 232 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 233 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 234 | return_value = _sre_SRE_Pattern_finditer_impl(self, string, pos, endpos); |
| 235 | |
| 236 | exit: |
| 237 | return return_value; |
| 238 | } |
| 239 | |
| 240 | PyDoc_STRVAR(_sre_SRE_Pattern_scanner__doc__, |
| 241 | "scanner($self, /, string, pos=0, endpos=sys.maxsize)\n" |
| 242 | "--\n" |
| 243 | "\n"); |
| 244 | |
| 245 | #define _SRE_SRE_PATTERN_SCANNER_METHODDEF \ |
| 246 | {"scanner", (PyCFunction)_sre_SRE_Pattern_scanner, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_scanner__doc__}, |
| 247 | |
| 248 | static PyObject * |
| 249 | _sre_SRE_Pattern_scanner_impl(PatternObject *self, PyObject *string, |
| 250 | Py_ssize_t pos, Py_ssize_t endpos); |
| 251 | |
| 252 | static PyObject * |
| 253 | _sre_SRE_Pattern_scanner(PatternObject *self, PyObject *args, PyObject *kwargs) |
| 254 | { |
| 255 | PyObject *return_value = NULL; |
| 256 | static char *_keywords[] = {"string", "pos", "endpos", NULL}; |
| 257 | PyObject *string; |
| 258 | Py_ssize_t pos = 0; |
| 259 | Py_ssize_t endpos = PY_SSIZE_T_MAX; |
| 260 | |
| 261 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|nn:scanner", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 262 | &string, &pos, &endpos)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 263 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 264 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 265 | return_value = _sre_SRE_Pattern_scanner_impl(self, string, pos, endpos); |
| 266 | |
| 267 | exit: |
| 268 | return return_value; |
| 269 | } |
| 270 | |
| 271 | PyDoc_STRVAR(_sre_SRE_Pattern_split__doc__, |
| 272 | "split($self, /, string=None, maxsplit=0, *, source=None)\n" |
| 273 | "--\n" |
| 274 | "\n" |
| 275 | "Split string by the occurrences of pattern."); |
| 276 | |
| 277 | #define _SRE_SRE_PATTERN_SPLIT_METHODDEF \ |
| 278 | {"split", (PyCFunction)_sre_SRE_Pattern_split, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_split__doc__}, |
| 279 | |
| 280 | static PyObject * |
| 281 | _sre_SRE_Pattern_split_impl(PatternObject *self, PyObject *string, |
| 282 | Py_ssize_t maxsplit, PyObject *source); |
| 283 | |
| 284 | static PyObject * |
| 285 | _sre_SRE_Pattern_split(PatternObject *self, PyObject *args, PyObject *kwargs) |
| 286 | { |
| 287 | PyObject *return_value = NULL; |
| 288 | static char *_keywords[] = {"string", "maxsplit", "source", NULL}; |
| 289 | PyObject *string = NULL; |
| 290 | Py_ssize_t maxsplit = 0; |
| 291 | PyObject *source = NULL; |
| 292 | |
| 293 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|On$O:split", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 294 | &string, &maxsplit, &source)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 295 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 296 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 297 | return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit, source); |
| 298 | |
| 299 | exit: |
| 300 | return return_value; |
| 301 | } |
| 302 | |
| 303 | PyDoc_STRVAR(_sre_SRE_Pattern_sub__doc__, |
| 304 | "sub($self, /, repl, string, count=0)\n" |
| 305 | "--\n" |
| 306 | "\n" |
| 307 | "Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl."); |
| 308 | |
| 309 | #define _SRE_SRE_PATTERN_SUB_METHODDEF \ |
| 310 | {"sub", (PyCFunction)_sre_SRE_Pattern_sub, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_sub__doc__}, |
| 311 | |
| 312 | static PyObject * |
| 313 | _sre_SRE_Pattern_sub_impl(PatternObject *self, PyObject *repl, |
| 314 | PyObject *string, Py_ssize_t count); |
| 315 | |
| 316 | static PyObject * |
| 317 | _sre_SRE_Pattern_sub(PatternObject *self, PyObject *args, PyObject *kwargs) |
| 318 | { |
| 319 | PyObject *return_value = NULL; |
| 320 | static char *_keywords[] = {"repl", "string", "count", NULL}; |
| 321 | PyObject *repl; |
| 322 | PyObject *string; |
| 323 | Py_ssize_t count = 0; |
| 324 | |
| 325 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|n:sub", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 326 | &repl, &string, &count)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 327 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 328 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 329 | return_value = _sre_SRE_Pattern_sub_impl(self, repl, string, count); |
| 330 | |
| 331 | exit: |
| 332 | return return_value; |
| 333 | } |
| 334 | |
| 335 | PyDoc_STRVAR(_sre_SRE_Pattern_subn__doc__, |
| 336 | "subn($self, /, repl, string, count=0)\n" |
| 337 | "--\n" |
| 338 | "\n" |
| 339 | "Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl."); |
| 340 | |
| 341 | #define _SRE_SRE_PATTERN_SUBN_METHODDEF \ |
| 342 | {"subn", (PyCFunction)_sre_SRE_Pattern_subn, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_subn__doc__}, |
| 343 | |
| 344 | static PyObject * |
| 345 | _sre_SRE_Pattern_subn_impl(PatternObject *self, PyObject *repl, |
| 346 | PyObject *string, Py_ssize_t count); |
| 347 | |
| 348 | static PyObject * |
| 349 | _sre_SRE_Pattern_subn(PatternObject *self, PyObject *args, PyObject *kwargs) |
| 350 | { |
| 351 | PyObject *return_value = NULL; |
| 352 | static char *_keywords[] = {"repl", "string", "count", NULL}; |
| 353 | PyObject *repl; |
| 354 | PyObject *string; |
| 355 | Py_ssize_t count = 0; |
| 356 | |
| 357 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|n:subn", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 358 | &repl, &string, &count)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 359 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 360 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 361 | return_value = _sre_SRE_Pattern_subn_impl(self, repl, string, count); |
| 362 | |
| 363 | exit: |
| 364 | return return_value; |
| 365 | } |
| 366 | |
| 367 | PyDoc_STRVAR(_sre_SRE_Pattern___copy____doc__, |
| 368 | "__copy__($self, /)\n" |
| 369 | "--\n" |
| 370 | "\n"); |
| 371 | |
| 372 | #define _SRE_SRE_PATTERN___COPY___METHODDEF \ |
| 373 | {"__copy__", (PyCFunction)_sre_SRE_Pattern___copy__, METH_NOARGS, _sre_SRE_Pattern___copy____doc__}, |
| 374 | |
| 375 | static PyObject * |
| 376 | _sre_SRE_Pattern___copy___impl(PatternObject *self); |
| 377 | |
| 378 | static PyObject * |
| 379 | _sre_SRE_Pattern___copy__(PatternObject *self, PyObject *Py_UNUSED(ignored)) |
| 380 | { |
| 381 | return _sre_SRE_Pattern___copy___impl(self); |
| 382 | } |
| 383 | |
| 384 | PyDoc_STRVAR(_sre_SRE_Pattern___deepcopy____doc__, |
| 385 | "__deepcopy__($self, /, memo)\n" |
| 386 | "--\n" |
| 387 | "\n"); |
| 388 | |
| 389 | #define _SRE_SRE_PATTERN___DEEPCOPY___METHODDEF \ |
| 390 | {"__deepcopy__", (PyCFunction)_sre_SRE_Pattern___deepcopy__, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern___deepcopy____doc__}, |
| 391 | |
| 392 | static PyObject * |
| 393 | _sre_SRE_Pattern___deepcopy___impl(PatternObject *self, PyObject *memo); |
| 394 | |
| 395 | static PyObject * |
| 396 | _sre_SRE_Pattern___deepcopy__(PatternObject *self, PyObject *args, PyObject *kwargs) |
| 397 | { |
| 398 | PyObject *return_value = NULL; |
| 399 | static char *_keywords[] = {"memo", NULL}; |
| 400 | PyObject *memo; |
| 401 | |
| 402 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:__deepcopy__", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 403 | &memo)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 404 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 405 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 406 | return_value = _sre_SRE_Pattern___deepcopy___impl(self, memo); |
| 407 | |
| 408 | exit: |
| 409 | return return_value; |
| 410 | } |
| 411 | |
| 412 | PyDoc_STRVAR(_sre_compile__doc__, |
| 413 | "compile($module, /, pattern, flags, code, groups, groupindex,\n" |
| 414 | " indexgroup)\n" |
| 415 | "--\n" |
| 416 | "\n"); |
| 417 | |
| 418 | #define _SRE_COMPILE_METHODDEF \ |
| 419 | {"compile", (PyCFunction)_sre_compile, METH_VARARGS|METH_KEYWORDS, _sre_compile__doc__}, |
| 420 | |
| 421 | static PyObject * |
| 422 | _sre_compile_impl(PyModuleDef *module, PyObject *pattern, int flags, |
| 423 | PyObject *code, Py_ssize_t groups, PyObject *groupindex, |
| 424 | PyObject *indexgroup); |
| 425 | |
| 426 | static PyObject * |
| 427 | _sre_compile(PyModuleDef *module, PyObject *args, PyObject *kwargs) |
| 428 | { |
| 429 | PyObject *return_value = NULL; |
| 430 | static char *_keywords[] = {"pattern", "flags", "code", "groups", "groupindex", "indexgroup", NULL}; |
| 431 | PyObject *pattern; |
| 432 | int flags; |
| 433 | PyObject *code; |
| 434 | Py_ssize_t groups; |
| 435 | PyObject *groupindex; |
| 436 | PyObject *indexgroup; |
| 437 | |
| 438 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO!nOO:compile", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 439 | &pattern, &flags, &PyList_Type, &code, &groups, &groupindex, &indexgroup)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 440 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 441 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 442 | return_value = _sre_compile_impl(module, pattern, flags, code, groups, groupindex, indexgroup); |
| 443 | |
| 444 | exit: |
| 445 | return return_value; |
| 446 | } |
| 447 | |
| 448 | PyDoc_STRVAR(_sre_SRE_Match_expand__doc__, |
| 449 | "expand($self, /, template)\n" |
| 450 | "--\n" |
| 451 | "\n" |
| 452 | "Return the string obtained by doing backslash substitution on the string template, as done by the sub() method."); |
| 453 | |
| 454 | #define _SRE_SRE_MATCH_EXPAND_METHODDEF \ |
| 455 | {"expand", (PyCFunction)_sre_SRE_Match_expand, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Match_expand__doc__}, |
| 456 | |
| 457 | static PyObject * |
| 458 | _sre_SRE_Match_expand_impl(MatchObject *self, PyObject *template); |
| 459 | |
| 460 | static PyObject * |
| 461 | _sre_SRE_Match_expand(MatchObject *self, PyObject *args, PyObject *kwargs) |
| 462 | { |
| 463 | PyObject *return_value = NULL; |
| 464 | static char *_keywords[] = {"template", NULL}; |
| 465 | PyObject *template; |
| 466 | |
| 467 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:expand", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 468 | &template)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 469 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 470 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 471 | return_value = _sre_SRE_Match_expand_impl(self, template); |
| 472 | |
| 473 | exit: |
| 474 | return return_value; |
| 475 | } |
| 476 | |
| 477 | PyDoc_STRVAR(_sre_SRE_Match_groups__doc__, |
| 478 | "groups($self, /, default=None)\n" |
| 479 | "--\n" |
| 480 | "\n" |
| 481 | "Return a tuple containing all the subgroups of the match, from 1.\n" |
| 482 | "\n" |
| 483 | " default\n" |
| 484 | " Is used for groups that did not participate in the match."); |
| 485 | |
| 486 | #define _SRE_SRE_MATCH_GROUPS_METHODDEF \ |
| 487 | {"groups", (PyCFunction)_sre_SRE_Match_groups, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Match_groups__doc__}, |
| 488 | |
| 489 | static PyObject * |
| 490 | _sre_SRE_Match_groups_impl(MatchObject *self, PyObject *default_value); |
| 491 | |
| 492 | static PyObject * |
| 493 | _sre_SRE_Match_groups(MatchObject *self, PyObject *args, PyObject *kwargs) |
| 494 | { |
| 495 | PyObject *return_value = NULL; |
| 496 | static char *_keywords[] = {"default", NULL}; |
| 497 | PyObject *default_value = Py_None; |
| 498 | |
| 499 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:groups", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 500 | &default_value)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 501 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 502 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 503 | return_value = _sre_SRE_Match_groups_impl(self, default_value); |
| 504 | |
| 505 | exit: |
| 506 | return return_value; |
| 507 | } |
| 508 | |
| 509 | PyDoc_STRVAR(_sre_SRE_Match_groupdict__doc__, |
| 510 | "groupdict($self, /, default=None)\n" |
| 511 | "--\n" |
| 512 | "\n" |
| 513 | "Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.\n" |
| 514 | "\n" |
| 515 | " default\n" |
| 516 | " Is used for groups that did not participate in the match."); |
| 517 | |
| 518 | #define _SRE_SRE_MATCH_GROUPDICT_METHODDEF \ |
| 519 | {"groupdict", (PyCFunction)_sre_SRE_Match_groupdict, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Match_groupdict__doc__}, |
| 520 | |
| 521 | static PyObject * |
| 522 | _sre_SRE_Match_groupdict_impl(MatchObject *self, PyObject *default_value); |
| 523 | |
| 524 | static PyObject * |
| 525 | _sre_SRE_Match_groupdict(MatchObject *self, PyObject *args, PyObject *kwargs) |
| 526 | { |
| 527 | PyObject *return_value = NULL; |
| 528 | static char *_keywords[] = {"default", NULL}; |
| 529 | PyObject *default_value = Py_None; |
| 530 | |
| 531 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:groupdict", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 532 | &default_value)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 533 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 534 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 535 | return_value = _sre_SRE_Match_groupdict_impl(self, default_value); |
| 536 | |
| 537 | exit: |
| 538 | return return_value; |
| 539 | } |
| 540 | |
| 541 | PyDoc_STRVAR(_sre_SRE_Match_start__doc__, |
| 542 | "start($self, group=0, /)\n" |
| 543 | "--\n" |
| 544 | "\n" |
| 545 | "Return index of the start of the substring matched by group."); |
| 546 | |
| 547 | #define _SRE_SRE_MATCH_START_METHODDEF \ |
| 548 | {"start", (PyCFunction)_sre_SRE_Match_start, METH_VARARGS, _sre_SRE_Match_start__doc__}, |
| 549 | |
| 550 | static Py_ssize_t |
| 551 | _sre_SRE_Match_start_impl(MatchObject *self, PyObject *group); |
| 552 | |
| 553 | static PyObject * |
| 554 | _sre_SRE_Match_start(MatchObject *self, PyObject *args) |
| 555 | { |
| 556 | PyObject *return_value = NULL; |
| 557 | PyObject *group = NULL; |
| 558 | Py_ssize_t _return_value; |
| 559 | |
| 560 | if (!PyArg_UnpackTuple(args, "start", |
| 561 | 0, 1, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 562 | &group)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 563 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 564 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 565 | _return_value = _sre_SRE_Match_start_impl(self, group); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 566 | if ((_return_value == -1) && PyErr_Occurred()) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 567 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 568 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 569 | return_value = PyLong_FromSsize_t(_return_value); |
| 570 | |
| 571 | exit: |
| 572 | return return_value; |
| 573 | } |
| 574 | |
| 575 | PyDoc_STRVAR(_sre_SRE_Match_end__doc__, |
| 576 | "end($self, group=0, /)\n" |
| 577 | "--\n" |
| 578 | "\n" |
| 579 | "Return index of the end of the substring matched by group."); |
| 580 | |
| 581 | #define _SRE_SRE_MATCH_END_METHODDEF \ |
| 582 | {"end", (PyCFunction)_sre_SRE_Match_end, METH_VARARGS, _sre_SRE_Match_end__doc__}, |
| 583 | |
| 584 | static Py_ssize_t |
| 585 | _sre_SRE_Match_end_impl(MatchObject *self, PyObject *group); |
| 586 | |
| 587 | static PyObject * |
| 588 | _sre_SRE_Match_end(MatchObject *self, PyObject *args) |
| 589 | { |
| 590 | PyObject *return_value = NULL; |
| 591 | PyObject *group = NULL; |
| 592 | Py_ssize_t _return_value; |
| 593 | |
| 594 | if (!PyArg_UnpackTuple(args, "end", |
| 595 | 0, 1, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 596 | &group)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 597 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 598 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 599 | _return_value = _sre_SRE_Match_end_impl(self, group); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 600 | if ((_return_value == -1) && PyErr_Occurred()) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 601 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 602 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 603 | return_value = PyLong_FromSsize_t(_return_value); |
| 604 | |
| 605 | exit: |
| 606 | return return_value; |
| 607 | } |
| 608 | |
| 609 | PyDoc_STRVAR(_sre_SRE_Match_span__doc__, |
| 610 | "span($self, group=0, /)\n" |
| 611 | "--\n" |
| 612 | "\n" |
| 613 | "For MatchObject m, return the 2-tuple (m.start(group), m.end(group))."); |
| 614 | |
| 615 | #define _SRE_SRE_MATCH_SPAN_METHODDEF \ |
| 616 | {"span", (PyCFunction)_sre_SRE_Match_span, METH_VARARGS, _sre_SRE_Match_span__doc__}, |
| 617 | |
| 618 | static PyObject * |
| 619 | _sre_SRE_Match_span_impl(MatchObject *self, PyObject *group); |
| 620 | |
| 621 | static PyObject * |
| 622 | _sre_SRE_Match_span(MatchObject *self, PyObject *args) |
| 623 | { |
| 624 | PyObject *return_value = NULL; |
| 625 | PyObject *group = NULL; |
| 626 | |
| 627 | if (!PyArg_UnpackTuple(args, "span", |
| 628 | 0, 1, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 629 | &group)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 630 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 631 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 632 | return_value = _sre_SRE_Match_span_impl(self, group); |
| 633 | |
| 634 | exit: |
| 635 | return return_value; |
| 636 | } |
| 637 | |
| 638 | PyDoc_STRVAR(_sre_SRE_Match___copy____doc__, |
| 639 | "__copy__($self, /)\n" |
| 640 | "--\n" |
| 641 | "\n"); |
| 642 | |
| 643 | #define _SRE_SRE_MATCH___COPY___METHODDEF \ |
| 644 | {"__copy__", (PyCFunction)_sre_SRE_Match___copy__, METH_NOARGS, _sre_SRE_Match___copy____doc__}, |
| 645 | |
| 646 | static PyObject * |
| 647 | _sre_SRE_Match___copy___impl(MatchObject *self); |
| 648 | |
| 649 | static PyObject * |
| 650 | _sre_SRE_Match___copy__(MatchObject *self, PyObject *Py_UNUSED(ignored)) |
| 651 | { |
| 652 | return _sre_SRE_Match___copy___impl(self); |
| 653 | } |
| 654 | |
| 655 | PyDoc_STRVAR(_sre_SRE_Match___deepcopy____doc__, |
| 656 | "__deepcopy__($self, /, memo)\n" |
| 657 | "--\n" |
| 658 | "\n"); |
| 659 | |
| 660 | #define _SRE_SRE_MATCH___DEEPCOPY___METHODDEF \ |
| 661 | {"__deepcopy__", (PyCFunction)_sre_SRE_Match___deepcopy__, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Match___deepcopy____doc__}, |
| 662 | |
| 663 | static PyObject * |
| 664 | _sre_SRE_Match___deepcopy___impl(MatchObject *self, PyObject *memo); |
| 665 | |
| 666 | static PyObject * |
| 667 | _sre_SRE_Match___deepcopy__(MatchObject *self, PyObject *args, PyObject *kwargs) |
| 668 | { |
| 669 | PyObject *return_value = NULL; |
| 670 | static char *_keywords[] = {"memo", NULL}; |
| 671 | PyObject *memo; |
| 672 | |
| 673 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:__deepcopy__", _keywords, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 674 | &memo)) { |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 675 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 676 | } |
Serhiy Storchaka | a860aea | 2015-05-03 15:54:23 +0300 | [diff] [blame] | 677 | return_value = _sre_SRE_Match___deepcopy___impl(self, memo); |
| 678 | |
| 679 | exit: |
| 680 | return return_value; |
| 681 | } |
| 682 | |
| 683 | PyDoc_STRVAR(_sre_SRE_Scanner_match__doc__, |
| 684 | "match($self, /)\n" |
| 685 | "--\n" |
| 686 | "\n"); |
| 687 | |
| 688 | #define _SRE_SRE_SCANNER_MATCH_METHODDEF \ |
| 689 | {"match", (PyCFunction)_sre_SRE_Scanner_match, METH_NOARGS, _sre_SRE_Scanner_match__doc__}, |
| 690 | |
| 691 | static PyObject * |
| 692 | _sre_SRE_Scanner_match_impl(ScannerObject *self); |
| 693 | |
| 694 | static PyObject * |
| 695 | _sre_SRE_Scanner_match(ScannerObject *self, PyObject *Py_UNUSED(ignored)) |
| 696 | { |
| 697 | return _sre_SRE_Scanner_match_impl(self); |
| 698 | } |
| 699 | |
| 700 | PyDoc_STRVAR(_sre_SRE_Scanner_search__doc__, |
| 701 | "search($self, /)\n" |
| 702 | "--\n" |
| 703 | "\n"); |
| 704 | |
| 705 | #define _SRE_SRE_SCANNER_SEARCH_METHODDEF \ |
| 706 | {"search", (PyCFunction)_sre_SRE_Scanner_search, METH_NOARGS, _sre_SRE_Scanner_search__doc__}, |
| 707 | |
| 708 | static PyObject * |
| 709 | _sre_SRE_Scanner_search_impl(ScannerObject *self); |
| 710 | |
| 711 | static PyObject * |
| 712 | _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored)) |
| 713 | { |
| 714 | return _sre_SRE_Scanner_search_impl(self); |
| 715 | } |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 716 | /*[clinic end generated code: output=00f7bf869b3283bc input=a9049054013a1b77]*/ |