sexp_processor 4.14.0 → 4.15.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
2
  SHA256:
3
- metadata.gz: cc011ca4a8aa9fcdf85662ce6986f007f1d81ba4d1d8caa09ae435fe473de2b7
4
- data.tar.gz: c59277cfb37f85fe144a3e4888d3723dcf85ec860f371e1477b1b5a137d81add
3
+ metadata.gz: dae436d9eece3ad19a5d390da622ee2b73db2db5e73a4a6b06fe351e8759d45f
4
+ data.tar.gz: 64c4cda4d2f25f759812de2dea4bd7d85e948a6d9cba8507a7d64318c358d116
5
5
  SHA512:
6
- metadata.gz: 5a8a91b76f43e488512e61b3a1533efa01456122128cc15901f238dde5457372b79005f63c7941e11d94ef0ce93ccd827859fc7ae3592e1e08f635f26b16f532
7
- data.tar.gz: bd2be1290e3eb2f801267950ea782ae6dc72766e8b7fe3a2c6674a4f7ce2c89960d4afbc1b56adf48eee381c4fcdedc00ef10a931d3e7a07e04f8790373da0d2
6
+ metadata.gz: 8647ce87dca77073d067bd2027b139499fa8db297ea524c453d709f5e52f057c9355b8b2f49e265aa09aef7c1a29dc6038409fb5ba19d33c9fb2eeb972b4c210
7
+ data.tar.gz: 38eb466cf27e2eeb30a14c9eabae202ab3b1d7f119b7b2a715c848fdcf98b8e2e130d656e05336781572d7ca9ff74ea8185683e065e6af557cac50f483b92436
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,16 @@
1
+ === 4.15.0 / 2020-06-09
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Added `child` and `include` to Sexp::Matcher.parse language.
6
+
7
+ === 4.14.1 / 2020-02-09
8
+
9
+ * 2 bug fixes:
10
+
11
+ * Declared support for ruby 2.2+ to gemspec.
12
+ * Fixed alias for `not?` to `-` for ruby <= 2.4. (nard-tech).
13
+
1
14
  === 4.14.0 / 2020-02-06
2
15
 
3
16
  * 4 minor enhancements:
data/Rakefile CHANGED
@@ -11,6 +11,8 @@ Hoe.add_include_dirs("../../ruby_parser/dev/lib")
11
11
  Hoe.spec 'sexp_processor' do
12
12
  developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
13
13
 
14
+ require_ruby_version "~> 2.2"
15
+
14
16
  license "MIT"
15
17
  end
16
18
 
data/lib/sexp_matcher.rb CHANGED
@@ -156,8 +156,9 @@ class Sexp #:nodoc:
156
156
  Not.new arg
157
157
  end
158
158
 
159
- mc = (class << self; self; end)
160
- mc.alias_method :-, :not?
159
+ class << self
160
+ alias - not?
161
+ end
161
162
 
162
163
  # TODO: add Sibling factory method?
163
164
 
@@ -454,7 +455,7 @@ class Sexp #:nodoc:
454
455
  # | NAME:name => name.to_sym
455
456
  # UP_NAME: /[A-Z]\w*/
456
457
  # NAME : /:?[\w?!=~-]+/
457
- # CMD : "t" | "k" | "m" | "atom" | "not?" | "-" | "any"
458
+ # CMD : t | k | m | atom | not? | - | any | child | include
458
459
 
459
460
  def parse_sexp
460
461
  token = next_token
@@ -504,7 +505,7 @@ class Sexp #:nodoc:
504
505
  ##
505
506
  # A collection of allowed commands to convert into matchers.
506
507
 
507
- ALLOWED = [:t, :m, :k, :atom, :not?, :-, :any].freeze
508
+ ALLOWED = [:t, :m, :k, :atom, :not?, :-, :any, :child, :include].freeze
508
509
 
509
510
  ##
510
511
  # Parses a balanced command. A command is denoted by square
@@ -759,11 +760,8 @@ class Sexp #:nodoc:
759
760
  # +child+.
760
761
 
761
762
  def satisfy? o
762
- if child.satisfy? o
763
- true
764
- elsif o.kind_of? Sexp
765
- o.search_each(child).any?
766
- end
763
+ child.satisfy?(o) ||
764
+ (o.kind_of?(Sexp) && o.search_each(child).any?)
767
765
  end
768
766
 
769
767
  def == o # :nodoc:
@@ -34,7 +34,7 @@ require "sexp"
34
34
  class SexpProcessor
35
35
 
36
36
  # duh
37
- VERSION = "4.14.0"
37
+ VERSION = "4.15.0"
38
38
 
39
39
  ##
40
40
  # Automatically shifts off the Sexp type before handing the
data/test/test_sexp.rb CHANGED
@@ -906,7 +906,7 @@ class TestChild < MatcherTestCase
906
906
  end
907
907
 
908
908
  def sexp
909
- s(:x, s(:a))
909
+ s(:x, s(:b), s(:a))
910
910
  end
911
911
 
912
912
  def bad_sexp
@@ -926,6 +926,8 @@ class TestChild < MatcherTestCase
926
926
 
927
927
  def test_satisfy_eh_by_child
928
928
  assert_satisfy matcher, s(:a)
929
+ assert_satisfy matcher, sexp
930
+ refute_satisfy matcher, bad_sexp
929
931
  end
930
932
  end
931
933
 
@@ -1602,8 +1604,10 @@ class TestSexpMatcherParser < Minitest::Test
1602
1604
  test_parse "not?", delay{ not?(m(/^_$/)) }, "[not? [m /^_$/]]"
1603
1605
  test_parse "not2", delay{ -_ }, "[- _]"
1604
1606
  test_parse "any", delay{ q(:a) | q(:b) }, "[any (a) (b)]"
1607
+ test_parse "child", delay{ child(q(:str, m(/woot/))) }, "[child (str [m /woot/])]"
1605
1608
 
1606
1609
  test_parse "klass", delay{ q(:lit, k(Float)) }, "(lit [k Float])"
1610
+ test_parse "const", delay{ q(:const, :Float) }, "(const :Float)"
1607
1611
 
1608
1612
  test_bad_parse "open_sexp", "(a"
1609
1613
  test_bad_parse "closed_sexp", "a)"
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sexp_processor
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.14.0
4
+ version: 4.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  m5x9IDiApM+vCELNwDXXGNFEnQBBK+wAe4Pek8o1V1TTOxL1kGPewVOitX1p3xoN
30
30
  h7iEjga8iM1LbZUfiISZ+WrB
31
31
  -----END CERTIFICATE-----
32
- date: 2020-02-07 00:00:00.000000000 Z
32
+ date: 2020-06-10 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rdoc
@@ -57,14 +57,14 @@ dependencies:
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '3.21'
60
+ version: '3.22'
61
61
  type: :development
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '3.21'
67
+ version: '3.22'
68
68
  description: |-
69
69
  sexp_processor branches from ParseTree bringing all the generic sexp
70
70
  processing tools with it. Sexp, SexpProcessor, Environment, etc... all
@@ -106,9 +106,9 @@ require_paths:
106
106
  - lib
107
107
  required_ruby_version: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ">="
109
+ - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: '0'
111
+ version: '2.2'
112
112
  required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - ">="
metadata.gz.sig CHANGED
Binary file