* lib/irb/ruby-lex.rb: fixed that irb can't parse /\^/. [ruby-dev:28404] and http://rubyforge.org/tracker/index.php?func=detail&aid=3302&group_id=426&atid=1698

* lib/irb/ruby-lex.rb: support "\s" in irb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
keiju 2006-02-28 13:47:48 +00:00
parent a2bd4d594d
commit 64040f2daa

View File

@ -309,7 +309,7 @@ class RubyLex
"q" => "\'", "q" => "\'",
"Q" => "\"", "Q" => "\"",
"x" => "\`", "x" => "\`",
"r" => "\/", "r" => "/",
"w" => "]", "w" => "]",
"W" => "]", "W" => "]",
"s" => ":" "s" => ":"
@ -326,14 +326,14 @@ class RubyLex
"\'" => TkSTRING, "\'" => TkSTRING,
"\"" => TkSTRING, "\"" => TkSTRING,
"\`" => TkXSTRING, "\`" => TkXSTRING,
"\/" => TkREGEXP, "/" => TkREGEXP,
"]" => TkDSTRING, "]" => TkDSTRING,
":" => TkSYMBOL ":" => TkSYMBOL
} }
DLtype2Token = { DLtype2Token = {
"\"" => TkDSTRING, "\"" => TkDSTRING,
"\`" => TkDXSTRING, "\`" => TkDXSTRING,
"\/" => TkDREGEXP, "/" => TkDREGEXP,
} }
def lex_init() def lex_init()
@ -1087,7 +1087,7 @@ class RubyLex
def read_escape def read_escape
case ch = getc case ch = getc
when "\n", "\r", "\f" when "\n", "\r", "\f"
when "\\", "n", "t", "r", "f", "v", "a", "e", "b" #" when "\\", "n", "t", "r", "f", "v", "a", "e", "b", "s" #"
when /[0-7]/ when /[0-7]/
ungetc ch ungetc ch
3.times do 3.times do
@ -1122,7 +1122,7 @@ class RubyLex
end end
end end
when "C", "c", "^" when "C", "c" #, "^"
if ch == "C" and (ch = getc) != "-" if ch == "C" and (ch = getc) != "-"
ungetc ungetc
elsif (ch = getc) == "\\" #" elsif (ch = getc) == "\\" #"