Lines Matching defs:str
353 char *str;
387 str = PyMem_Calloc(len + 3, sizeof(char));
388 if (str == NULL) {
396 memcpy(str+1, expr_start, len);
398 if (!fstring_find_expr_location(t, expr_start-1, str+1, &lines, &cols)) {
399 PyMem_Free(str);
406 str[0] = '(';
407 str[len+1] = ')';
409 struct tok_state* tok = _PyTokenizer_FromString(str, 1);
411 PyMem_Free(str);
433 PyMem_Free(str);
448 fstring_find_literal(Parser *p, const char **str, const char *end, int raw,
455 const char *s = *str;
496 *str = s + 1;
504 *str = s - 1;
516 *str = s;
539 fstring_parse(Parser *p, const char **str, const char *end, int raw, int recurse_lvl,
542 /* Parse the f-string at *str, ending at end. We know *str starts an
558 fstring_find_expr(Parser *p, const char **str, const char *end, int raw, int recurse_lvl,
594 assert(**str == '{');
595 *str += 1;
597 expr_start = *str;
598 for (; *str < end; (*str)++) {
603 assert(*str >= expr_start && *str < end);
610 ch = **str;
635 if (*str+2 < end && *(*str+1) == ch && *(*str+2) == ch) {
637 *str += 2;
651 if (*str+2 < end && *(*str+1) == ch && *(*str+2) == ch) {
653 *str += 2;
676 if (*str+1 < end) {
677 char next = *(*str+1);
686 *str += 1;
720 expr_end = *str;
735 if (*str >= end) {
749 if (**str == '=') {
755 *str += 1;
760 while (Py_ISSPACE(**str)) {
761 *str += 1;
763 if (*str >= end) {
767 *expr_text = PyUnicode_FromStringAndSize(expr_start, *str-expr_start);
774 if (**str == '!') {
775 *str += 1;
776 if (*str >= end) {
780 conversion = (unsigned char)**str;
781 *str += 1;
794 if (*str >= end) {
797 if (**str == ':') {
798 *str += 1;
799 if (*str >= end) {
804 format_spec = fstring_parse(p, str, end, raw, recurse_lvl+1,
811 if (*str >= end || **str != '}') {
816 assert(*str < end);
817 assert(**str == '}');
818 *str += 1;
874 fstring_find_literal_and_expr(Parser *p, const char **str, const char *end, int raw,
884 result = fstring_find_literal(p, str, end, raw, literal, recurse_lvl, t);
896 if (*str >= end || **str == '}') {
905 assert(**str == '{');
907 if (fstring_find_expr(p, str, end, raw, recurse_lvl, expr_text,
1058 make_str_node_and_del(Parser *p, PyObject **str, Token* first_token, Token *last_token)
1060 PyObject *s = *str;
1062 *str = NULL;
1084 /* Add a non-f-string (that is, a regular literal string). str is
1087 _PyPegen_FstringParser_ConcatAndDel(FstringParser *state, PyObject *str)
1091 assert(PyUnicode_CheckExact(str));
1093 if (PyUnicode_GET_LENGTH(str) == 0) {
1094 Py_DECREF(str);
1100 state->last_str = str;
1103 PyUnicode_AppendAndDel(&state->last_str, str);
1112 /* Parse an f-string. The f-string is in *str to end, with no
1115 _PyPegen_FstringParser_ConcatFstring(Parser *p, FstringParser *state, const char **str,
1132 int result = fstring_find_literal_and_expr(p, str, end, raw, recurse_lvl,
1183 if (recurse_lvl == 0 && *str < end-1) {
1187 if (recurse_lvl != 0 && **str != '}') {
1223 expr_ty str = make_str_node_and_del(p, &state->last_str, first_token, last_token);
1224 if (!str || ExprList_Append(&state->expr_list, str) < 0) {
1245 /* Given an f-string (with no 'f' or quotes) that's in *str and ends
1247 str to point past the parsed portion. */
1249 fstring_parse(Parser *p, const char **str, const char *end, int raw,
1255 if (_PyPegen_FstringParser_ConcatFstring(p, &state, str, end, raw, recurse_lvl,