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

Support for Ruby2.7? #203

Closed utkarsh2102 closed 4 years ago

utkarsh2102 commented 4 years ago

Hi,

Ruby2.7 was released in December, 2019. It'd be great if we could have support for that. The build fails against Ruby2.7 with the following log: https://people.debian.org/~kanashiro/ruby2.7/builds/7/ruby-parslet/ruby-parslet_1.8.2-2+rebuild1580882348_amd64-2020-02-05T05:59:10Z.build

utkarsh2102 commented 4 years ago

The failure is this:

Failures:

  1) Parslet::Slice ('foobar', 40, 'foobar') conversion cast to Integer should fail when Integer would fail on a string
     Failure/Error: lambda { Integer(slice) }.should raise_error(ArgumentError, /invalid value/)
       expected ArgumentError with message matching /invalid value/ but nothing was raised
     # ./spec/parslet/slice_spec.rb:115:in `block (5 levels) in <top (required)>'
balasankarc commented 4 years ago

A bit more info on Ruby 2.7

[1] pry(main)> require 'parslet'
=> true
[2] pry(main)> slice = Parslet::Slice.new(Parslet::Position.new('foobar', 40), 'foobar', 40)
=> "foobar"@6
[3] pry(main)> Integer(slice)
=> 0
[4] pry(main)> slice.to_i
=> 0
[5] pry(main)> slice.to_int
ArgumentError: invalid value for Integer(): "foobar"
from /home/balasankarc/.asdf/installs/ruby/2.7.0/lib/ruby/gems/2.7.0/gems/parslet-1.8.2/lib/parslet/slice.rb:94:in `Integer'
[6] pry(main)> 
utkarsh2102 commented 4 years ago

@balasankarc, hi, It's fixed now. So closing this.