12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505 |
- /*[clinic input]
- preserve
- [clinic start generated code]*/
- #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- # include "pycore_gc.h" // PyGC_Head
- # include "pycore_runtime.h" // _Py_ID()
- #endif
- PyDoc_STRVAR(_sre_getcodesize__doc__,
- "getcodesize($module, /)\n"
- "--\n"
- "\n");
- #define _SRE_GETCODESIZE_METHODDEF \
- {"getcodesize", (PyCFunction)_sre_getcodesize, METH_NOARGS, _sre_getcodesize__doc__},
- static int
- _sre_getcodesize_impl(PyObject *module);
- static PyObject *
- _sre_getcodesize(PyObject *module, PyObject *Py_UNUSED(ignored))
- {
- PyObject *return_value = NULL;
- int _return_value;
- _return_value = _sre_getcodesize_impl(module);
- if ((_return_value == -1) && PyErr_Occurred()) {
- goto exit;
- }
- return_value = PyLong_FromLong((long)_return_value);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_ascii_iscased__doc__,
- "ascii_iscased($module, character, /)\n"
- "--\n"
- "\n");
- #define _SRE_ASCII_ISCASED_METHODDEF \
- {"ascii_iscased", (PyCFunction)_sre_ascii_iscased, METH_O, _sre_ascii_iscased__doc__},
- static int
- _sre_ascii_iscased_impl(PyObject *module, int character);
- static PyObject *
- _sre_ascii_iscased(PyObject *module, PyObject *arg)
- {
- PyObject *return_value = NULL;
- int character;
- int _return_value;
- character = _PyLong_AsInt(arg);
- if (character == -1 && PyErr_Occurred()) {
- goto exit;
- }
- _return_value = _sre_ascii_iscased_impl(module, character);
- if ((_return_value == -1) && PyErr_Occurred()) {
- goto exit;
- }
- return_value = PyBool_FromLong((long)_return_value);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_unicode_iscased__doc__,
- "unicode_iscased($module, character, /)\n"
- "--\n"
- "\n");
- #define _SRE_UNICODE_ISCASED_METHODDEF \
- {"unicode_iscased", (PyCFunction)_sre_unicode_iscased, METH_O, _sre_unicode_iscased__doc__},
- static int
- _sre_unicode_iscased_impl(PyObject *module, int character);
- static PyObject *
- _sre_unicode_iscased(PyObject *module, PyObject *arg)
- {
- PyObject *return_value = NULL;
- int character;
- int _return_value;
- character = _PyLong_AsInt(arg);
- if (character == -1 && PyErr_Occurred()) {
- goto exit;
- }
- _return_value = _sre_unicode_iscased_impl(module, character);
- if ((_return_value == -1) && PyErr_Occurred()) {
- goto exit;
- }
- return_value = PyBool_FromLong((long)_return_value);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_ascii_tolower__doc__,
- "ascii_tolower($module, character, /)\n"
- "--\n"
- "\n");
- #define _SRE_ASCII_TOLOWER_METHODDEF \
- {"ascii_tolower", (PyCFunction)_sre_ascii_tolower, METH_O, _sre_ascii_tolower__doc__},
- static int
- _sre_ascii_tolower_impl(PyObject *module, int character);
- static PyObject *
- _sre_ascii_tolower(PyObject *module, PyObject *arg)
- {
- PyObject *return_value = NULL;
- int character;
- int _return_value;
- character = _PyLong_AsInt(arg);
- if (character == -1 && PyErr_Occurred()) {
- goto exit;
- }
- _return_value = _sre_ascii_tolower_impl(module, character);
- if ((_return_value == -1) && PyErr_Occurred()) {
- goto exit;
- }
- return_value = PyLong_FromLong((long)_return_value);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_unicode_tolower__doc__,
- "unicode_tolower($module, character, /)\n"
- "--\n"
- "\n");
- #define _SRE_UNICODE_TOLOWER_METHODDEF \
- {"unicode_tolower", (PyCFunction)_sre_unicode_tolower, METH_O, _sre_unicode_tolower__doc__},
- static int
- _sre_unicode_tolower_impl(PyObject *module, int character);
- static PyObject *
- _sre_unicode_tolower(PyObject *module, PyObject *arg)
- {
- PyObject *return_value = NULL;
- int character;
- int _return_value;
- character = _PyLong_AsInt(arg);
- if (character == -1 && PyErr_Occurred()) {
- goto exit;
- }
- _return_value = _sre_unicode_tolower_impl(module, character);
- if ((_return_value == -1) && PyErr_Occurred()) {
- goto exit;
- }
- return_value = PyLong_FromLong((long)_return_value);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Pattern_match__doc__,
- "match($self, /, string, pos=0, endpos=sys.maxsize)\n"
- "--\n"
- "\n"
- "Matches zero or more characters at the beginning of the string.");
- #define _SRE_SRE_PATTERN_MATCH_METHODDEF \
- {"match", _PyCFunction_CAST(_sre_SRE_Pattern_match), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_match__doc__},
- static PyObject *
- _sre_SRE_Pattern_match_impl(PatternObject *self, PyTypeObject *cls,
- PyObject *string, Py_ssize_t pos,
- Py_ssize_t endpos);
- static PyObject *
- _sre_SRE_Pattern_match(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- PyObject *return_value = NULL;
- #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 3
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_item = { &_Py_ID(string), &_Py_ID(pos), &_Py_ID(endpos), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
- #else // !Py_BUILD_CORE
- # define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
- static _PyArg_Parser _parser = {
- .keywords = _keywords,
- .fname = "match",
- .kwtuple = KWTUPLE,
- };
- #undef KWTUPLE
- PyObject *argsbuf[3];
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
- PyObject *string;
- Py_ssize_t pos = 0;
- Py_ssize_t endpos = PY_SSIZE_T_MAX;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
- if (!args) {
- goto exit;
- }
- string = args[0];
- if (!noptargs) {
- goto skip_optional_pos;
- }
- if (args[1]) {
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[1]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- pos = ival;
- }
- if (!--noptargs) {
- goto skip_optional_pos;
- }
- }
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[2]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- endpos = ival;
- }
- skip_optional_pos:
- return_value = _sre_SRE_Pattern_match_impl(self, cls, string, pos, endpos);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Pattern_fullmatch__doc__,
- "fullmatch($self, /, string, pos=0, endpos=sys.maxsize)\n"
- "--\n"
- "\n"
- "Matches against all of the string.");
- #define _SRE_SRE_PATTERN_FULLMATCH_METHODDEF \
- {"fullmatch", _PyCFunction_CAST(_sre_SRE_Pattern_fullmatch), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_fullmatch__doc__},
- static PyObject *
- _sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyTypeObject *cls,
- PyObject *string, Py_ssize_t pos,
- Py_ssize_t endpos);
- static PyObject *
- _sre_SRE_Pattern_fullmatch(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- PyObject *return_value = NULL;
- #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 3
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_item = { &_Py_ID(string), &_Py_ID(pos), &_Py_ID(endpos), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
- #else // !Py_BUILD_CORE
- # define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
- static _PyArg_Parser _parser = {
- .keywords = _keywords,
- .fname = "fullmatch",
- .kwtuple = KWTUPLE,
- };
- #undef KWTUPLE
- PyObject *argsbuf[3];
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
- PyObject *string;
- Py_ssize_t pos = 0;
- Py_ssize_t endpos = PY_SSIZE_T_MAX;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
- if (!args) {
- goto exit;
- }
- string = args[0];
- if (!noptargs) {
- goto skip_optional_pos;
- }
- if (args[1]) {
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[1]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- pos = ival;
- }
- if (!--noptargs) {
- goto skip_optional_pos;
- }
- }
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[2]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- endpos = ival;
- }
- skip_optional_pos:
- return_value = _sre_SRE_Pattern_fullmatch_impl(self, cls, string, pos, endpos);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Pattern_search__doc__,
- "search($self, /, string, pos=0, endpos=sys.maxsize)\n"
- "--\n"
- "\n"
- "Scan through string looking for a match, and return a corresponding match object instance.\n"
- "\n"
- "Return None if no position in the string matches.");
- #define _SRE_SRE_PATTERN_SEARCH_METHODDEF \
- {"search", _PyCFunction_CAST(_sre_SRE_Pattern_search), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_search__doc__},
- static PyObject *
- _sre_SRE_Pattern_search_impl(PatternObject *self, PyTypeObject *cls,
- PyObject *string, Py_ssize_t pos,
- Py_ssize_t endpos);
- static PyObject *
- _sre_SRE_Pattern_search(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- PyObject *return_value = NULL;
- #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 3
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_item = { &_Py_ID(string), &_Py_ID(pos), &_Py_ID(endpos), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
- #else // !Py_BUILD_CORE
- # define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
- static _PyArg_Parser _parser = {
- .keywords = _keywords,
- .fname = "search",
- .kwtuple = KWTUPLE,
- };
- #undef KWTUPLE
- PyObject *argsbuf[3];
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
- PyObject *string;
- Py_ssize_t pos = 0;
- Py_ssize_t endpos = PY_SSIZE_T_MAX;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
- if (!args) {
- goto exit;
- }
- string = args[0];
- if (!noptargs) {
- goto skip_optional_pos;
- }
- if (args[1]) {
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[1]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- pos = ival;
- }
- if (!--noptargs) {
- goto skip_optional_pos;
- }
- }
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[2]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- endpos = ival;
- }
- skip_optional_pos:
- return_value = _sre_SRE_Pattern_search_impl(self, cls, string, pos, endpos);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Pattern_findall__doc__,
- "findall($self, /, string, pos=0, endpos=sys.maxsize)\n"
- "--\n"
- "\n"
- "Return a list of all non-overlapping matches of pattern in string.");
- #define _SRE_SRE_PATTERN_FINDALL_METHODDEF \
- {"findall", _PyCFunction_CAST(_sre_SRE_Pattern_findall), METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_findall__doc__},
- static PyObject *
- _sre_SRE_Pattern_findall_impl(PatternObject *self, PyObject *string,
- Py_ssize_t pos, Py_ssize_t endpos);
- static PyObject *
- _sre_SRE_Pattern_findall(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- PyObject *return_value = NULL;
- #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 3
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_item = { &_Py_ID(string), &_Py_ID(pos), &_Py_ID(endpos), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
- #else // !Py_BUILD_CORE
- # define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
- static _PyArg_Parser _parser = {
- .keywords = _keywords,
- .fname = "findall",
- .kwtuple = KWTUPLE,
- };
- #undef KWTUPLE
- PyObject *argsbuf[3];
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
- PyObject *string;
- Py_ssize_t pos = 0;
- Py_ssize_t endpos = PY_SSIZE_T_MAX;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
- if (!args) {
- goto exit;
- }
- string = args[0];
- if (!noptargs) {
- goto skip_optional_pos;
- }
- if (args[1]) {
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[1]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- pos = ival;
- }
- if (!--noptargs) {
- goto skip_optional_pos;
- }
- }
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[2]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- endpos = ival;
- }
- skip_optional_pos:
- return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Pattern_finditer__doc__,
- "finditer($self, /, string, pos=0, endpos=sys.maxsize)\n"
- "--\n"
- "\n"
- "Return an iterator over all non-overlapping matches for the RE pattern in string.\n"
- "\n"
- "For each match, the iterator returns a match object.");
- #define _SRE_SRE_PATTERN_FINDITER_METHODDEF \
- {"finditer", _PyCFunction_CAST(_sre_SRE_Pattern_finditer), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_finditer__doc__},
- static PyObject *
- _sre_SRE_Pattern_finditer_impl(PatternObject *self, PyTypeObject *cls,
- PyObject *string, Py_ssize_t pos,
- Py_ssize_t endpos);
- static PyObject *
- _sre_SRE_Pattern_finditer(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- PyObject *return_value = NULL;
- #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 3
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_item = { &_Py_ID(string), &_Py_ID(pos), &_Py_ID(endpos), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
- #else // !Py_BUILD_CORE
- # define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
- static _PyArg_Parser _parser = {
- .keywords = _keywords,
- .fname = "finditer",
- .kwtuple = KWTUPLE,
- };
- #undef KWTUPLE
- PyObject *argsbuf[3];
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
- PyObject *string;
- Py_ssize_t pos = 0;
- Py_ssize_t endpos = PY_SSIZE_T_MAX;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
- if (!args) {
- goto exit;
- }
- string = args[0];
- if (!noptargs) {
- goto skip_optional_pos;
- }
- if (args[1]) {
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[1]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- pos = ival;
- }
- if (!--noptargs) {
- goto skip_optional_pos;
- }
- }
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[2]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- endpos = ival;
- }
- skip_optional_pos:
- return_value = _sre_SRE_Pattern_finditer_impl(self, cls, string, pos, endpos);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Pattern_scanner__doc__,
- "scanner($self, /, string, pos=0, endpos=sys.maxsize)\n"
- "--\n"
- "\n");
- #define _SRE_SRE_PATTERN_SCANNER_METHODDEF \
- {"scanner", _PyCFunction_CAST(_sre_SRE_Pattern_scanner), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_scanner__doc__},
- static PyObject *
- _sre_SRE_Pattern_scanner_impl(PatternObject *self, PyTypeObject *cls,
- PyObject *string, Py_ssize_t pos,
- Py_ssize_t endpos);
- static PyObject *
- _sre_SRE_Pattern_scanner(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- PyObject *return_value = NULL;
- #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 3
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_item = { &_Py_ID(string), &_Py_ID(pos), &_Py_ID(endpos), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
- #else // !Py_BUILD_CORE
- # define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
- static _PyArg_Parser _parser = {
- .keywords = _keywords,
- .fname = "scanner",
- .kwtuple = KWTUPLE,
- };
- #undef KWTUPLE
- PyObject *argsbuf[3];
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
- PyObject *string;
- Py_ssize_t pos = 0;
- Py_ssize_t endpos = PY_SSIZE_T_MAX;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
- if (!args) {
- goto exit;
- }
- string = args[0];
- if (!noptargs) {
- goto skip_optional_pos;
- }
- if (args[1]) {
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[1]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- pos = ival;
- }
- if (!--noptargs) {
- goto skip_optional_pos;
- }
- }
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[2]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- endpos = ival;
- }
- skip_optional_pos:
- return_value = _sre_SRE_Pattern_scanner_impl(self, cls, string, pos, endpos);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Pattern_split__doc__,
- "split($self, /, string, maxsplit=0)\n"
- "--\n"
- "\n"
- "Split string by the occurrences of pattern.");
- #define _SRE_SRE_PATTERN_SPLIT_METHODDEF \
- {"split", _PyCFunction_CAST(_sre_SRE_Pattern_split), METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_split__doc__},
- static PyObject *
- _sre_SRE_Pattern_split_impl(PatternObject *self, PyObject *string,
- Py_ssize_t maxsplit);
- static PyObject *
- _sre_SRE_Pattern_split(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- PyObject *return_value = NULL;
- #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 2
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_item = { &_Py_ID(string), &_Py_ID(maxsplit), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
- #else // !Py_BUILD_CORE
- # define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"string", "maxsplit", NULL};
- static _PyArg_Parser _parser = {
- .keywords = _keywords,
- .fname = "split",
- .kwtuple = KWTUPLE,
- };
- #undef KWTUPLE
- PyObject *argsbuf[2];
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
- PyObject *string;
- Py_ssize_t maxsplit = 0;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
- if (!args) {
- goto exit;
- }
- string = args[0];
- if (!noptargs) {
- goto skip_optional_pos;
- }
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[1]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- maxsplit = ival;
- }
- skip_optional_pos:
- return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Pattern_sub__doc__,
- "sub($self, /, repl, string, count=0)\n"
- "--\n"
- "\n"
- "Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.");
- #define _SRE_SRE_PATTERN_SUB_METHODDEF \
- {"sub", _PyCFunction_CAST(_sre_SRE_Pattern_sub), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_sub__doc__},
- static PyObject *
- _sre_SRE_Pattern_sub_impl(PatternObject *self, PyTypeObject *cls,
- PyObject *repl, PyObject *string, Py_ssize_t count);
- static PyObject *
- _sre_SRE_Pattern_sub(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- PyObject *return_value = NULL;
- #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 3
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_item = { &_Py_ID(repl), &_Py_ID(string), &_Py_ID(count), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
- #else // !Py_BUILD_CORE
- # define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"repl", "string", "count", NULL};
- static _PyArg_Parser _parser = {
- .keywords = _keywords,
- .fname = "sub",
- .kwtuple = KWTUPLE,
- };
- #undef KWTUPLE
- PyObject *argsbuf[3];
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
- PyObject *repl;
- PyObject *string;
- Py_ssize_t count = 0;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
- if (!args) {
- goto exit;
- }
- repl = args[0];
- string = args[1];
- if (!noptargs) {
- goto skip_optional_pos;
- }
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[2]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- count = ival;
- }
- skip_optional_pos:
- return_value = _sre_SRE_Pattern_sub_impl(self, cls, repl, string, count);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Pattern_subn__doc__,
- "subn($self, /, repl, string, count=0)\n"
- "--\n"
- "\n"
- "Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl.");
- #define _SRE_SRE_PATTERN_SUBN_METHODDEF \
- {"subn", _PyCFunction_CAST(_sre_SRE_Pattern_subn), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_subn__doc__},
- static PyObject *
- _sre_SRE_Pattern_subn_impl(PatternObject *self, PyTypeObject *cls,
- PyObject *repl, PyObject *string,
- Py_ssize_t count);
- static PyObject *
- _sre_SRE_Pattern_subn(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- PyObject *return_value = NULL;
- #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 3
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_item = { &_Py_ID(repl), &_Py_ID(string), &_Py_ID(count), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
- #else // !Py_BUILD_CORE
- # define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"repl", "string", "count", NULL};
- static _PyArg_Parser _parser = {
- .keywords = _keywords,
- .fname = "subn",
- .kwtuple = KWTUPLE,
- };
- #undef KWTUPLE
- PyObject *argsbuf[3];
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
- PyObject *repl;
- PyObject *string;
- Py_ssize_t count = 0;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
- if (!args) {
- goto exit;
- }
- repl = args[0];
- string = args[1];
- if (!noptargs) {
- goto skip_optional_pos;
- }
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[2]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- count = ival;
- }
- skip_optional_pos:
- return_value = _sre_SRE_Pattern_subn_impl(self, cls, repl, string, count);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Pattern___copy____doc__,
- "__copy__($self, /)\n"
- "--\n"
- "\n");
- #define _SRE_SRE_PATTERN___COPY___METHODDEF \
- {"__copy__", (PyCFunction)_sre_SRE_Pattern___copy__, METH_NOARGS, _sre_SRE_Pattern___copy____doc__},
- static PyObject *
- _sre_SRE_Pattern___copy___impl(PatternObject *self);
- static PyObject *
- _sre_SRE_Pattern___copy__(PatternObject *self, PyObject *Py_UNUSED(ignored))
- {
- return _sre_SRE_Pattern___copy___impl(self);
- }
- PyDoc_STRVAR(_sre_SRE_Pattern___deepcopy____doc__,
- "__deepcopy__($self, memo, /)\n"
- "--\n"
- "\n");
- #define _SRE_SRE_PATTERN___DEEPCOPY___METHODDEF \
- {"__deepcopy__", (PyCFunction)_sre_SRE_Pattern___deepcopy__, METH_O, _sre_SRE_Pattern___deepcopy____doc__},
- #if defined(Py_DEBUG)
- PyDoc_STRVAR(_sre_SRE_Pattern__fail_after__doc__,
- "_fail_after($self, count, exception, /)\n"
- "--\n"
- "\n"
- "For debugging.");
- #define _SRE_SRE_PATTERN__FAIL_AFTER_METHODDEF \
- {"_fail_after", _PyCFunction_CAST(_sre_SRE_Pattern__fail_after), METH_FASTCALL, _sre_SRE_Pattern__fail_after__doc__},
- static PyObject *
- _sre_SRE_Pattern__fail_after_impl(PatternObject *self, int count,
- PyObject *exception);
- static PyObject *
- _sre_SRE_Pattern__fail_after(PatternObject *self, PyObject *const *args, Py_ssize_t nargs)
- {
- PyObject *return_value = NULL;
- int count;
- PyObject *exception;
- if (!_PyArg_CheckPositional("_fail_after", nargs, 2, 2)) {
- goto exit;
- }
- count = _PyLong_AsInt(args[0]);
- if (count == -1 && PyErr_Occurred()) {
- goto exit;
- }
- exception = args[1];
- return_value = _sre_SRE_Pattern__fail_after_impl(self, count, exception);
- exit:
- return return_value;
- }
- #endif /* defined(Py_DEBUG) */
- PyDoc_STRVAR(_sre_compile__doc__,
- "compile($module, /, pattern, flags, code, groups, groupindex,\n"
- " indexgroup)\n"
- "--\n"
- "\n");
- #define _SRE_COMPILE_METHODDEF \
- {"compile", _PyCFunction_CAST(_sre_compile), METH_FASTCALL|METH_KEYWORDS, _sre_compile__doc__},
- static PyObject *
- _sre_compile_impl(PyObject *module, PyObject *pattern, int flags,
- PyObject *code, Py_ssize_t groups, PyObject *groupindex,
- PyObject *indexgroup);
- static PyObject *
- _sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- PyObject *return_value = NULL;
- #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 6
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_item = { &_Py_ID(pattern), &_Py_ID(flags), &_Py_ID(code), &_Py_ID(groups), &_Py_ID(groupindex), &_Py_ID(indexgroup), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
- #else // !Py_BUILD_CORE
- # define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"pattern", "flags", "code", "groups", "groupindex", "indexgroup", NULL};
- static _PyArg_Parser _parser = {
- .keywords = _keywords,
- .fname = "compile",
- .kwtuple = KWTUPLE,
- };
- #undef KWTUPLE
- PyObject *argsbuf[6];
- PyObject *pattern;
- int flags;
- PyObject *code;
- Py_ssize_t groups;
- PyObject *groupindex;
- PyObject *indexgroup;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 6, 6, 0, argsbuf);
- if (!args) {
- goto exit;
- }
- pattern = args[0];
- flags = _PyLong_AsInt(args[1]);
- if (flags == -1 && PyErr_Occurred()) {
- goto exit;
- }
- if (!PyList_Check(args[2])) {
- _PyArg_BadArgument("compile", "argument 'code'", "list", args[2]);
- goto exit;
- }
- code = args[2];
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = _PyNumber_Index(args[3]);
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- groups = ival;
- }
- if (!PyDict_Check(args[4])) {
- _PyArg_BadArgument("compile", "argument 'groupindex'", "dict", args[4]);
- goto exit;
- }
- groupindex = args[4];
- if (!PyTuple_Check(args[5])) {
- _PyArg_BadArgument("compile", "argument 'indexgroup'", "tuple", args[5]);
- goto exit;
- }
- indexgroup = args[5];
- return_value = _sre_compile_impl(module, pattern, flags, code, groups, groupindex, indexgroup);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_template__doc__,
- "template($module, pattern, template, /)\n"
- "--\n"
- "\n"
- "\n"
- "\n"
- " template\n"
- " A list containing interleaved literal strings (str or bytes) and group\n"
- " indices (int), as returned by re._parser.parse_template():\n"
- " [literal1, group1, ..., literalN, groupN]");
- #define _SRE_TEMPLATE_METHODDEF \
- {"template", _PyCFunction_CAST(_sre_template), METH_FASTCALL, _sre_template__doc__},
- static PyObject *
- _sre_template_impl(PyObject *module, PyObject *pattern, PyObject *template);
- static PyObject *
- _sre_template(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
- {
- PyObject *return_value = NULL;
- PyObject *pattern;
- PyObject *template;
- if (!_PyArg_CheckPositional("template", nargs, 2, 2)) {
- goto exit;
- }
- pattern = args[0];
- if (!PyList_Check(args[1])) {
- _PyArg_BadArgument("template", "argument 2", "list", args[1]);
- goto exit;
- }
- template = args[1];
- return_value = _sre_template_impl(module, pattern, template);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Match_expand__doc__,
- "expand($self, /, template)\n"
- "--\n"
- "\n"
- "Return the string obtained by doing backslash substitution on the string template, as done by the sub() method.");
- #define _SRE_SRE_MATCH_EXPAND_METHODDEF \
- {"expand", _PyCFunction_CAST(_sre_SRE_Match_expand), METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_expand__doc__},
- static PyObject *
- _sre_SRE_Match_expand_impl(MatchObject *self, PyObject *template);
- static PyObject *
- _sre_SRE_Match_expand(MatchObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- PyObject *return_value = NULL;
- #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 1
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_item = { &_Py_ID(template), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
- #else // !Py_BUILD_CORE
- # define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"template", NULL};
- static _PyArg_Parser _parser = {
- .keywords = _keywords,
- .fname = "expand",
- .kwtuple = KWTUPLE,
- };
- #undef KWTUPLE
- PyObject *argsbuf[1];
- PyObject *template;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
- if (!args) {
- goto exit;
- }
- template = args[0];
- return_value = _sre_SRE_Match_expand_impl(self, template);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Match_groups__doc__,
- "groups($self, /, default=None)\n"
- "--\n"
- "\n"
- "Return a tuple containing all the subgroups of the match, from 1.\n"
- "\n"
- " default\n"
- " Is used for groups that did not participate in the match.");
- #define _SRE_SRE_MATCH_GROUPS_METHODDEF \
- {"groups", _PyCFunction_CAST(_sre_SRE_Match_groups), METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_groups__doc__},
- static PyObject *
- _sre_SRE_Match_groups_impl(MatchObject *self, PyObject *default_value);
- static PyObject *
- _sre_SRE_Match_groups(MatchObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- PyObject *return_value = NULL;
- #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 1
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_item = { &_Py_ID(default), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
- #else // !Py_BUILD_CORE
- # define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"default", NULL};
- static _PyArg_Parser _parser = {
- .keywords = _keywords,
- .fname = "groups",
- .kwtuple = KWTUPLE,
- };
- #undef KWTUPLE
- PyObject *argsbuf[1];
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
- PyObject *default_value = Py_None;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
- if (!args) {
- goto exit;
- }
- if (!noptargs) {
- goto skip_optional_pos;
- }
- default_value = args[0];
- skip_optional_pos:
- return_value = _sre_SRE_Match_groups_impl(self, default_value);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Match_groupdict__doc__,
- "groupdict($self, /, default=None)\n"
- "--\n"
- "\n"
- "Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.\n"
- "\n"
- " default\n"
- " Is used for groups that did not participate in the match.");
- #define _SRE_SRE_MATCH_GROUPDICT_METHODDEF \
- {"groupdict", _PyCFunction_CAST(_sre_SRE_Match_groupdict), METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_groupdict__doc__},
- static PyObject *
- _sre_SRE_Match_groupdict_impl(MatchObject *self, PyObject *default_value);
- static PyObject *
- _sre_SRE_Match_groupdict(MatchObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- PyObject *return_value = NULL;
- #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 1
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_item = { &_Py_ID(default), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
- #else // !Py_BUILD_CORE
- # define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"default", NULL};
- static _PyArg_Parser _parser = {
- .keywords = _keywords,
- .fname = "groupdict",
- .kwtuple = KWTUPLE,
- };
- #undef KWTUPLE
- PyObject *argsbuf[1];
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
- PyObject *default_value = Py_None;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
- if (!args) {
- goto exit;
- }
- if (!noptargs) {
- goto skip_optional_pos;
- }
- default_value = args[0];
- skip_optional_pos:
- return_value = _sre_SRE_Match_groupdict_impl(self, default_value);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Match_start__doc__,
- "start($self, group=0, /)\n"
- "--\n"
- "\n"
- "Return index of the start of the substring matched by group.");
- #define _SRE_SRE_MATCH_START_METHODDEF \
- {"start", _PyCFunction_CAST(_sre_SRE_Match_start), METH_FASTCALL, _sre_SRE_Match_start__doc__},
- static Py_ssize_t
- _sre_SRE_Match_start_impl(MatchObject *self, PyObject *group);
- static PyObject *
- _sre_SRE_Match_start(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
- {
- PyObject *return_value = NULL;
- PyObject *group = NULL;
- Py_ssize_t _return_value;
- if (!_PyArg_CheckPositional("start", nargs, 0, 1)) {
- goto exit;
- }
- if (nargs < 1) {
- goto skip_optional;
- }
- group = args[0];
- skip_optional:
- _return_value = _sre_SRE_Match_start_impl(self, group);
- if ((_return_value == -1) && PyErr_Occurred()) {
- goto exit;
- }
- return_value = PyLong_FromSsize_t(_return_value);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Match_end__doc__,
- "end($self, group=0, /)\n"
- "--\n"
- "\n"
- "Return index of the end of the substring matched by group.");
- #define _SRE_SRE_MATCH_END_METHODDEF \
- {"end", _PyCFunction_CAST(_sre_SRE_Match_end), METH_FASTCALL, _sre_SRE_Match_end__doc__},
- static Py_ssize_t
- _sre_SRE_Match_end_impl(MatchObject *self, PyObject *group);
- static PyObject *
- _sre_SRE_Match_end(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
- {
- PyObject *return_value = NULL;
- PyObject *group = NULL;
- Py_ssize_t _return_value;
- if (!_PyArg_CheckPositional("end", nargs, 0, 1)) {
- goto exit;
- }
- if (nargs < 1) {
- goto skip_optional;
- }
- group = args[0];
- skip_optional:
- _return_value = _sre_SRE_Match_end_impl(self, group);
- if ((_return_value == -1) && PyErr_Occurred()) {
- goto exit;
- }
- return_value = PyLong_FromSsize_t(_return_value);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Match_span__doc__,
- "span($self, group=0, /)\n"
- "--\n"
- "\n"
- "For match object m, return the 2-tuple (m.start(group), m.end(group)).");
- #define _SRE_SRE_MATCH_SPAN_METHODDEF \
- {"span", _PyCFunction_CAST(_sre_SRE_Match_span), METH_FASTCALL, _sre_SRE_Match_span__doc__},
- static PyObject *
- _sre_SRE_Match_span_impl(MatchObject *self, PyObject *group);
- static PyObject *
- _sre_SRE_Match_span(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
- {
- PyObject *return_value = NULL;
- PyObject *group = NULL;
- if (!_PyArg_CheckPositional("span", nargs, 0, 1)) {
- goto exit;
- }
- if (nargs < 1) {
- goto skip_optional;
- }
- group = args[0];
- skip_optional:
- return_value = _sre_SRE_Match_span_impl(self, group);
- exit:
- return return_value;
- }
- PyDoc_STRVAR(_sre_SRE_Match___copy____doc__,
- "__copy__($self, /)\n"
- "--\n"
- "\n");
- #define _SRE_SRE_MATCH___COPY___METHODDEF \
- {"__copy__", (PyCFunction)_sre_SRE_Match___copy__, METH_NOARGS, _sre_SRE_Match___copy____doc__},
- static PyObject *
- _sre_SRE_Match___copy___impl(MatchObject *self);
- static PyObject *
- _sre_SRE_Match___copy__(MatchObject *self, PyObject *Py_UNUSED(ignored))
- {
- return _sre_SRE_Match___copy___impl(self);
- }
- PyDoc_STRVAR(_sre_SRE_Match___deepcopy____doc__,
- "__deepcopy__($self, memo, /)\n"
- "--\n"
- "\n");
- #define _SRE_SRE_MATCH___DEEPCOPY___METHODDEF \
- {"__deepcopy__", (PyCFunction)_sre_SRE_Match___deepcopy__, METH_O, _sre_SRE_Match___deepcopy____doc__},
- PyDoc_STRVAR(_sre_SRE_Scanner_match__doc__,
- "match($self, /)\n"
- "--\n"
- "\n");
- #define _SRE_SRE_SCANNER_MATCH_METHODDEF \
- {"match", _PyCFunction_CAST(_sre_SRE_Scanner_match), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Scanner_match__doc__},
- static PyObject *
- _sre_SRE_Scanner_match_impl(ScannerObject *self, PyTypeObject *cls);
- static PyObject *
- _sre_SRE_Scanner_match(ScannerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
- PyErr_SetString(PyExc_TypeError, "match() takes no arguments");
- return NULL;
- }
- return _sre_SRE_Scanner_match_impl(self, cls);
- }
- PyDoc_STRVAR(_sre_SRE_Scanner_search__doc__,
- "search($self, /)\n"
- "--\n"
- "\n");
- #define _SRE_SRE_SCANNER_SEARCH_METHODDEF \
- {"search", _PyCFunction_CAST(_sre_SRE_Scanner_search), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Scanner_search__doc__},
- static PyObject *
- _sre_SRE_Scanner_search_impl(ScannerObject *self, PyTypeObject *cls);
- static PyObject *
- _sre_SRE_Scanner_search(ScannerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
- {
- if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
- PyErr_SetString(PyExc_TypeError, "search() takes no arguments");
- return NULL;
- }
- return _sre_SRE_Scanner_search_impl(self, cls);
- }
- #ifndef _SRE_SRE_PATTERN__FAIL_AFTER_METHODDEF
- #define _SRE_SRE_PATTERN__FAIL_AFTER_METHODDEF
- #endif /* !defined(_SRE_SRE_PATTERN__FAIL_AFTER_METHODDEF) */
- /*[clinic end generated code: output=2165ecf43a7c20e8 input=a9049054013a1b77]*/
|