* lib/irb/ruby-lex.rb: make irb be able to parse

string_dvar. [ruby-core: 24051]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
keiju 2009-07-23 08:35:22 +00:00
Родитель dac591d01b
Коммит f984a4d847
2 изменённых файлов: 44 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Thu Jul 23 17:31:02 2009 Keiju Ishitsuka <keiju@ruby-lang.org>
* lib/irb/ruby-lex.rb: make irb be able to parse
string_dvar. [ruby-core: 24051]
Thu Jul 23 17:26:51 2009 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> Thu Jul 23 17:26:51 2009 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/extconf.rb: should not create "config_list" in a $srcdir. * ext/tk/extconf.rb: should not create "config_list" in a $srcdir.
@ -89,7 +94,7 @@ Wed Jul 22 06:35:56 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* test/ruby/test_enum.rb (TestEnumerable#each): recursive join now * test/ruby/test_enum.rb (TestEnumerable#each): recursive join now
raises ArgumentError. raises ArgumentError.
Wed Jul 22 02:33:57 2009 Keiju Ishitsuka <keiju@emperor2.pendome> Wed Jul 22 02:33:57 2009 Keiju Ishitsuka <keiju@ruby-lang.org>
* lib/irb.rb: forget svn commit. * lib/irb.rb: forget svn commit.

Просмотреть файл

@ -1047,6 +1047,8 @@ class RubyLex
while ch = getc while ch = getc
if @quoted == ch and nest == 0 if @quoted == ch and nest == 0
break break
elsif ch == "#" and peek(0) == "{"
identify_string_dvar
elsif @ltype != "'" && @ltype != "]" && @ltype != ":" and ch == "#" elsif @ltype != "'" && @ltype != "]" && @ltype != ":" and ch == "#"
subtype = true subtype = true
elsif ch == '\\' and @ltype == "'" #' elsif ch == '\\' and @ltype == "'" #'
@ -1083,6 +1085,42 @@ class RubyLex
end end
end end
def identify_string_dvar
begin
getc
reserve_continue = @continue
reserve_ltype = @ltype
reserve_indent = @indent
reserve_indent_stack = @indent_stack
reserve_state = @lex_state
reserve_quoted = @quoted
@ltype = nil
@quoted = nil
@indent = 0
@indent_stack = []
@lex_state = EXPR_BEG
loop do
@continue = false
prompt
tk = token
if @ltype or @continue or @indent > 0
next
end
break if tk.kind_of?(TkRBRACE)
end
ensure
@continue = reserve_continue
@ltype = reserve_ltype
@indent = reserve_indent
@indent_stack = reserve_indent_stack
@lex_state = reserve_state
@quoted = reserve_quoted
end
end
def identify_comment def identify_comment
@ltype = "#" @ltype = "#"