mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/irb/ruby-lex.rb (RubyLex::identify_number): alternative implements
for [ruby-dev:26410]. And support a numeric form of 0d99999. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4ffab87134
commit
1ffb788aaa
2 changed files with 19 additions and 8 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Thu Jun 30 19:00:21 2005 Keiju Ishitsuka <keiju@ruby-lang.org>
|
||||||
|
* lib/irb/ruby-lex.rb (RubyLex::identify_number): alternative implements
|
||||||
|
for [ruby-dev:26410]. And support a numeric form of 0d99999.
|
||||||
|
|
||||||
Thu Jun 30 17:28:10 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Thu Jun 30 17:28:10 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* lib/irb/ruby-lex.rb (RubyLex::identify_number): should not treat
|
* lib/irb/ruby-lex.rb (RubyLex::identify_number): should not treat
|
||||||
|
|
|
@ -936,23 +936,30 @@ class RubyLex
|
||||||
@lex_state = EXPR_END
|
@lex_state = EXPR_END
|
||||||
|
|
||||||
if peek(0) == "0" && peek(1) !~ /[.eE]/
|
if peek(0) == "0" && peek(1) !~ /[.eE]/
|
||||||
len0 = true
|
|
||||||
non_digit = false
|
|
||||||
getc
|
getc
|
||||||
if /[xX]/ =~ peek(0)
|
case peek(0)
|
||||||
|
when /[xX]/
|
||||||
ch = getc
|
ch = getc
|
||||||
match = /[0-9a-fA-F_]/
|
match = /[0-9a-fA-F_]/
|
||||||
elsif /[bB]/ =~ peek(0)
|
when /[bB]/
|
||||||
ch = getc
|
ch = getc
|
||||||
match = /[01_]/
|
match = /[01_]/
|
||||||
elsif /[oO]/ =~ peek(0)
|
when /[oO]/
|
||||||
ch = getc
|
ch = getc
|
||||||
match = /[0-7_]/
|
match = /[0-7_]/
|
||||||
else
|
when /[dD]/
|
||||||
|
ch = getc
|
||||||
|
match = /[0-9_]/
|
||||||
|
when /[0-7]/
|
||||||
match = /[0-7_]/
|
match = /[0-7_]/
|
||||||
len0 = false
|
when /[89]/
|
||||||
|
RubyLex.fail SyntaxError, "Illegal octal digit"
|
||||||
|
else
|
||||||
|
return Token(TkINTEGER)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
len0 = true
|
||||||
|
non_digit = false
|
||||||
while ch = getc
|
while ch = getc
|
||||||
if match =~ ch
|
if match =~ ch
|
||||||
if ch == "_"
|
if ch == "_"
|
||||||
|
|
Loading…
Reference in a new issue