aboutsummaryrefslogtreecommitdiff
path: root/src/parcom.cr
diff options
context:
space:
mode:
authorMatthew Hall <hallmatthew314@gmail.com>2023-03-13 13:10:50 +1300
committerMatthew Hall <hallmatthew314@gmail.com>2023-03-13 13:10:50 +1300
commitc2197ee71ac1cc3cb2ad3bf8a93b579f7251316e (patch)
treee4c23056e68652fe37972faf4c2bea7b74fb8a21 /src/parcom.cr
parentc340687df1215940d33eb822f46598f51e5b3b95 (diff)
Fix Many hanging when wrapped parser never fails
Diffstat (limited to 'src/parcom.cr')
-rw-r--r--src/parcom.cr23
1 files changed, 0 insertions, 23 deletions
diff --git a/src/parcom.cr b/src/parcom.cr
index 6715e07..c7dde7b 100644
--- a/src/parcom.cr
+++ b/src/parcom.cr
@@ -119,29 +119,6 @@ module Parcom
end
end
- class Many(T, V) < Parser(T, Array(V))
- def initialize(@p : Parser(T, V))
- end
-
- def parse(tokens : Tokens(T)) : Result(T, Array(V))
- parsed = [] of V
-
- loop do
- result = @p.parse?(tokens)
- if result.nil?
- break
- else
- parsed << result.value
- tokens = result.tokens
- end
- end
-
- Result.new(tokens, parsed)
- rescue ex : ParserFail
- raise ParserFail.new("Many: #{ex.message}")
- end
- end
-
class Some(T, V) < Parser(T, Array(V))
@p : Assert(T, Array(V))