I'm probably missing it from the docs, but how do I parse only a prefix of the input? For instance, I have some preamble in my input that I need to parse separately, so I should get my CST and the rest of the input, much like in the style of parser combinators. E.g. parsing a comma-separated list from the following input string [4, 2]rest-of-input would give me the CST representation of the valid prefix [4, 2] and rest-of-input.
My current workaround includes something like PrefixRule' = PrefixRule any* and creating a separate parser starting with PrefixRule'.
I'm probably missing it from the docs, but how do I parse only a prefix of the input? For instance, I have some preamble in my input that I need to parse separately, so I should get my CST and the rest of the input, much like in the style of parser combinators. E.g. parsing a comma-separated list from the following input string
[4, 2]rest-of-input
would give me the CST representation of the valid prefix[4, 2]
andrest-of-input
.My current workaround includes something like
PrefixRule' = PrefixRule any*
and creating a separate parser starting withPrefixRule'
.