Lines Matching refs:STR
307 PyObject *s = exp->v.Str.s;
309 PyErr_SetString(PyExc_TypeError, "non-string type in Str");
666 #define NEW_IDENTIFIER(n) new_identifier(STR(n), c)
1115 switch (STR(n)[0]) {
1121 if (STR(n)[1] == '/')
1138 if (STR(n)[1] == '*')
1145 PyErr_Format(PyExc_SystemError, "invalid augassign: %s", STR(n));
1173 if (strcmp(STR(n), "in") == 0)
1175 if (strcmp(STR(n), "is") == 0)
1179 STR(n));
1187 if (strcmp(STR(CHILD(n, 1)), "in") == 0)
1189 if (strcmp(STR(CHILD(n, 0)), "is") == 0)
1193 STR(CHILD(n, 0)), STR(CHILD(n, 1)));
1676 STR(CHILD(n, 1)));
2095 const char *s = STR(ch);
2112 expr_ty str = parsestrplus(c, n);
2113 if (!str) {
2141 return str;
2144 STR(ch));
2588 if (!strcmp(STR(CHILD(n, 1)), "and"))
2591 assert(!strcmp(STR(CHILD(n, 1)), "or"));
3166 identifier str, name;
3172 str = NULL;
3178 str = NEW_IDENTIFIER(str_node);
3179 if (!str)
3181 if (store && forbidden_name(c, str, str_node, 0))
3188 return alias(name, str, c->c_arena);
3229 len += strlen(STR(CHILD(n, i))) + 1;
3231 str = PyBytes_FromStringAndSize(NULL, len);
3232 if (!str)
3234 s = PyBytes_AS_STRING(str);
3238 char *sch = STR(CHILD(n, i));
3239 strcpy(s, STR(CHILD(n, i)));
3245 uni = PyUnicode_DecodeUTF8(PyBytes_AS_STRING(str),
3246 PyBytes_GET_SIZE(str),
3248 Py_DECREF(str);
3251 str = uni;
3252 PyUnicode_InternInPlace(&str);
3253 if (PyArena_AddPyObject(c->c_arena, str) < 0) {
3254 Py_DECREF(str);
3257 return alias(str, NULL, c->c_arena);
3261 str = PyUnicode_InternFromString("*");
3262 if (PyArena_AddPyObject(c->c_arena, str) < 0) {
3263 Py_DECREF(str);
3266 return alias(str, NULL, c->c_arena);
3386 STR(CHILD(n, 0)));
3552 s = STR(CHILD(n, 4));
3583 && STR(CHILD(n, (n_elif + 1)))[2] == 's') {
3801 if (strcmp(STR(CHILD(n, nch - 3)), "finally") == 0) {
4253 char *str;
4293 str = PyMem_RawMalloc(len + 3);
4294 if (str == NULL)
4297 str[0] = '(';
4298 memcpy(str+1, expr_start, len);
4299 str[len+1] = ')';
4300 str[len+2] = 0;
4303 mod = PyParser_ASTFromString(str, "<fstring>",
4305 PyMem_RawFree(str);
4320 fstring_find_literal(const char **str, const char *end, int raw,
4328 const char *literal_start = *str;
4334 for (; *str < end; (*str)++) {
4335 char ch = **str;
4336 if (!in_named_escape && ch == '{' && (*str)-literal_start >= 2 &&
4337 *(*str-2) == '\\' && *(*str-1) == 'N') {
4346 if (*str+1 < end && *(*str+1) == ch) {
4350 literal_end = *str+1;
4351 *str += 2;
4369 literal_end = *str;
4370 assert(*str <= end);
4371 assert(*str == end || **str == '{' || **str == '}');
4389 fstring_parse(const char **str, const char *end, int raw, int recurse_lvl,
4392 /* Parse the f-string at *str, ending at end. We know *str starts an
4403 fstring_find_expr(const char **str, const char *end, int raw, int recurse_lvl,
4433 assert(**str == '{');
4434 *str += 1;
4436 expr_start = *str;
4437 for (; *str < end; (*str)++) {
4442 assert(*str >= expr_start && *str < end);
4448 ch = **str;
4472 if (*str+2 < end && *(*str+1) == ch && *(*str+2) == ch) {
4474 *str += 2;
4488 if (*str+2 < end && *(*str+1) == ch && *(*str+2) == ch) {
4490 *str += 2;
4512 if (ch == '!' && *str+1 < end && *(*str+1) == '=') {
4522 expr_end = *str;
4536 if (*str >= end)
4547 if (**str == '!') {
4548 *str += 1;
4549 if (*str >= end)
4552 conversion = **str;
4553 *str += 1;
4565 if (*str >= end)
4567 if (**str == ':') {
4568 *str += 1;
4569 if (*str >= end)
4573 format_spec = fstring_parse(str, end, raw, recurse_lvl+1, c, n);
4578 if (*str >= end || **str != '}')
4582 assert(*str < end);
4583 assert(**str == '}');
4584 *str += 1;
4625 fstring_find_literal_and_expr(const char **str, const char *end, int raw,
4635 result = fstring_find_literal(str, end, raw, literal, recurse_lvl, c, n);
4645 if (*str >= end || **str == '}')
4653 assert(**str == '{');
4655 if (fstring_find_expr(str, end, raw, recurse_lvl, expression, c, n) < 0)
4673 Str for the literal 'a'. So you add expr_ty's about twice as
4825 /* Make a Str node, but decref the PyUnicode object being added. */
4827 make_str_node_and_del(PyObject **str, struct compiling *c, const node* n)
4829 PyObject *s = *str;
4830 *str = NULL;
4836 return Str(s, LINENO(n), n->n_col_offset, c->c_arena);
4839 /* Add a non-f-string (that is, a regular literal string). str is
4842 FstringParser_ConcatAndDel(FstringParser *state, PyObject *str)
4846 assert(PyUnicode_CheckExact(str));
4848 if (PyUnicode_GET_LENGTH(str) == 0) {
4849 Py_DECREF(str);
4855 state->last_str = str;
4858 PyUnicode_AppendAndDel(&state->last_str, str);
4866 /* Parse an f-string. The f-string is in *str to end, with no
4869 FstringParser_ConcatFstring(FstringParser *state, const char **str,
4885 int result = fstring_find_literal_and_expr(str, end, raw, recurse_lvl,
4924 to a Str node. */
4928 /* Convert the existing last_str literal to a Str node. */
4929 expr_ty str = make_str_node_and_del(&state->last_str, c, n);
4930 if (!str || ExprList_Append(&state->expr_list, str) < 0)
4941 if (recurse_lvl == 0 && *str < end-1) {
4945 if (recurse_lvl != 0 && **str != '}') {
4955 expr_ty. The expr_ty can be a Str, or a JoinedStr. */
4977 /* Create a Str node out of last_str, if needed. It will be the
4980 expr_ty str = make_str_node_and_del(&state->last_str, c, n);
4981 if (!str || ExprList_Append(&state->expr_list, str) < 0)
4998 /* Given an f-string (with no 'f' or quotes) that's in *str and ends
5000 str to point past the parsed portion. */
5002 fstring_parse(const char **str, const char *end, int raw, int recurse_lvl,
5008 if (FstringParser_ConcatFstring(&state, str, end, raw, recurse_lvl,
5029 const char *s = STR(n);
5130 will be a Str node if there were no f-strings; a FormattedValue