Need to determine `IS_LABEL_POSSIBLE()` properly.

Otherwise, `{"a": 1}` will cause `SyntaxError`.
parent 79cfa377
...@@ -3974,6 +3974,7 @@ parse_string(parser_state *p) ...@@ -3974,6 +3974,7 @@ parse_string(parser_state *p)
int end = intn(p->lex_strterm->cdr->cdr->cdr); int end = intn(p->lex_strterm->cdr->cdr->cdr);
parser_heredoc_info *hinf = (type & STR_FUNC_HEREDOC) ? parsing_heredoc_inf(p) : NULL; parser_heredoc_info *hinf = (type & STR_FUNC_HEREDOC) ? parsing_heredoc_inf(p) : NULL;
int cmd_state = p->cmd_start; int cmd_state = p->cmd_start;
int label_p = IS_LABEL_POSSIBLE();
if (beg == 0) beg = -3; /* should never happen */ if (beg == 0) beg = -3; /* should never happen */
if (end == 0) end = -3; if (end == 0) end = -3;
...@@ -4188,7 +4189,7 @@ parse_string(parser_state *p) ...@@ -4188,7 +4189,7 @@ parse_string(parser_state *p)
return tREGEXP; return tREGEXP;
} }
pylval.nd = new_str(p, tok(p), toklen(p)); pylval.nd = new_str(p, tok(p), toklen(p));
if (IS_LABEL_POSSIBLE()) { if (label_p) {
if (IS_LABEL_SUFFIX(0)) { if (IS_LABEL_SUFFIX(0)) {
p->lstate = EXPR_BEG; p->lstate = EXPR_BEG;
nextc(p); nextc(p);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment