diff options
| author | Matthew Hall <hallmatthew314@gmail.com> | 2023-03-12 18:53:19 +1300 |
|---|---|---|
| committer | Matthew Hall <hallmatthew314@gmail.com> | 2023-03-12 18:53:19 +1300 |
| commit | 4724a2809f80d3fd7e221ab569ce01fe0161fa9d (patch) | |
| tree | a8f9f8f8a658132eb3514b7d3a5b180a549b468c /src/parcom.cr | |
| parent | df556b703bdeb860405a8f4ec1698a032f93af07 (diff) | |
Documentation for Left and Right
Diffstat (limited to 'src/parcom.cr')
| -rw-r--r-- | src/parcom.cr | 28 |
1 files changed, 0 insertions, 28 deletions
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) |
