sexp_processor 4.14.1 → 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: 59db6864bb21ae55d428724e2b8b99a3098c00309a8ccdfb8e8cc05dabb82021
4
- data.tar.gz: 80a9a79d9ef68f29d1f9ee0ba5ba0259557b86aaa693fd0f06f70e7524c195b0
3
+ metadata.gz: dae436d9eece3ad19a5d390da622ee2b73db2db5e73a4a6b06fe351e8759d45f
4
+ data.tar.gz: 64c4cda4d2f25f759812de2dea4bd7d85e948a6d9cba8507a7d64318c358d116
5
5
  SHA512:
6
- metadata.gz: b9a2677646cf9d7725d7ad05bb6270c0261668367e705dd22e898adb5021999ebf152e8a5d72bab167f1db3705e9b5dbb4e6d07d3bb0597382c0134626c00894
7
- data.tar.gz: c074793315c71fddfa9063eb28475fd205ef479c5049be668e47be4605144a7a0be36b421eb8e432f8a5f34e45089d61be947ee05ce0e352e11af7c213ae299c
6
+ metadata.gz: 8647ce87dca77073d067bd2027b139499fa8db297ea524c453d709f5e52f057c9355b8b2f49e265aa09aef7c1a29dc6038409fb5ba19d33c9fb2eeb972b4c210
7
+ data.tar.gz: 38eb466cf27e2eeb30a14c9eabae202ab3b1d7f119b7b2a715c848fdcf98b8e2e130d656e05336781572d7ca9ff74ea8185683e065e6af557cac50f483b92436
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,9 @@
1
+ === 4.15.0 / 2020-06-09
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Added `child` and `include` to Sexp::Matcher.parse language.
6
+
1
7
  === 4.14.1 / 2020-02-09
2
8
 
3
9
  * 2 bug fixes:
@@ -455,7 +455,7 @@ class Sexp #:nodoc:
455
455
  # | NAME:name => name.to_sym
456
456
  # UP_NAME: /[A-Z]\w*/
457
457
  # NAME : /:?[\w?!=~-]+/
458
- # CMD : "t" | "k" | "m" | "atom" | "not?" | "-" | "any"
458
+ # CMD : t | k | m | atom | not? | - | any | child | include
459
459
 
460
460
  def parse_sexp
461
461
  token = next_token
@@ -505,7 +505,7 @@ class Sexp #:nodoc:
505
505
  ##
506
506
  # A collection of allowed commands to convert into matchers.
507
507
 
508
- ALLOWED = [:t, :m, :k, :atom, :not?, :-, :any].freeze
508
+ ALLOWED = [:t, :m, :k, :atom, :not?, :-, :any, :child, :include].freeze
509
509
 
510
510
  ##
511
511
  # Parses a balanced command. A command is denoted by square
@@ -760,11 +760,8 @@ class Sexp #:nodoc:
760
760
  # +child+.
761
761
 
762
762
  def satisfy? o
763
- if child.satisfy? o
764
- true
765
- elsif o.kind_of? Sexp
766
- o.search_each(child).any?
767
- end
763
+ child.satisfy?(o) ||
764
+ (o.kind_of?(Sexp) && o.search_each(child).any?)
768
765
  end
769
766
 
770
767
  def == o # :nodoc:
@@ -34,7 +34,7 @@ require "sexp"
34
34
  class SexpProcessor
35
35
 
36
36
  # duh
37
- VERSION = "4.14.1"
37
+ VERSION = "4.15.0"
38
38
 
39
39
  ##
40
40
  # Automatically shifts off the Sexp type before handing the
@@ -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,6 +1604,7 @@ 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])"
1607
1610
  test_parse "const", delay{ q(:const, :Float) }, "(const :Float)"
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.1
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-09 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
metadata.gz.sig CHANGED
Binary file