Commit 29792d17 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge branch 'master' of github.com:mruby/mruby

parents 7aabc657 a9d8357d
...@@ -113,6 +113,7 @@ struct mrb_parser_state { ...@@ -113,6 +113,7 @@ struct mrb_parser_state {
char const *filename; char const *filename;
int lineno; int lineno;
int column; int column;
int eof;
enum mrb_lex_state_enum lstate; enum mrb_lex_state_enum lstate;
mrb_ast_node *lex_strterm; /* (type nest_level beg . end) */ mrb_ast_node *lex_strterm; /* (type nest_level beg . end) */
......
...@@ -1071,7 +1071,7 @@ mrb_flo_to_fixnum(mrb_state *mrb, mrb_value x) ...@@ -1071,7 +1071,7 @@ mrb_flo_to_fixnum(mrb_state *mrb, mrb_value x)
if (mrb_float_p(x)) { if (mrb_float_p(x)) {
mrb_raise(mrb, E_TYPE_ERROR, "non float value"); mrb_raise(mrb, E_TYPE_ERROR, "non float value");
z = 0; /* not reached. just supress warnings. */ z = 0; /* not reached. just suppress warnings. */
} }
else { else {
mrb_float d = mrb_float(x); mrb_float d = mrb_float(x);
......
...@@ -3316,14 +3316,14 @@ nextc(parser_state *p) ...@@ -3316,14 +3316,14 @@ nextc(parser_state *p)
else { else {
#ifdef ENABLE_STDIO #ifdef ENABLE_STDIO
if (p->f) { if (p->f) {
if (feof(p->f)) goto end_retry; if (feof(p->f)) goto eof;
c = fgetc(p->f); c = fgetc(p->f);
if (c == EOF) goto end_retry; if (c == EOF) goto eof;
} }
else else
#endif #endif
if (!p->s || p->s >= p->send) { if (!p->s || p->s >= p->send) {
goto end_retry; goto eof;
} }
else { else {
c = (unsigned char)*p->s++; c = (unsigned char)*p->s++;
...@@ -3332,14 +3332,20 @@ nextc(parser_state *p) ...@@ -3332,14 +3332,20 @@ nextc(parser_state *p)
p->column++; p->column++;
return c; return c;
end_retry: eof:
if (!p->eof) {
p->eof = TRUE;
return '\n';
}
if (!p->cxt) return -1; if (!p->cxt) return -1;
else { else {
mrbc_context *cxt = p->cxt; mrbc_context *cxt = p->cxt;
if (cxt->partial_hook(p) < 0) return -1; if (cxt->partial_hook(p) < 0) return -1;
c = '\n'; p->eof = FALSE;
p->lineno = 1; p->cxt = NULL;
c = nextc(p);
p->cxt = cxt; p->cxt = cxt;
return c; return c;
} }
......
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