-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
Description
We call parsers in succession, and a single parser failing should not, at least for most errors, lead to other parsers failing as well. We currently capture a tiny subset of errors in the .parse method of the FormatParser module, but there is no guarantee these are the only errors a parser could raise.
I think what we could use something like this instead:
result_nil_or_error = ParserOptional.(parser, input)
case result_nil_or_error
when Exception #=> register an exception and continue
when nil # => parser didn't do anything
else # => We did recover a meaningful result
end
For this we only have to introduce one wrapper method, and we don't have to change the parsers at all.