ruby-changes:26581
From: keiju <ko1@a...>
Date: Thu, 27 Dec 2012 23:48:53 +0900 (JST)
Subject: [ruby-changes:26581] keiju:r38632 (trunk): * lib/irb/ruby-lex.rb: make lex_state to EXPR_END when next token
keiju 2012-12-27 23:48:42 +0900 (Thu, 27 Dec 2012) New Revision: 38632 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38632 Log: * lib/irb/ruby-lex.rb: make lex_state to EXPR_END when next token is an operator after SYMBEG [Bug #6378]. Modified files: trunk/ChangeLog trunk/lib/irb/ruby-lex.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38631) +++ ChangeLog (revision 38632) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Dec 27 23:27:15 2012 Keiju Ishitsuka <keiju@i...> + + * lib/irb/ruby-lex.rb: make lex_state to EXPR_END when next token + is an operator after SYMBEG [Bug #6378]. + Thu Dec 27 21:30:21 2012 Keiju Ishitsuka <keiju@i...> * lib/irb/ruby-lex.rb: allow to handle recursive heredocs on Index: lib/irb/ruby-lex.rb =================================================================== --- lib/irb/ruby-lex.rb (revision 38631) +++ lib/irb/ruby-lex.rb (revision 38632) @@ -54,6 +54,7 @@ class RubyLex https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L54 @lex_state = EXPR_BEG @space_seen = false @here_header = false + @post_symbeg = false @continue = false @line = "" @@ -218,6 +219,8 @@ class RubyLex https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L219 @here_header = false @continue = false + @post_symbeg = false + prompt @line = "" @@ -286,6 +289,8 @@ class RubyLex https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L289 begin tk = @OP.match(self) @space_seen = tk.kind_of?(TkSPACE) + @lex_state = EXPR_END if @post_symbeg && tk.kind_of?(TkOp) + @post_symbeg = tk.kind_of?(TkSYMBEG) rescue SyntaxError raise if @exception_on_syntax_error tk = TkError.new(@seek, @line_no, @char_no) @@ -542,7 +547,7 @@ class RubyLex https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L547 @lex_state = EXPR_BEG Token(TkCOLON) else - @lex_state = EXPR_FNAME; + @lex_state = EXPR_FNAME Token(TkSYMBEG) end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/