diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -19,7 +19,7 @@ pub mod nom { //! nom's result types, re-exported. - pub use nom::{error::ErrorKind, Err, IResult, Needed}; + pub use nom::{error::ErrorKind, error::Error, Err, IResult, Needed}; } pub mod expr; pub mod literal; @@ -86,6 +86,15 @@ impl<I> From<(I, ErrorKind)> for Error<I> { } } +impl<I> From<::nom::error::Error<I>> for Error<I> { + fn from(e: ::nom::error::Error<I>) -> Self { + Self { + input: e.input, + error: e.code.into(), + } + } +} + impl<I> ::nom::error::ParseError<I> for Error<I> { fn from_error_kind(input: I, kind: nom::ErrorKind) -> Self { Self { |