diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index 005119b..0000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -2.4.1 diff --git a/lib/parsby/combinators.rb b/lib/parsby/combinators.rb index 28d0e47..d99a783 100644 --- a/lib/parsby/combinators.rb +++ b/lib/parsby/combinators.rb @@ -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