summaryrefslogtreecommitdiff
path: root/lib/irb
diff options
context:
space:
mode:
authorkeiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-06-30 10:11:14 +0000
committerkeiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-06-30 10:11:14 +0000
commit1ffb788aaa0eea607812dc2941f96b9510e8e339 (patch)
treec07bac27358b104ef01f5dab0df001e51399be78 /lib/irb
parent4ffab8713438fafb118776fcc1807b0c01e70be8 (diff)
* 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
Diffstat (limited to 'lib/irb')
-rw-r--r--lib/irb/ruby-lex.rb23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index 4b7ad6a0bf..8068d1c8bb 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -936,23 +936,30 @@ class RubyLex
@lex_state = EXPR_END
if peek(0) == "0" && peek(1) !~ /[.eE]/
- len0 = true
- non_digit = false
getc
- if /[xX]/ =~ peek(0)
+ case peek(0)
+ when /[xX]/
ch = getc
match = /[0-9a-fA-F_]/
- elsif /[bB]/ =~ peek(0)
+ when /[bB]/
ch = getc
match = /[01_]/
- elsif /[oO]/ =~ peek(0)
+ when /[oO]/
ch = getc
match = /[0-7_]/
- else
+ when /[dD]/
+ ch = getc
+ match = /[0-9_]/
+ when /[0-7]/
match = /[0-7_]/
- len0 = false
+ when /[89]/
+ RubyLex.fail SyntaxError, "Illegal octal digit"
+ else
+ return Token(TkINTEGER)
end
-
+
+ len0 = true
+ non_digit = false
while ch = getc
if match =~ ch
if ch == "_"