Repository navigation
How to run the Rest parser when a OneOf parser fails #386
Replies: 2 comments 1 reply
|
Hi @SwiftDevJournal, I think you will need to provide some code (as well as the text format you are trying to parse) in order for me to better understand your situation. I would think something like |
|
I'm trying to parse the commit message of a commit in the Jujutsu version control system. The details of a commit consist of the following:
A typical commit looks like the following: To get the commit message, I skip everything through the first blank line and any whitespace after the blank line. I read everything until there's a blank line and the start of the details of what changed, such as the text "Modified regular file". Here's the code I have. If a commit doesn't have one of the markers for the start of what changed, I want to run the |
Uh oh!
There was an error while loading. Please reload this page.
I have a
OneOfparser in my code. When all the parsers in theOneOfparser fail, I want to consume the remaining text in the input. TheRestparser consumes the remaining text. I see there's a.replaceErrormodifier that lets you return a string when theOneOfparser fails.How do I run the
Restparser on the remaining text in the input and supply the results to the.replaceErrormodifier when theOneOfparser fails?All reactions