gullah 0.0.2 → 0.0.3

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: cdb5fc63d2f73407d20cfc3fdb709f27e800a1b4c4b572243e46af970d2563c6
4
- data.tar.gz: 4803e11f42479445bc125013777e797fe526f949e1d9620bea34a974f83fd3dc
3
+ metadata.gz: 8aa15a5c7da0a8578bc3462d2342205dbba603f316384bebd2a500c8e15cb3f1
4
+ data.tar.gz: 0e16604686a51b37e14ae5272e218702b317b3a6447e159ccf8b0e685f176780
5
5
  SHA512:
6
- metadata.gz: 03ad7649f31e61e78cb7220809a13e68ce6e8bdc88c497b251c36c9c5a885688bb1fd075b8d0e31e8724ee4d697446ace38cce36381a9ef1f1a2ac5c5642d334
7
- data.tar.gz: 0d86b4e95ef0f6390cac7a47bafc45ed45e68d3bedc0524b95dd82fc2140281da3db3a380a71814f0862ca94e3b05f21634f3975a2b38eb42719254debbd03e3
6
+ metadata.gz: 3ccb50387a8a3fb97cb4cf2ea4bb01946c6e300bda78b1af10aa83d8c0ff22c74de8551bc5dbb96ffec6ba0410a2946f8a24e946abe63a5076713f1d62dbfa12
7
+ data.tar.gz: c1916ff70ac408e8b870c2af1d7cdeb5036778b6876bf277e15ec9a9f2eb65e6c55e51ddb8d526ec99550e6bf508014e239aac532b1759f1c054b57de191bf8a
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  doc/*
2
2
  .yardoc/*
3
+ .byebug_history
data/CHANGES.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.3 *2023-11-24*
4
+ * a few optimizations
5
+
3
6
  ## 0.0.2 *2021-8-29*
4
7
  * still more improvements to documentation
5
8
 
data/README.md CHANGED
@@ -85,3 +85,7 @@ Another possibility, if I have sufficient spare time and am sufficiently ambitio
85
85
  # Acknowledgements
86
86
 
87
87
  I would like to thank my family and co-workers for tolerating me saying "Gullah" much more often than any of them expected.
88
+
89
+ # Dedication
90
+
91
+ I dedicate this gem to my son Jude, a.k.a [TurkeyMcMac](https://github.com/TurkeyMcMac). He was a better programmer than I will ever be and was only getting better. More importantly, he was a kind, funny, thoughtful person. I miss him every day. I love you, Jude.
data/lib/gullah/parse.rb CHANGED
@@ -81,14 +81,14 @@ module Gullah
81
81
  # and the ancestor node where the test was run as erroneous,
82
82
  # so they will increase the +incorrectness_count+ by 2.
83
83
  def incorrectness_count
84
- @incorrectness_count ||= roots.select(&:failed?).count
84
+ @incorrectness_count ||= roots.count(&:failed?)
85
85
  end
86
86
 
87
87
  ##
88
88
  # The count of nodes which have some structure test which was never
89
89
  # successfully run.
90
90
  def pending_count
91
- @pending_count ||= roots.select(&:pending_tests?).count
91
+ @pending_count ||= roots.count(&:pending_tests?)
92
92
  end
93
93
 
94
94
  ##
@@ -122,7 +122,7 @@ module Gullah
122
122
  #
123
123
  # parses = Grammar.parse "this grammar uses the usual whitespace rule"
124
124
  #
125
- # parses.first.nodes.select { |n| n.name == :_ws }.count # => 6
125
+ # parses.first.nodes.count { |n| n.name == :_ws } # => 6
126
126
  def nodes
127
127
  NodeIterator.new self
128
128
  end
@@ -3,5 +3,5 @@
3
3
  module Gullah
4
4
  # This is an alpha release. Gullah has not yet been used in anything
5
5
  # other than unit tests.
6
- VERSION = '0.0.2'
6
+ VERSION = '0.0.3'
7
7
  end
data/test/basic_test.rb CHANGED
@@ -43,7 +43,7 @@ class BasicTest < Minitest::Test
43
43
  parses.each do |p|
44
44
  assert_equal 1, p.roots.length, 'parse has a root node'
45
45
  root = p.roots.first
46
- assert_equal 2, root.subtree.select(&:nonterminal?).count, 'parse has 2 nonterminal nodes'
46
+ assert_equal 2, root.subtree.count(&:nonterminal?), 'parse has 2 nonterminal nodes'
47
47
  assert root.subtree.select(&:nonterminal?).each do |_n|
48
48
  assert_equal 2, b.children.length, 'nonterminal nodes each have 2 children'
49
49
  end
@@ -96,10 +96,10 @@ class BasicTest < Minitest::Test
96
96
  parse = parses.first
97
97
  assert_equal 8, parse.roots.length, 'there are 8 nodes in the parse'
98
98
  assert parse.roots.all?(&:leaf?), 'all nodes are leaf nodes'
99
- assert_equal 3, parse.roots.select { |n| n.name == :ws }.count, 'there are 3 whitespace nodes'
100
- assert_equal 3, parse.roots.select(&:ignorable?).count, 'there are 3 ignorable nodes'
101
- assert_equal 4, parse.roots.select { |n| n.name == :word }.count, 'there are 4 word nodes'
102
- assert_equal 1, parse.roots.select(&:trash?).count, 'there is 1 trash node'
99
+ assert_equal 3, parse.roots.count { |n| n.name == :ws }, 'there are 3 whitespace nodes'
100
+ assert_equal 3, parse.roots.count(&:ignorable?), 'there are 3 ignorable nodes'
101
+ assert_equal 4, parse.roots.count { |n| n.name == :word }, 'there are 4 word nodes'
102
+ assert_equal 1, parse.roots.count(&:trash?), 'there is 1 trash node'
103
103
  last_node = parse.roots.last
104
104
  assert last_node.trash?, 'the last node is the trash node'
105
105
  end
@@ -156,9 +156,9 @@ class BasicTest < Minitest::Test
156
156
  assert_equal 1, parse.roots.reject(&:ignorable?).count, 'there is a root node for this parse'
157
157
  root = parse.roots.first
158
158
  assert_equal :s, root.name, 'found expected root'
159
- assert_equal 2, root.subtree.select { |n| n.name == :thing }.count, 'two things'
160
- assert_equal 1, root.subtree.select { |n| n.name == :word }.count, 'one word'
161
- assert_equal 1, root.subtree.select { |n| n.name == :integer }.count, 'one integer'
159
+ assert_equal 2, root.subtree.count { |n| n.name == :thing }, 'two things'
160
+ assert_equal 1, root.subtree.count { |n| n.name == :word }, 'one word'
161
+ assert_equal 1, root.subtree.count { |n| n.name == :integer }, 'one integer'
162
162
  end
163
163
 
164
164
  class SubRulesWithTest
@@ -185,8 +185,8 @@ class BasicTest < Minitest::Test
185
185
  things = root.subtree.select { |n| n.name == :thing }
186
186
  assert_equal 2, things.count, 'two things'
187
187
  assert things.all? { |n| n.attributes[:satisfied].include?(%i[foo etc]) }, 'passing tests stuff in extra bits'
188
- assert_equal 1, root.subtree.select { |n| n.name == :word }.count, 'one word'
189
- assert_equal 1, root.subtree.select { |n| n.name == :integer }.count, 'one integer'
188
+ assert_equal 1, root.subtree.count { |n| n.name == :word }, 'one word'
189
+ assert_equal 1, root.subtree.count { |n| n.name == :integer }, 'one integer'
190
190
  end
191
191
 
192
192
  class SubRulesWithAncestorTest
@@ -218,8 +218,8 @@ class BasicTest < Minitest::Test
218
218
  assert thing.attributes[:satisfied_descendant].include?([:foo, root.position]),
219
219
  'descendant is marked when ancestor test passes'
220
220
  end
221
- assert_equal 1, root.subtree.select { |n| n.name == :word }.count, 'one word'
222
- assert_equal 1, root.subtree.select { |n| n.name == :integer }.count, 'one integer'
221
+ assert_equal 1, root.subtree.count { |n| n.name == :word }, 'one word'
222
+ assert_equal 1, root.subtree.count { |n| n.name == :integer }, 'one integer'
223
223
  end
224
224
 
225
225
  class LeftAncestor
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gullah
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David F. Houghton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-29 00:00:00.000000000 Z
11
+ date: 2023-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  - !ruby/object:Gem::Version
143
143
  version: '0'
144
144
  requirements: []
145
- rubygems_version: 3.2.15
145
+ rubygems_version: 3.4.15
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: A bottom up parser generator