parslet 1.8.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bf32b3cc2b921b4719c37f9db7e0e1449e55cfc2
4
- data.tar.gz: 18c1fa21fa37be7feb7c82d835e959e6c892edee
2
+ SHA256:
3
+ metadata.gz: 4c354ef695d473ab9e07696a3c43328ee5d8a90172582c90529ed2c2b00fe86a
4
+ data.tar.gz: b5c22e9142d9393b17569b872640010673cc6c0d835a5519d6b81c8ce7f8b64a
5
5
  SHA512:
6
- metadata.gz: c3f7130bc7fead70924701060a12c884bc1eb350336aa1d2808853fa602b86e9163e6051bdb458def9e16062f894cb4cb1575a3b87b6005a3d2978574076233d
7
- data.tar.gz: 0a69e33741168a4048514856b3c60756d92162f21a21f91c1bc8fed688857682fc5ef34281b575021f0f5417629ee175a8f121def608c1c68422f29a87d8fe31
6
+ metadata.gz: 7757ff468d6b982c9f2ff94096059e318cabccecc1fcd49695c93862f845222e81219baea8a5b6bec79cef720782f40af21f6afda89b0ebe1c96b5c6642bd892
7
+ data.tar.gz: b4be31a47471eb81f29fc8ddf118dd498bc144f96086d70ccb04e1d27ae12a21fd66a31c5155fbcb26d1dd6a8e5d94402ab302fc805285aeac1c021cb155165b
@@ -1,8 +1,17 @@
1
1
 
2
- = 2.0 / ?? (future release changes, like a reminder to self)
2
+ = 2.0 / 16Feb2020
3
+
4
+ This release is essentially what is called a 'done' release, meaning I consider
5
+ that parslet meets its goals and doesn't need (much) more evolution.
3
6
 
4
7
  - prsnt? and absnt? are now finally banned into oblivion. Wasting vocals for
5
8
  the win.
9
+
10
+ - Because Ruby 2.6 broke Integer() conversion for non-Strings, we've removed
11
+ to_int for slices; to assert Integer type, you must now 'Integer(slice.to_s)'.
12
+ (Broken? How? Integer now (2.6) calls to_int - and when that fails - to_i.
13
+ A class that has both will never raise an exception. Incientially, this makes
14
+ String a unicorn class.)
6
15
 
7
16
  = 1.8.2 / 13Feb2018
8
17
 
data/README CHANGED
@@ -70,4 +70,4 @@ STATUS
70
70
 
71
71
  Production worthy.
72
72
 
73
- (c) 2010-2017 Kaspar Schiess
73
+ (c) 2010-2018 Kaspar Schiess
@@ -38,7 +38,10 @@ attempt_parse
38
38
  puts 'it terminates before we require mathn'
39
39
 
40
40
  puts "requiring mathn now"
41
- require 'mathn'
41
+ # mathn was deprecated as of Ruby 2.5
42
+ if RUBY_VERSION.gsub(/[^\d]/, '').to_i < 250
43
+ require 'mathn'
44
+ end
42
45
  puts "and trying again (will hang without the fix)"
43
46
  attempt_parse # but it doesn't terminate after requiring mathn
44
- puts "okay!"
47
+ puts "okay!"
@@ -89,14 +89,6 @@ module Parslet::Atoms::DSL
89
89
  Parslet::Atoms::Lookahead.new(self, true)
90
90
  end
91
91
 
92
- # Alias for present? that will disappear in 2.0 (deprecated)
93
- #
94
- alias prsnt? present?
95
-
96
- # Alias for absent? that will disappear in 2.0 (deprecated)
97
- #
98
- alias absnt? absent?
99
-
100
92
  # Marks a parslet atom as important for the tree output. This must be used
101
93
  # to achieve meaningful output from the #parse method.
102
94
  #
@@ -10,7 +10,7 @@ class Parslet::Atoms::Infix < Parslet::Atoms::Base
10
10
  end
11
11
 
12
12
  def try(source, context, consume_all)
13
- return catch_error {
13
+ return catch(:error) {
14
14
  return succ(
15
15
  produce_tree(
16
16
  precedence_climb(source, context, consume_all)))
@@ -56,7 +56,7 @@ class Parslet::Atoms::Infix < Parslet::Atoms::Base
56
56
  success, value = @element.apply(source, context, false)
57
57
 
58
58
  unless success
59
- abort context.err(self, source, "#{@element.inspect} was expected", [value])
59
+ throw :error, context.err(self, source, "#{@element.inspect} was expected", [value])
60
60
  end
61
61
 
62
62
  result << flatten(value, true)
@@ -108,13 +108,6 @@ class Parslet::Atoms::Infix < Parslet::Atoms::Base
108
108
  return nil
109
109
  end
110
110
 
111
- def abort(error)
112
- throw :error, error
113
- end
114
- def catch_error
115
- catch(:error) { yield }
116
- end
117
-
118
111
  def to_s_inner(prec)
119
112
  ops = @operations.map { |o, _, _| o.inspect }.join(', ')
120
113
  "infix_expression(#{@element.inspect}, [#{ops}])"
@@ -90,11 +90,8 @@ class Parslet::Slice
90
90
  def to_sym
91
91
  str.to_sym
92
92
  end
93
- def to_int
94
- Integer(str)
95
- end
96
93
  def to_i
97
- str.to_i
94
+ self.str.to_i
98
95
  end
99
96
  def to_f
100
97
  str.to_f
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'parslet'
5
- s.version = '1.8.2'
5
+ s.version = '2.0.0'
6
6
 
7
7
  s.authors = ['Kaspar Schiess']
8
8
  s.email = 'kaspar.schiess@absurd.li'
@@ -3,23 +3,5 @@ require 'spec_helper'
3
3
  describe Parslet::Atoms::DSL do
4
4
  describe "deprecated methods" do
5
5
  let(:parslet) { Parslet.str('foo') }
6
- describe "<- #absnt?" do
7
- slet(:absnt) { parslet.absnt? }
8
- it '#bound_parslet' do
9
- absnt.bound_parslet.should == parslet
10
- end
11
- it 'should be a negative lookahead' do
12
- absnt.positive.should == false
13
- end
14
- end
15
- describe "<- #prsnt?" do
16
- slet(:prsnt) { parslet.prsnt? }
17
- it '#bound_parslet' do
18
- prsnt.bound_parslet.should == parslet
19
- end
20
- it 'should be a positive lookahead' do
21
- prsnt.positive.should == true
22
- end
23
- end
24
6
  end
25
7
  end
@@ -112,8 +112,8 @@ describe Parslet::Slice do
112
112
  s.to_i.should == 1234
113
113
  end
114
114
  it "should fail when Integer would fail on a string" do
115
- lambda { Integer(slice) }.should raise_error(ArgumentError, /invalid value/)
116
- end
115
+ lambda { Integer(slice.to_s) }.should raise_error(ArgumentError, /invalid value/)
116
+ end
117
117
  it "should turn into zero when a string would" do
118
118
  slice.to_i.should == 0
119
119
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parslet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaspar Schiess
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-13 00:00:00.000000000 Z
11
+ date: 2020-02-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: kaspar.schiess@absurd.li
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  version: '0'
188
188
  requirements: []
189
189
  rubyforge_project:
190
- rubygems_version: 2.6.8
190
+ rubygems_version: 3.0.0.beta2
191
191
  signing_key:
192
192
  specification_version: 4
193
193
  summary: Parser construction library with great error reporting in Ruby.