ruby/racc

Spurious initial \n in error messages

Closed this issue · 1 comments

akimd commented

Error messages start with a spurious empty line, as demonstrated by the example below.

class ArrayParser

rule

exp   : 'x'
  
---- inner

  def next_token
    ['y', 'y']
  end

---- footer

begin
  ArrayParser.new.do_parse
rescue => e
  puts "error: '#{e}'"
end
$ racc array.y && ruby array.tab.rb
error: '
parse error on value "y" (error)'

It may be connected to some feature I'm unaware of, in which case please point me to the appropriate documentation.

Cheers!

https://github.com/tenderlove/racc/blob/master/lib/racc/parser.rb#L538

tests pass w/o that newline, so I think it should go.