From 60f7fc8b7d960ef4266ab532efb282bb17a0c1c5 Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Mon, 13 Mar 2023 18:20:48 +1300 Subject: Small refactor to Many --- src/parcom/many.cr | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/parcom/many.cr b/src/parcom/many.cr index d76fc91..a734c63 100644 --- a/src/parcom/many.cr +++ b/src/parcom/many.cr @@ -21,13 +21,10 @@ module Parcom loop do result = @p.parse?(tokens) + break unless !result.nil? && result.tokens != tokens - if !result.nil? && result.tokens != tokens - parsed << result.value - tokens = result.tokens - else - break - end + parsed << result.value + tokens = result.tokens end Result.new(tokens, parsed) -- cgit v1.2.1