-
Notifications
You must be signed in to change notification settings - Fork 38
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
Compatibility with VerboseError #36
Comments
Hi, I didn't use verbose errors with nom 5 yet, but it looks like this is not related to |
I'm using: pub type Input<'i> = LocatedSpanEx<&'i str, ()>;
pub type PResult<'i, O> = IResult<Input<'i>, O, VerboseError<Input<'i>>>; and this works for writing parsers. But I can't use the |
Indeed. I wonder why nom implemented it only for |
Could a new version of this crate be released? 7eb8155 fixes this issue but it's only on master, not on crates.io yet. |
v2.0.0 is released since the previous comment. Maybe this issue can be closed? |
To my knowledge, convert_error is still only for &str, which means it cannot be used with a span. There's an open PR for nom to enable AsStr support: rust-bakery/nom#1050 Separately, there was an issue opened for just this scenario, but didn't receive a response: rust-bakery/nom#1149 |
hello, I just change |
although I think a different approach would be needed, since |
This still isn't working as let errors = e
.errors
.into_iter()
.map(|(input, error)| (*input.fragment(), error))
.collect();
convert_error(input.as_str(), VerboseError { errors }) |
Hello. I also tried to use impl<T: Deref, X> Deref for LocatedSpan<T, X> {
type Target = <T as Deref>::Target;
fn deref(&self) -> &Self::Target {
&self.fragment.deref()
}
} I haven't thought it through, but it should work. I'll try it in my code after this. PS: I tried it, but it makes the code less cleanly written. I had to rewrite my code where I used |
Hi fflorent and others.
Is there some example how to use
nom_locate
with theVerboseError
type.I tried changing the example.
as well as:
(The latter perhaps makes no sense...).
In both cases I end up with missing trait implementations, so I wonder if I made some stupid mistake, or that there is a compatibility issue?
(By the way, I use the latest released versions of both
nom
andnom_locate
.)Best regards
Per
The text was updated successfully, but these errors were encountered: