Skip to content

Commit

Permalink
tweak: Groups wil not return an array containing a singla element
Browse files Browse the repository at this point in the history
  • Loading branch information
GearsDatapacks committed May 20, 2023
1 parent a80ccf9 commit 3c00a7e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

4 changes: 2 additions & 2 deletions lib/parsby/combinators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,11 @@ def splicer
# Groups results into an array.
define_combinator :group do |*ps|
ps = ps.flatten
~splicer.start do |m|
(~splicer.start { |m|
ps.reduce(empty) do |a, p|
a << m.end(p)
end
end
}).fmap { |result| result.size == 1 ? result.first : result }
end

# Wraps result in a list. This is to be able to do
Expand Down

0 comments on commit 3c00a7e

Please sign in to comment.