Possibility to use a different Span for `&str`
I see that type Span = SimpleSpan is hard-coded for the impl Input for &str.
I don't think it's possible to opt-out of SimpleSpan and into, say, std::range::Range, without implementing the trait yourself on a wrapper, right?
I'm not sure if the only way would be to put it behind a feature.
Have you see Input::map_span?
I hadn't, but I also couldn't quickly figure out how to use it. For instance:
fn number<'a, I>()
-> impl Parser<'a, I, Token, extra::Err<Rich<'a, char, Range<usize>>>> + Clone
where
I: chumsky::input::ValueInput<'a, Token = char, Span = Range<usize>>,
{
text::digits(10)
.then(just('.').then(text::digits(10)).or_not())
.to_span()
.map(|span| Token::new(TokenKind::Number, span))
}
doesn't seem to work, it gives me a lot of errors
Okay, this works, but wow is it verbose:
fn number<'a, I>()
-> impl Parser<'a, I, Token, extra::Err<Rich<'a, char, Range<usize>>>> + Clone
where
I: chumsky::input::StrInput<'a, Token = char, Span = Range<usize>>
+ chumsky::input::SliceInput<'a, Slice = &'a str>,
And then call it with: parse("123".map_span(Into::into)) which is _okay_er
Maybe it's worth it to invest some time to facilitate an easier way?