Commit 6f6c270b authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

mirb should detect end of expression smarter

parent aeca2316
......@@ -4630,6 +4630,11 @@ mrb_parser_parse(parser_state *p)
p->tree = p->begin_tree = 0;
return;
}
p->cmd_start = TRUE;
p->in_def = p->in_single = FALSE;
p->nerr = p->nwarn = 0;
yyparse(p);
tree = p->tree;
if (!tree) {
......
......@@ -27,6 +27,7 @@ is_code_block_open(struct mrb_parser_state *parser)
case EXPR_BEG:
/* an expression was just started, */
/* we can't end it like this */
if (parser->nerr == 0) return FALSE;
code_block_open = TRUE;
break;
case EXPR_DOT:
......@@ -198,13 +199,13 @@ main(void)
}
else {
if (code_block_open) {
strcat(ruby_code, "\n");
strcat(ruby_code, last_code_line);
}
else {
memset(ruby_code, 0, sizeof(*ruby_code));
strcat(ruby_code, last_code_line);
}
strcat(ruby_code, "\n");
/* parse code */
parser->s = ruby_code;
......
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