diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/chomp/error.rs | 2 | ||||
-rw-r--r-- | src/lower/rust.rs | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/chomp/error.rs b/src/chomp/error.rs index 6733d06..d0a3cc8 100644 --- a/src/chomp/error.rs +++ b/src/chomp/error.rs @@ -291,7 +291,7 @@ impl Display for FixError { let start = self.0.span().unwrap_or_else(Span::call_site).start(); write!( f, - "\n({}:{}) assuming `{}' has type {:?}.", + "\n{}:{}: assuming `{}' has type {:?}.", start.line, start.column, self.0.arg(), diff --git a/src/lower/rust.rs b/src/lower/rust.rs index c236bdd..fab040b 100644 --- a/src/lower/rust.rs +++ b/src/lower/rust.rs @@ -66,6 +66,7 @@ impl Backend for RustBackend { ); let tokens = quote! { #[doc=#doc_name] + #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub struct #name; impl Parse for #name { @@ -128,6 +129,7 @@ impl Backend for RustBackend { let right_ty = self.data[right].0.clone(); let name = format_ident!("Alt{}", id); let mut tokens = quote! { + #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub enum #name { Left(#left_ty), Right(#right_ty), @@ -170,7 +172,7 @@ impl Backend for RustBackend { match input.peek().ok_or(TakeError::EndOfStream)? { #(#iter_left)|* => input.take().map(Self::Left), #(#iter_right)|* => input.take().map(Self::Right), - c => input.error(TakeError::BadBranch(c, &[#(#iter_first),*])) + c => Err(TakeError::BadBranch(c, &[#(#iter_first),*])) } } } @@ -204,11 +206,12 @@ impl Backend for RustBackend { let inner = inner.gen(self); let inner_ty = self.data[inner].0.clone(); let tokens = quote! { + #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub struct #name(#inner_ty); impl Parse for #name { fn take<P: Parser + ?Sized>(input: &mut P) -> Result<Self, TakeError> { - input.parse().map(Self) + input.take().map(Self) } } }; |