From 4724a2809f80d3fd7e221ab569ce01fe0161fa9d Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Sun, 12 Mar 2023 18:53:19 +1300 Subject: Documentation for Left and Right --- src/parcom.cr | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'src/parcom.cr') diff --git a/src/parcom.cr b/src/parcom.cr index acb0503..e421e5e 100644 --- a/src/parcom.cr +++ b/src/parcom.cr @@ -81,34 +81,6 @@ module Parcom end end - class Left(T, V, U) < Parser(T, V) - @p : Map(T, {V, U}, V) - - def initialize(p1 : Parser(T, V), p2 : Parser(T, U)) - @p = (p1 + p2).map(&.first) - end - - def parse(tokens : Tokens(T)) : Result(T, V) - @p.parse(tokens) - rescue ex : ParserFail - raise ParserFail.new("Left: #{ex.message}") - end - end - - class Right(T, V, U) < Parser(T, U) - @p : Map(T, {V, U}, U) - - def initialize(p1 : Parser(T, V), p2 : Parser(T, U)) - @p = (p1 + p2).map(&.last) - end - - def parse(tokens : Tokens(T)) : Result(T, U) - @p.parse(tokens) - rescue ex : ParserFail - raise ParserFail.new("Right: #{ex.message}") - end - end - class Recover(T, V) < Parser(T, V) @p : Map(T, V?, V) -- cgit v1.2.1