Hi there,
I have been stuck with this issues for a few days now and I can't seem to figure it out on my own:
So basically the title, I want to ready everything until a parser succeeds. So essentially the terminated combinator. Here is a snippet:
let parser = make_parser(); // placeholder for brevity
let (input, text) = terminated(read_all, parser).parse(input)?;
My issues is the first argument of terminated read_all. I seem to have tried everything, but nothing works, either it stop too early and throws an error because the terminating parser is invalid or it just reads all the way through to the end and throws an error because it is eof.
The annoying part it seems is, that the text I am trying to read basically contains all types of characters and it can even contain parts of what the terminator parses. Is there a way to make terminated check the terminator before reading every character or a complete alternative to achieve this?
I think just realized the text could even exactly contain the terminator, but I need the very last one, is there a way to parse from the end of the input?
Hi there,
I have been stuck with this issues for a few days now and I can't seem to figure it out on my own:
So basically the title, I want to ready everything until a parser succeeds. So essentially the
terminatedcombinator. Here is a snippet:My issues is the first argument of terminated
read_all. I seem to have tried everything, but nothing works, either it stop too early and throws an error because the terminating parser is invalid or it just reads all the way through to the end and throws an error because it is eof.The annoying part it seems is, that the text I am trying to read basically contains all types of characters and it can even contain parts of what the terminator parses. Is there a way to make terminated check the terminator before reading every character or a complete alternative to achieve this?
I think just realized the text could even exactly contain the terminator, but I need the very last one, is there a way to parse from the end of the input?