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