diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-11-09 23:29:50 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-11-09 23:29:50 +0900 |
| commit | 29792d17253212c0b212a9695c36c28a5c4580c4 (patch) | |
| tree | d7f14661ef137feb3cff0a1aef7fea1d80b5e155 /src | |
| parent | 7aabc657f1c8ef7e8f433e5fc584c5592f8a16d4 (diff) | |
| parent | a9d8357d69773414d38bbe00e6086dfcf3008eeb (diff) | |
| download | mruby-29792d17253212c0b212a9695c36c28a5c4580c4.tar.gz mruby-29792d17253212c0b212a9695c36c28a5c4580c4.zip | |
Merge branch 'master' of github.com:mruby/mruby
Diffstat (limited to 'src')
| -rw-r--r-- | src/numeric.c | 2 | ||||
| -rw-r--r-- | src/parse.y | 18 |
2 files changed, 13 insertions, 7 deletions
diff --git a/src/numeric.c b/src/numeric.c index ccb67bcc3..4a22c23c7 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -1071,7 +1071,7 @@ mrb_flo_to_fixnum(mrb_state *mrb, mrb_value x) if (mrb_float_p(x)) { mrb_raise(mrb, E_TYPE_ERROR, "non float value"); - z = 0; /* not reached. just supress warnings. */ + z = 0; /* not reached. just suppress warnings. */ } else { mrb_float d = mrb_float(x); diff --git a/src/parse.y b/src/parse.y index 7a1bd4760..6023d87eb 100644 --- a/src/parse.y +++ b/src/parse.y @@ -3316,14 +3316,14 @@ nextc(parser_state *p) else { #ifdef ENABLE_STDIO if (p->f) { - if (feof(p->f)) goto end_retry; + if (feof(p->f)) goto eof; c = fgetc(p->f); - if (c == EOF) goto end_retry; + if (c == EOF) goto eof; } else #endif if (!p->s || p->s >= p->send) { - goto end_retry; + goto eof; } else { c = (unsigned char)*p->s++; @@ -3332,14 +3332,20 @@ nextc(parser_state *p) p->column++; return c; - end_retry: + eof: + if (!p->eof) { + p->eof = TRUE; + return '\n'; + } + if (!p->cxt) return -1; else { mrbc_context *cxt = p->cxt; if (cxt->partial_hook(p) < 0) return -1; - c = '\n'; - p->lineno = 1; + p->eof = FALSE; + p->cxt = NULL; + c = nextc(p); p->cxt = cxt; return c; } |
