Skip to content
Discussion options

You must be logged in to vote

I think there's more complexity here than you might realise. Chumsky isn't just a wrapper over a set of functions that return Result<O, E::Error>. During parsing, we carry state about the current set of 'potential-errors' around with the parser, embellishing it as the parse tree gets explored. We can't easily just drop that state.

It is usually a good idea to use a type/trait alias to define your error type in a single place, then you can reference it in many other places. I'd recommend starting off by using your current error type in this alias, swapping all uses, checking that it compiles, and then proceeding with the refactor.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@zesterer
Comment options

Answer selected by Swiftb0y
@Swiftb0y
Comment options

@zesterer
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants