Skip to content
This repository has been archived by the owner on Jul 7, 2020. It is now read-only.

ruby_parser parsing error with block comments #1

Closed
ghost opened this issue Mar 14, 2011 · 4 comments
Closed

ruby_parser parsing error with block comments #1

ghost opened this issue Mar 14, 2011 · 4 comments

Comments

@ghost
Copy link

ghost commented Mar 14, 2011

Hi,

I run on:

ruby 1.8.7
rails 3.0.3
metrical 0.0.4
metric_fu 2.0.1
ruby_parser 2.0.6

In my code I have a comment block, like

=begin
  This will crash
=end

The block causes the command 'metrical' to produce an error:

from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:227:in `load_dependency'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/railties-3.0.3/lib/rails/engine.rb:201
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/railties-3.0.3/lib/rails/engine.rb:200:in `each'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/railties-3.0.3/lib/rails/engine.rb:200
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `run_initializers'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/railties-3.0.3/lib/rails/application.rb:77:in `send'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
from /Users/Clint/work/projects/customer/test/config/environment.rb:5
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /Users/Clint/work/projects/customer/test/config.ru:3
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
from /Users/Clint/.rvm/gems/ruby-1.8.7-p302@test/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
from /Users/Clint/work/projects/customer/test/config.ru:1:in `new'
from /Users/Clint/work/projects/customer/test/config.ru:1test

changing the above comment block to

#=begin
# This will not crash
#=end

"fixes" the parser error.

@iain
Copy link
Owner

iain commented Mar 14, 2011

Are you sure it's being caused by metrical?
Metrical is just a thin wrapper around metric_fu, which in turn runs a lot of other gems like roodi, flay and flog to parse your code. The problem might be in any of these gems.

I was unable to reproduce the problem in Ruby 1.9.2 at least. Which Ruby version are you running?

@ghost
Copy link
Author

ghost commented Mar 14, 2011

I am on ruby 1.8.7, it could be a metric_fu problem, yes. I first wanted to check with you, if you encountered it too. Uhm, .. perhaps it is best, if I move/recreate that at metric_fu.

@iain
Copy link
Owner

iain commented Mar 14, 2011

I have been able to reproduce the problem on 1.8.7.
The problem lies in RCov.

@ghost
Copy link
Author

ghost commented Mar 14, 2011

Thanks a lot, I will report it there, if no ticket is open.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant