There are three scenarios where you would like to use Until:
when there is a separate terminator between structure A and B (A|T|B)
when you know how the structure A ends (AT|B)
when you know how the next structure B starts (A|TB)
The current implementation of Until parses two structures: a def and the terminator.
The current implementation can handle 1. correctly, but for 2 and 3 requires some hacky solutions with some drawbacks. See examples solutions below.
until("A", T)
until("A", post(EMPTY, endsWith(T)))
until("A", sub(T, CURRENT_OFFSET))
Especially for scenario 3, the "T" part is parsed twice and is also available twice in the parseGraph.
This can be resolved by allowing two implementations of Until where you can specify if the terminator should be part of the parseGraph.
There are three scenarios where you would like to use Until:
The current implementation of Until parses two structures: a def and the terminator. The current implementation can handle 1. correctly, but for 2 and 3 requires some hacky solutions with some drawbacks. See examples solutions below.
Especially for scenario 3, the "T" part is parsed twice and is also available twice in the parseGraph. This can be resolved by allowing two implementations of Until where you can specify if the terminator should be part of the parseGraph.