Got this text:
Want this || Not this
The line may also look like this:
Want this | Not this
with a single pipe.
I'm using this grammar to parse it:
grammar HC {
token TOP { <pre> <divider> <post> }
token pre { \N*? <?before <divider>> }
token divider { <[|]> ** 1..2 }
token post { \N* }
}
Is there a better way to do this? I'd love to be able to do something more like this:
grammar HC {
token TOP { <pre> <divider> <post> }
token pre { \N*? }
token divider { <[|]> ** 1..2 }
token post { \N* }
}
But this does not work. And if I do this:
grammar HC {
token TOP { <pre>* <divider> <post> }
token pre { \N }
token divider { <[|]> ** 1..2 } }
token post { \N* }
}
Each character before divider gets its own <pre> capture. Thanks.