From fc1afdcb72d786836479367ef42d7d82069aaf97 Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Sun, 26 Mar 2023 15:42:56 +1300 Subject: More refactoring --- src/parcom/parser.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/parcom/parser.cr b/src/parcom/parser.cr index 57c7b44..af486c4 100644 --- a/src/parcom/parser.cr +++ b/src/parcom/parser.cr @@ -456,8 +456,8 @@ module Parcom # instance of `self`. It will succeed if it can parse an instance of `self` # that is not followed by any `sep` instances. def sep_by(sep : Parser(T, _)) : Parser(T, Array(U)) - (self + (sep >> self).many).map do |tup| - tup.last.unshift(tup.first) + (self + (sep >> self).many).map do |head, tail| + tail.unshift(head) end.named("<#{@name}> sep by <#{sep.name}>") end end -- cgit v1.2.1