Project

General

Profile

Actions

Bug #2763

closed

ruby-lex hangs if there is no newline at end of file

Added by jmthomas (Jason Thomas) almost 15 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
ruby -v:
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]
[ruby-core:28248]

Description

=begin
When calling RubyLex.token in a while loop, the parser spins returning TkIDENTIFIER if there is no newline at the end of the file. This bug is related to the following issue in RubyForge: http://rubyforge.org/tracker/?group_id=426&atid=1698&func=detail&aid=1745. This was fixed but seems to be reintroduced in Ruby 1.9.

ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]
=end

Actions #1

Updated by mame (Yusuke Endoh) over 14 years ago

  • Status changed from Open to Closed

=begin
Hi,

This is maybe fixed at r27303, though I cannot confirm it
because OP does not explain the process to reproduce the
issue.

At least, I confirmed that the following terminated now:

$ echo -n "x = 1; x + x" | irb

Thanks.

--
Yusuke Endoh
=end

Actions #2

Updated by jmthomas (Jason Thomas) over 14 years ago

=begin
I verified this bug exists in ruby-1.9.1-p378 on my Mac but has been fixed in ruby-1.9.2-rc2. Here is some example code to show the problem:

require 'irb/ruby-lex'
lex = RubyLex.new
lex.set_input(File.open("test.rb"))
while token = lex.token
puts token
end

If test.rb does not have a newline at the end of the file it will loop endlessly in 1.9.1 but not in 1.9.2-rc2.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0