diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-11-04 11:49:25 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-11-04 11:49:25 +0900 |
| commit | de2363a9f0c7d368ee9002f86931d124e644a243 (patch) | |
| tree | 2112928a80786a109ecac4b3ce200f45ac75e2cb /mrbgems/mruby-compiler/core/parse.y | |
| parent | 388d26d77027feaa3e107abf7209e2681868bbe6 (diff) | |
| parent | 625f9f6fa314872968632c5adbee7fb3823268b8 (diff) | |
| download | mruby-de2363a9f0c7d368ee9002f86931d124e644a243.tar.gz mruby-de2363a9f0c7d368ee9002f86931d124e644a243.zip | |
Merge branch 'mrb_without_float' of https://github.com/pandax381/mruby into pandax381-mrb_without_float
Diffstat (limited to 'mrbgems/mruby-compiler/core/parse.y')
| -rw-r--r-- | mrbgems/mruby-compiler/core/parse.y | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index e5017b677..01269d8da 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -740,12 +740,14 @@ new_int(parser_state *p, const char *s, int base) return list3((node*)NODE_INT, (node*)strdup(s), nint(base)); } +#ifndef MRB_WITHOUT_FLOAT /* (:float . i) */ static node* new_float(parser_state *p, const char *s) { return cons((node*)NODE_FLOAT, (node*)strdup(s)); } +#endif /* (:str . (s . len)) */ static node* @@ -4962,6 +4964,11 @@ parser_yylex(parser_state *p) } tokfix(p); if (is_float) { +#ifdef MRB_WITHOUT_FLOAT + yywarning_s(p, "floating point numbers are not supported", tok(p)); + pylval.nd = new_int(p, "0", 10); + return tINTEGER; +#else double d; char *endp; @@ -4976,6 +4983,7 @@ parser_yylex(parser_state *p) } pylval.nd = new_float(p, tok(p)); return tFLOAT; +#endif } pylval.nd = new_int(p, tok(p), 10); return tINTEGER; |
