Skip to content

Commit

Permalink
tLABEL should not come after conditional ternary; fix #3344
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Dec 13, 2016
1 parent df35076 commit fead715
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mrbgems/mruby-compiler/core/parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

This comment has been minimized.

Copy link
@ksss

ksss Dec 14, 2016

Contributor

Is this a debug code?

This comment has been minimized.

Copy link
@matz

matz Dec 14, 2016

Author Member

oops!

p->lstate = EXPR_BEG;
nextc(p);
return tLABEL_END;
}
}

return tSTRING;
Expand Down

0 comments on commit fead715

Please sign in to comment.