Avoid syntax error regarding colons in the expression; fix #5290

Reported and inspired by @hasumikin; based on CRuby's `parse.y`.
parent 28d5daba
......@@ -5882,14 +5882,14 @@ parser_yylex(parser_state *p)
p->lstate = EXPR_BEG;
return tLABEL_TAG;
}
if (!ISSPACE(c) || IS_BEG()) {
if (IS_END() || ISSPACE(c) || c == '#') {
pushback(p, c);
p->lstate = EXPR_FNAME;
return tSYMBEG;
p->lstate = EXPR_BEG;
return ':';
}
pushback(p, c);
p->lstate = EXPR_BEG;
return ':';
p->lstate = EXPR_FNAME;
return tSYMBEG;
case '/':
if (IS_BEG()) {
......
......@@ -11883,14 +11883,14 @@ parser_yylex(parser_state *p)
p->lstate = EXPR_BEG;
return tLABEL_TAG;
}
if (!ISSPACE(c) || IS_BEG()) {
if (IS_END() || ISSPACE(c) || c == '#') {
pushback(p, c);
p->lstate = EXPR_FNAME;
return tSYMBEG;
p->lstate = EXPR_BEG;
return ':';
}
pushback(p, c);
p->lstate = EXPR_BEG;
return ':';
p->lstate = EXPR_FNAME;
return tSYMBEG;
case '/':
if (IS_BEG()) {
......
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