diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-26 14:05:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-26 14:05:34 +0000 |
commit | 41f864faab6f1cdd8ad7e88c9c89fea200d030d2 (patch) | |
tree | ed3dcef06a52d57644cdbb9d642a9c38db07ea7f /parse.y | |
parent | 2d9a4afb137d18bf16ec99f5a841b0f232b05a16 (diff) | |
download | ruby-41f864faab6f1cdd8ad7e88c9c89fea200d030d2.tar.gz |
parse.y: separate numeric literal
* parse.y (parser_yylex): separate numeric literal from succeeding
token, and treat 'e' as floating point number only if followed by
exponent part.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -7542,14 +7542,18 @@ parser_yylex(struct parser_params *parser) if (seen_e) { goto decode_num; } - tokadd(c); - seen_e++; - is_float++; nondigit = c; c = nextc(); - if (c != '-' && c != '+') continue; + if (c != '-' && c != '+' && !ISDIGIT(c)) { + pushback(c); + nondigit = 0; + goto decode_num; + } + tokadd(nondigit); + seen_e++; + is_float++; tokadd(c); - nondigit = c; + nondigit = (c == '-' || c == '+') ? c : 0; break; case '_': /* `_' in number just ignored */ |