summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hash.c4
-rw-r--r--src/parse.y14
2 files changed, 8 insertions, 10 deletions
diff --git a/src/hash.c b/src/hash.c
index 94be511c8..19d0507e3 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -1007,14 +1007,12 @@ mrb_hash_keys(mrb_state *mrb, mrb_value hash)
{
khash_t(ht) *h = RHASH_TBL(hash);
khiter_t k;
- mrb_value ary = mrb_ary_new(mrb);
+ mrb_value ary = mrb_ary_new_capa(mrb, kh_size(h));
if (!h) return ary;
for (k = kh_begin(h); k != kh_end(h); k++) {
if (kh_exist(h, k)) {
mrb_value v = kh_key(h,k);
- if ( !mrb_special_const_p(v) )
- v = mrb_obj_dup(mrb, v);
mrb_ary_push(mrb, ary, v);
}
}
diff --git a/src/parse.y b/src/parse.y
index 37a16c614..55c82c12d 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -1008,7 +1008,7 @@ top_stmts : none
}
| error top_stmt
{
- $$ = $2;
+ $$ = new_begin(p, 0);
}
;
@@ -3405,7 +3405,7 @@ parse_qstring(parser_state *p, int term)
switch (c) {
case '\n':
p->lineno++;
- p->column = 1;
+ p->column = 0;
continue;
case '\\':
@@ -3474,7 +3474,7 @@ parser_yylex(parser_state *p)
/* fall through */
case '\n':
p->lineno++;
- p->column = 1;
+ p->column = 0;
switch (p->lstate) {
case EXPR_BEG:
case EXPR_FNAME:
@@ -3569,8 +3569,8 @@ parser_yylex(parser_state *p)
if (p->column == 1) {
if (peeks(p, "begin\n")) {
skips(p, "\n=end\n");
+ goto retry;
}
- goto retry;
}
switch (p->lstate) {
case EXPR_FNAME: case EXPR_DOT:
@@ -4263,7 +4263,7 @@ parser_yylex(parser_state *p)
c = nextc(p);
if (c == '\n') {
p->lineno++;
- p->column = 1;
+ p->column = 0;
space_seen = 1;
goto retry; /* skip \\n */
}
@@ -4699,7 +4699,7 @@ mrb_parser_new(mrb_state *mrb)
p->capture_errors = 0;
p->lineno = 1;
- p->column = 1;
+ p->column = 0;
#if defined(PARSER_TEST) || defined(PARSER_DEBUG)
yydebug = 1;
#endif
@@ -4722,7 +4722,7 @@ mrb_parser_lineno(struct mrb_parser_state *p, int n)
if (n <= 0) {
return p->lineno;
}
- p->column = 1;
+ p->column = 0;
p->lineno = n;
return n;
}