summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 84e1e83..5170f97 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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 {