-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attach input location to tokens (add spans feature) #10
Comments
i think the easiest way to hack this in without adding overhead to the common case is to wrap the i'm interested in this feature but I have no idea how it could be done without adding overhead. probably using a generic that resolves to |
I want to output the nicest error messages possible ... for which I need spans ... not just the current position.
I was thinking of a bunch of |
yes compile-time feature probably works, ideally it would be configurable per tokenizer instance for testability reasons though. perhaps it can be done via generics |
I am afraid I don't see how this could be nicely done with generics. What are these testability reasons you speak of? |
if I want to for example test with codespans, and once without, or benchmark with/without codespans I would have to recompile everything many times generics idea:
and make Your entire tokenizer already has the emitter as type param, so now it can be so during monomorphization you get two separately optimized codepaths |
spans
feature to report source code spans
Hey, thanks for this library ... it looks really promising :) I am working on an HTML linter for which I require the spans of parser errors, tag names, attribute names and attribute values. These spans would ideally be reported as
core::ops::Range<usize>
, so that I can pass them directly to the codespan_reporting library (codespan_reporting::diagnostic::Label::range
in particular). Since span tracking is of course overhead it would be behind an off-by-default feature flag.I recently implemented this in my fork of the html5ever tokenizer ... which I frankly would love to abandon for a more sound library :) If you are interested in this I can probably implement it.
The text was updated successfully, but these errors were encountered: