-
Notifications
You must be signed in to change notification settings - Fork 131
Closed
Description
I noticed an issue reported here in stackoverflow: here
Curious, I looked up the code for rep() and noticed this simple one-liner:
def rep[T](p: => Parser[T]): Parser[List[T]] = rep1(p) | success(List())
Hmm. This looks like it repeats but upon a failure just returns success(List()), which seems to match my observed behavior. Am I reading this correctly?
If so... then this hides the failure. If in 'p' I've returned a failure, the associated message is swallowed, and my calling program has no idea whether 1) parsing fully succeeded or 2) parsing partially succeeded, and if #2 then why it failed.
Are there circumstances when swallowing the failure is a desirable thing?
Metadata
Metadata
Assignees
Labels
No labels