1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/irb/ruby-lex.rb: improve RubyLex performance for large files

[Bug #5202]. Patch by ryanmelt.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
keiju 2012-12-25 16:04:52 +00:00
parent 23c93b5007
commit d43e3321b5
2 changed files with 9 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Wed Dec 26 00:59:18 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
* lib/irb/ruby-lex.rb: improve RubyLex performance for large files
[Bug #5202]. Patch by ryanmelt.
Tue Dec 25 22:21:06 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
* lib/irb/output-method.rb: raise right exception when

View file

@ -87,8 +87,8 @@ class RubyLex
end
def get_readed
if idx = @readed.reverse.index("\n")
@base_char_no = idx
if idx = @readed.rindex("\n")
@base_char_no = @readed.size - (idx + 1)
else
@base_char_no += @readed.size
end
@ -152,8 +152,8 @@ class RubyLex
@seek -= 1
if c == "\n"
@line_no -= 1
if idx = @readed.reverse.index("\n")
@char_no = @readed.size - idx
if idx = @readed.rindex("\n")
@char_no = idx + 1
else
@char_no = @base_char_no + @readed.size
end