diff options
| author | Matthew Hall <hallmatthew314@gmail.com> | 2023-03-31 22:09:05 +1300 |
|---|---|---|
| committer | Matthew Hall <hallmatthew314@gmail.com> | 2023-03-31 22:09:05 +1300 |
| commit | 5d023a1ed0419e63615e41fd14004373e44f87ed (patch) | |
| tree | bc549dc2fc737d9681e39f86f88b41ddd8f73e9c | |
| parent | fdfce3d4c7a672fdff10e91bf5a4808cd4d46c4d (diff) | |
More informative error messages
| -rw-r--r-- | src/parcom/parser.cr | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/parcom/parser.cr b/src/parcom/parser.cr index 9e74845..3fe4746 100644 --- a/src/parcom/parser.cr +++ b/src/parcom/parser.cr @@ -160,6 +160,8 @@ module Parcom # Calls this parser's parsing function with the given input stream. def parse(tokens : Tokens(T)) : Result(T, U) @f.call(tokens) + rescue ex : ParserFail + raise ParserFail.new("#{@name}: #{ex.message}") end # Same as `#parse`, but returns `nil` instead of |
