summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core/parse.y
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-01-24 21:43:20 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-01-24 21:43:20 +0900
commitf20e10686ca4c295402b3e6adb061102967c6e3f (patch)
treee6250f116dd4cc0fa9139453db84ffda8306eb6b /mrbgems/mruby-compiler/core/parse.y
parentcc59860e4077aa5f3dbd398639c84b9214ec5d7d (diff)
downloadmruby-f20e10686ca4c295402b3e6adb061102967c6e3f.tar.gz
mruby-f20e10686ca4c295402b3e6adb061102967c6e3f.zip
Prohibit `r` suffix after scientific notation (e.g. `1e10`).
As CRuby does.
Diffstat (limited to 'mrbgems/mruby-compiler/core/parse.y')
-rw-r--r--mrbgems/mruby-compiler/core/parse.y4
1 files changed, 4 insertions, 0 deletions
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