A | B != B | A - cats-parse
maybe, remove this
| method. just use
While it is true that | is not commutative (a.backtrack | b.backtrack would be), having an infix operator is very nice.
Do you have any other suggestions?
| would act like
I just write graphql schema parser.
there are some user experience to share:
1. need insert lots of whitespaces, maybe it's a good idea to create ParserContext, just like fastparse to handle whitespaces.
2. so much
? always need
backtrack. maybe it's my code fault, there would have nice way to avoid using so much backtrack.
P[A] ~ (P[B].surround(whitespaces).backtrack.? ~ P[C].surround(whitespaces).backtrack.?) will read whitespaces twice when P[B] fails. but I don't know how to avoid.
/ for their non-commutative "or" for this reason - would that fit here?
Sorry I'm slow to reply on the weekend.
You definitely don't always need backtrack with ?. I'll rewrite some of your examples without backtrack and it might give you a feel for how to do it.
A big design property of this library is to encourage you to write parsers avoiding backtracking since that can easily result in accidental exponential complexity and also it generally results in poor descriptions of what went wrong.
That said, we could probably do with better educational materials to help people get started.
Also note | does act like oneOf. It is a synonym. oneOf is also not commutative, it matches left to right.
@johnynek thanks. And I'm sorry that I misunderstand the usage of
|. It's good.
- 1882 - Player 1 has 13/14 certificates, but cannot purchase a share. - 18xx
- Getting `message failed` on uploading more than 10 images - stream-chat-react-native
- Change OTLP gRPC port number - agent
- keras TensorBoard write_grads prevents training from starting - Python
- [Bug] Unable to use the Firebase Resize Image Extension when uploading from the Unity SDK - quickstart-unity
- firejail prevents Firefox from deactivating screen dimming during video watch C