Cool. I got interested in this subject recently. Have been checking out some text articles and videos about it. Unfortunately there is not much info available (and some of it is advanced stuff), or at least I couldn't find much, so far.
I am working on a library, which is not exactly a parser combinator one, but borrows some of those ideas, for use in other projects.
>One of them is called `Compose`.
About the escapable strings example: can you not just rescan the string for the escape sequences, after grabbing the full string?
> Unfortunately there is not much info available [.]
Parser combinators are a bit hard to get into, the most helpful resource for me was `nom`'s "Choosing a Combinator" document [1], which is dense but gives you an overview of all the Lego bricks which you can then start imagining how to fit together.
I've not really read it, but there's also the original paper on the subject [2] (as linked to by the `parsec` documentation [3]) which describes the nuts and bolts theory behind it.
> [Can] you not just rescan the string for the escape sequences, after grabbing the full string?
Absolutely, this is just a convenience around that pattern that allows you to express that like:
let string = quoted_string.then(escaped(json_string_escapes)).parse(&input)?;
Where `escaped` does the rescanning using the parser `json_string_escapes` (which consumes all the input up to the next escape, if it doesn't start with an escape sequence, or else consumes an escape sequence and returns the transformed text - this API is a little awkward, it may change).
And also more generally for any parsers `foo`, `bar`, and `baz` as:
Cool. I got interested in this subject recently. Have been checking out some text articles and videos about it. Unfortunately there is not much info available (and some of it is advanced stuff), or at least I couldn't find much, so far.
I am working on a library, which is not exactly a parser combinator one, but borrows some of those ideas, for use in other projects.
>One of them is called `Compose`.
About the escapable strings example: can you not just rescan the string for the escape sequences, after grabbing the full string?