aboutsummaryrefslogtreecommitdiff
path: root/src/parcom.cr
diff options
context:
space:
mode:
authorMatthew Hall <hallmatthew314@gmail.com>2023-03-13 19:31:28 +1300
committerMatthew Hall <hallmatthew314@gmail.com>2023-03-13 19:31:28 +1300
commit48ea163f12653a709b575f4c26b8348ef53ae0d5 (patch)
treef8e8777e878840d14c1a7f68a81259e3c9e14c35 /src/parcom.cr
parent8e9993e91da2cd28c5c1c3ce46bd2b1884ab91c6 (diff)
Documentation for sequence
Diffstat (limited to 'src/parcom.cr')
-rw-r--r--src/parcom.cr21
1 files changed, 0 insertions, 21 deletions
diff --git a/src/parcom.cr b/src/parcom.cr
index 4f35420..b6e6c3b 100644
--- a/src/parcom.cr
+++ b/src/parcom.cr
@@ -81,27 +81,6 @@ module Parcom
end
end
- class Sequence(T, V) < Parser(T, Array(V))
- def initialize(@ps : Iterable(Parser(T, V)))
- end
-
- # TODO: this can probably be optimised more for Arrays
- # TODO: might be better to use #zip
- def parse(tokens : Tokens(T)) : Result(T, Array(V))
- parsed = [] of V
-
- @ps.each do |p|
- r = p.parse(tokens)
- parsed << r.value
- tokens = r.tokens
- end
-
- Result.new(tokens, parsed)
- rescue ex : ParserFail
- raise ParserFail.new("Sequence: #{ex.message}")
- end
- end
-
class TokenSeq(T) < Parser(T, Array(T))
@p : Sequence(T, T)