Lines Matching defs:string

371 getstring(PyObject* string, Py_ssize_t* p_length,
377 is not a string (or not compatible) */
381 if (PyUnicode_Check(string)) {
382 if (PyUnicode_READY(string) == -1)
384 *p_length = PyUnicode_GET_LENGTH(string);
385 *p_charsize = PyUnicode_KIND(string);
387 return PyUnicode_DATA(string);
390 /* get pointer to byte string buffer */
391 if (PyObject_GetBuffer(string, view, PyBUF_SIMPLE) != 0) {
392 PyErr_Format(PyExc_TypeError, "expected string or bytes-like "
393 "object, got '%.200s'", Py_TYPE(string)->tp_name);
411 state_init(SRE_STATE* state, PatternObject* pattern, PyObject* string,
431 ptr = getstring(string, &length, &isbytes, &charsize, &state->buffer);
437 "cannot use a string pattern on a bytes-like object");
442 "cannot use a bytes pattern on a string-like object");
467 Py_INCREF(string);
468 state->string = string;
472 return string;
489 Py_XDECREF(state->string);
496 /* calculate offset from start of string */
502 PyObject* string, Py_ssize_t start, Py_ssize_t end)
505 if (PyBytes_CheckExact(string) &&
506 start == 0 && end == PyBytes_GET_SIZE(string)) {
507 Py_INCREF(string);
508 return string;
514 return PyUnicode_Substring(string, start, end);
519 state_getslice(SRE_STATE* state, Py_ssize_t index, PyObject* string, int empty)
525 if (string == Py_None || index >= state->lastmark || !state->mark[index] || !state->mark[index+1]) {
527 /* want empty string */
545 return getslice(state->isbytes, state->beginning, string, i, j);
634 string: object
638 Matches zero or more characters at the beginning of the string.
643 PyObject *string, Py_ssize_t pos,
652 if (!state_init(&state, (PatternObject *)self, string, pos, endpos))
677 string: object
681 Matches against all of the string.
686 PyObject *string, Py_ssize_t pos,
695 if (!state_init(&state, self, string, pos, endpos))
721 string: object
725 Scan through string looking for a match, and return a corresponding match object instance.
727 Return None if no position in the string matches.
732 PyObject *string, Py_ssize_t pos,
741 if (!state_init(&state, self, string, pos, endpos))
790 string: object
794 Return a list of all non-overlapping matches of pattern in string.
798 _sre_SRE_Pattern_findall_impl(PatternObject *self, PyObject *string,
807 if (!state_init(&state, self, string, pos, endpos))
841 string, b, e);
846 item = state_getslice(&state, 1, string, 1);
855 PyObject* o = state_getslice(&state, i+1, string, 1);
889 string: object
893 Return an iterator over all non-overlapping matches for the RE pattern in string.
900 PyObject *string, Py_ssize_t pos,
909 scanner = pattern_scanner(module_state, self, string, pos, endpos);
929 string: object
937 PyObject *string, Py_ssize_t pos,
943 return pattern_scanner(module_state, self, string, pos, endpos);
949 string: object
952 Split string by the occurrences of pattern.
956 _sre_SRE_Pattern_split_impl(PatternObject *self, PyObject *string,
970 if (!state_init(&state, self, string, 0, PY_SSIZE_T_MAX))
1001 string, STATE_OFFSET(&state, last),
1013 item = state_getslice(&state, i+1, string, 0);
1030 string, STATE_OFFSET(&state, last), state.endpos
1053 PyObject* string,
1077 /* if not callable, check if it's a literal string */
1108 if (!state_init(&state, self, string, 0, PY_SSIZE_T_MAX)) {
1145 string, i, b);
1165 /* filter is literal string */
1187 string, i, state.endpos);
1200 /* convert list to single string (also removes list) */
1201 joiner = getslice(state.isbytes, state.beginning, string, 0, 0);
1240 string: object
1243 Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.
1248 PyObject *repl, PyObject *string, Py_ssize_t count)
1253 return pattern_subx(module_state, self, repl, string, count, 0);
1262 string: object
1270 PyObject *repl, PyObject *string,
1276 return pattern_subx(module_state, self, repl, string, count, 1);
1330 /* Omit re.UNICODE for valid string patterns. */
1763 /* Here comes the prefix string */
1995 Py_VISIT(self->string);
2004 Py_CLEAR(self->string);
2034 if (self->string == Py_None || self->mark[index] < 0) {
2035 /* return default value if the string or group is undefined */
2040 ptr = getstring(self->string, &length, &isbytes, &charsize, &view);
2048 result = getslice(isbytes, ptr, self->string, i, j);
2104 Return the string obtained by doing backslash substitution on the string template, as done by the sub() method.
2472 Py_INCREF(state->string);
2473 match->string = state->string;
2674 PyObject *string,
2688 if (!state_init(&scanner->state, self, string, pos, endpos)) {
2800 "The pattern string from which the RE object was compiled."},
2858 {"string", T_OBJECT, MATCH_OFF(string), READONLY,
2859 "The string passed to match() or search()."},
2863 "The index into the string at which the RE engine started looking for a match."},
2865 "The index into the string beyond which the RE engine will not go."},
2869 /* FIXME: implement setattr("string", None) as a special case (to
2870 detach the associated string, if any */