Open Sniper10754 opened 9 months ago
Hello! I see why this feature might be interesting, but that would need quite some work, and I don't really have time to work on that at the moment :/
If someone wants to give it a try, please do!
A few suggestions:
#[logos(error = T)]
macros;#[logos(pass_lexer_to_error)]
;T
implements from (E, &Lexer)
instead of from E
for all error types E
.In the meantime, you can simply get span information with lexer.spanned()
or with different iterator style:
while let Some(token) = lexer.next() {
/* you can use `lexer` to get current span and other information. */
}
When using a custom error type, is there a way to have a span provided with the error? what i mean is that a custom error type needs to satisfy the
Default
bound, and because of this logos has no way to provide a span describing where the error happened, something like this would be niceThis would greatly improve diagnostics in my language since i have no way to tell the user of the language where the error happened.