From b274828831fec26cd8b3089ffef14cb96ce2de2f Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Thu, 16 Mar 2023 20:36:03 +1300 Subject: Second rewrite attempt, this one should work, monkaS --- src/__OLD_parcom/flunk.cr | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/__OLD_parcom/flunk.cr (limited to 'src/__OLD_parcom/flunk.cr') diff --git a/src/__OLD_parcom/flunk.cr b/src/__OLD_parcom/flunk.cr new file mode 100644 index 0000000..00a0bd6 --- /dev/null +++ b/src/__OLD_parcom/flunk.cr @@ -0,0 +1,12 @@ +require "./parser.cr" + +module Parcom + # `Flunk` is a `Parser` that always fails. + class Flunk(T, V) < Parser(T, V) + # Always raises `ParserFail` + def parse(tokens) : Result(T, V) + raise ParserFail.new("Flunk: parsing failed") + end + end +end + -- cgit v1.2.1