Prohibit r suffix after scientific notation (e.g. 1e10).

As CRuby does.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2021-01-24 21:43:20 +09:00
parent cc59860e40
commit f20e10686c
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -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
+4
View File
@@ -11892,6 +11892,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