diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-12-13 23:44:10 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-12-13 23:44:10 +0900 |
| commit | fead715cef36abe7fe448b240636312acdd10775 (patch) | |
| tree | 1760c75db36009d93ba49252ceff0f2143697165 /mrbgems/mruby-compiler/core/parse.y | |
| parent | df350766025e97f55b86ee51f71509cfa6b1e005 (diff) | |
| download | mruby-fead715cef36abe7fe448b240636312acdd10775.tar.gz mruby-fead715cef36abe7fe448b240636312acdd10775.zip | |
tLABEL should not come after conditional ternary; fix #3344
Diffstat (limited to 'mrbgems/mruby-compiler/core/parse.y')
| -rw-r--r-- | mrbgems/mruby-compiler/core/parse.y | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index d70125a0b..821411cf4 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -3923,6 +3923,7 @@ parse_string(parser_state *p) int beg = (intptr_t)p->lex_strterm->cdr->cdr->car; int end = (intptr_t)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; if (beg == 0) beg = -3; /* should never happen */ if (end == 0) end = -3; @@ -4127,10 +4128,13 @@ parse_string(parser_state *p) return tREGEXP; } yylval.nd = new_str(p, tok(p), toklen(p)); - if (IS_LABEL_SUFFIX(0)) { - p->lstate = EXPR_BEG; - nextc(p); - return tLABEL_END; + if (IS_LABEL_POSSIBLE()) { + if (IS_LABEL_SUFFIX(0)) { + fprintf(stderr, "tLABEL_END: %d->%d\n", p->lstate, EXPR_BEG); + p->lstate = EXPR_BEG; + nextc(p); + return tLABEL_END; + } } return tSTRING; |
