kschiess / parslet

A small PEG based parser library. See the Hacking page in the Wiki as well.
kschiess.github.com/parslet
MIT License
805 stars 95 forks source link

Various warnings due to uninitialized or unused variables #166

Closed ravinggenius closed 7 years ago

ravinggenius commented 8 years ago

I'm getting an overwhelming number of warnings when running parslet. Some are issued only a few dozen times while others are issued 10 of thousands of times. In total I get over 48K warnings when running the test suite for my parser.

/usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/parslet-1.7.1/lib/parslet/atoms/base.rb:86:  warning: assigned but unused variable - value
/usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/parslet-1.7.1/lib/parslet/atoms/base.rb:140: warning: instance variable @label not initialized

/usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/parslet-1.7.1/lib/parslet/atoms/entity.rb:26: warning: instance variable @parslet not initialized

/usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/parslet-1.7.1/lib/parslet/atoms/lookahead.rb:28: warning: assigned but unused variable - value

/usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/parslet-1.7.1/lib/parslet/cause.rb:62: warning: instance variable @context not initialized

/usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/parslet-1.7.1/lib/parslet/error_reporter/deepest.rb:67: warning: assigned but unused variable - rank

/usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/parslet-1.7.1/lib/parslet/source/line_cache.rb:43: warning: instance variable @last_line_end not initialized

/usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/parslet-1.7.1/lib/parslet/transform.rb:134: warning: instance variable @__transform_rules not initialized
ravinggenius commented 8 years ago

I can fix these myself if a pull request would be welcome.

kschiess commented 7 years ago

If this is still important to you: Can you maybe provide us with a small example PR to look at?

mperham commented 7 years ago

Seeing thousands of errors also, looks like there's a PR now to fix this, @kschiess?

kschiess commented 7 years ago

haters gonna hate...

Does the PR fix all of the thousands of errors? Or is it the sample we talked about?

I am fine with the transformation as executed in the PR and will merge as soon as you say the work is complete.

mperham commented 7 years ago

The 1000s of warnings are all dupes of 2-3 different problems. Happy to verify once you have a fix on master.

mperham commented 7 years ago

@kschiess Any chance of a gem release with this fix?

mperham commented 7 years ago

(and yes, running master works great and no longer shows any warnings!) 🍰 🎆

kschiess commented 7 years ago

1.8.0 just went out. If anything is wrong with it, please let me know.