The point of this example is to demonstrate how to make whitespace-aware parsers in pom.
I created this as a proof of concept when I wasn't sure if such a job was possible with pom's API.
It works by using >> and take(0) to "tap" the parser and inject the output of an inner parser.
In the process, I had some struggles with lifetimes, and nearly changed parser.rs to use FnMut, but eventually saw how it's possible without any changes needed.
High-level description is something like this:
Parse a white-space aware grammar by recursively parsing blocks of lines with the same indentation level
Greetings
The point of this example is to demonstrate how to make whitespace-aware parsers in pom.
I created this as a proof of concept when I wasn't sure if such a job was possible with pom's API.
It works by using
>>
andtake(0)
to "tap" the parser and inject the output of an inner parser.In the process, I had some struggles with lifetimes, and nearly changed
parser.rs
to useFnMut
, but eventually saw how it's possible without any changes needed.High-level description is something like this: