Replies: 1 comment 1 reply
-
Hi. I think it would be desirable to have something like this, yes. You can currently do it with Obviously, this is undesirable: files can be far larger than the available memory so there needs to be a way to drop unnecessary input. One option might be to give parsers a way to say "I'll definitely never need anything before offset Implementation-wise, I imagine this as a function on trait Input {
...
/// If desirable, discard tokens with an offset less than `offset`. This is purely an optimisation: a no-op does not change parser semantics.
/// The user of the input will promise to not query tokens before this offset after this call
fn hint_discard_before(&self, offset: Self::Offset) {}
...
} As an aside, |
Beta Was this translation helpful? Give feedback.
-
I'm not entirely sure how this would be implemented. I would like, though, to be able to run chumsky over a file that should be UTF-8, and have it transparently handle incoming data as UTF-8, producing a non-recoverable error if it is invalid.
Given direction, I could help implement this.
Beta Was this translation helpful? Give feedback.
All reactions