From f20e10686ca4c295402b3e6adb061102967c6e3f Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sun, 24 Jan 2021 21:43:20 +0900 Subject: Prohibit `r` suffix after scientific notation (e.g. `1e10`). As CRuby does. --- mrbgems/mruby-compiler/core/parse.y | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mrbgems/mruby-compiler/core/parse.y') diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index 53cd4ffad..3551e8385 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -5856,6 +5856,10 @@ parser_yylex(parser_state *p) errno = 0; } suffix = number_literal_suffix(p); + if (seen_e && (suffix & NUM_SUFFIX_R)) { + pushback(p, 'r'); + suffix &= ~NUM_SUFFIX_R; + } pylval.nd = new_float(p, tok(p), suffix); return tFLOAT; #endif -- cgit v1.2.3