summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-02-10 17:17:36 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-02-10 17:17:36 +0900
commit7a116f27e456d3ace180b29e39e96dda83e156ee (patch)
treee0548275383e84ab6359d5b369a0ec3e3fa59713
parent79cfa377e16435c4673a58f98267d7117533b17e (diff)
downloadmruby-7a116f27e456d3ace180b29e39e96dda83e156ee.tar.gz
mruby-7a116f27e456d3ace180b29e39e96dda83e156ee.zip
Need to determine `IS_LABEL_POSSIBLE()` properly.
Otherwise, `{"a": 1}` will cause `SyntaxError`.
-rw-r--r--mrbgems/mruby-compiler/core/parse.y3
1 files changed, 2 insertions, 1 deletions
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y
index e4c258368..001908a93 100644
--- a/mrbgems/mruby-compiler/core/parse.y
+++ b/mrbgems/mruby-compiler/core/parse.y
@@ -3974,6 +3974,7 @@ parse_string(parser_state *p)
int end = intn(p->lex_strterm->cdr->cdr->cdr);
parser_heredoc_info *hinf = (type & STR_FUNC_HEREDOC) ? parsing_heredoc_inf(p) : NULL;
int cmd_state = p->cmd_start;
+ int label_p = IS_LABEL_POSSIBLE();
if (beg == 0) beg = -3; /* should never happen */
if (end == 0) end = -3;
@@ -4188,7 +4189,7 @@ parse_string(parser_state *p)
return tREGEXP;
}
pylval.nd = new_str(p, tok(p), toklen(p));
- if (IS_LABEL_POSSIBLE()) {
+ if (label_p) {
if (IS_LABEL_SUFFIX(0)) {
p->lstate = EXPR_BEG;
nextc(p);