Skip to content
This repository was archived by the owner on Apr 2, 2026. It is now read-only.
Discussion options

You must be logged in to vote

Hmm, so if I'm understanding you correctly, the issue is that your map/fold functions generate outputs, but also produce a side-effect that is observed by your CST state?

So, as stated, the mapping/folding functions are intended to only be used for transforming parser outputs. In the short turn you can 'hack' a fix together by using .try_map(|x| Ok(x)): because try_map can change the outcome of a parse, and because it depends on the output, it forces previous outputs to be generated.

Out of interest, why does node creation have to be impure? Is it not sufficient to simply use Inspector::on_token to record the input as it is read?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lynzrand
Comment options

Answer selected by lynzrand
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