From 77c370d27be174e0b036b33d1469e84e67a7153a Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Mon, 13 Mar 2023 20:41:57 +1300 Subject: Documentation for SepBy --- src/parcom.cr | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'src/parcom.cr') diff --git a/src/parcom.cr b/src/parcom.cr index 8c55014..ddb2e50 100644 --- a/src/parcom.cr +++ b/src/parcom.cr @@ -80,21 +80,5 @@ module Parcom def initialize(@tokens : Tokens(T), @value : V) end end - - class SepBy(T, V, U) < Parser(T, Array(V)) - @p : Map(T, {V, Array(V)}, Array(V)) - - def initialize(elem : Parser(T, V), sep : Parser(T, U)) - @p = (elem + Many(T, U).new(sep >> elem)).map do |tup| - [tup[0]] + tup[1] - end - end - - def parse(tokens : Tokens(T)) : Result(T, Array(V)) - @p.parse(tokens) - rescue ex : ParserFail - raise ParserFail.new("SepBy: #{ex.message}") - end - end end -- cgit v1.2.1