aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Hall <hallmatthew314@gmail.com>2023-03-30 22:27:01 +1300
committerMatthew Hall <hallmatthew314@gmail.com>2023-03-30 22:27:01 +1300
commit97be6f4ca3f35b0999a36d647716f77c0300d5d7 (patch)
tree8b124ff33644772a807877b4268811045f47930e /src
parent0f58d020b54fe59aa76c66788000d47bb7baec2a (diff)
Replace overloads of flunk with a default argument
Diffstat (limited to 'src')
-rw-r--r--src/parcom/parser.cr7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/parcom/parser.cr b/src/parcom/parser.cr
index 7a06f53..9e74845 100644
--- a/src/parcom/parser.cr
+++ b/src/parcom/parser.cr
@@ -37,17 +37,12 @@ module Parcom
end
# Creates a parser that always fails with the given error message.
- def self.flunk(message : String) : Parser(T, U)
+ def self.flunk(message : String = "Flunked parser") : Parser(T, U)
Parser(T, U).new("Flunk") do |_|
raise ParserFail.new(message)
end
end
- # Creates a parser that always fails.
- def self.flunk : Parser(T, U)
- flunk("Flunked parser")
- end
-
# Creates a parser that returns the first token in the input stream.
# Fails if the input stream is empty.
# Analagous to a '.' in a regular expression.