Skip to content

Commit

Permalink
fix again edition 2018 macro import in do_parse
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal committed Mar 4, 2019
1 parent b645b10 commit e826f28
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ macro_rules! delimited(
/// # }
/// ```
///
#[macro_export]
#[macro_export(local_inner_macros)]
macro_rules! do_parse (
(__impl $i:expr, ( $($rest:expr),* )) => (
$crate::lib::std::result::Result::Ok(($i, ( $($rest),* )))
Expand All @@ -312,7 +312,7 @@ macro_rules! do_parse (
);

(__impl $i:expr, $submac:ident!( $($args:tt)* ) ) => (
compile_error!("do_parse is missing the return value. A do_parse call must end
nom_compile_error!("do_parse is missing the return value. A do_parse call must end
with a return value between parenthesis, as follows:
do_parse!(
Expand All @@ -324,10 +324,10 @@ macro_rules! do_parse (
);

(__impl $i:expr, $field:ident : $submac:ident!( $($args:tt)* ) ~ $($rest:tt)* ) => (
compile_error!("do_parse uses >> as separator, not ~");
nom_compile_error!("do_parse uses >> as separator, not ~");
);
(__impl $i:expr, $submac:ident!( $($args:tt)* ) ~ $($rest:tt)* ) => (
compile_error!("do_parse uses >> as separator, not ~");
nom_compile_error!("do_parse uses >> as separator, not ~");
);
(__impl $i:expr, $field:ident : $e:ident ~ $($rest:tt)*) => (
do_parse!(__impl $i, $field: call!($e) ~ $($rest)*);
Expand Down Expand Up @@ -422,7 +422,7 @@ macro_rules! do_parse (
}
);
($submac:ident!( $($args:tt)* ) >> $($rest:tt)* ) => (
compile_error!("if you are using do_parse outside of a named! macro, you must
nom_compile_error!("if you are using do_parse outside of a named! macro, you must
pass the input data as first argument, like this:
let res = do_parse!(input,
Expand All @@ -436,6 +436,11 @@ macro_rules! do_parse (
);
);

#[macro_export]
macro_rules! nom_compile_error (
(( $(args:tt)* )) => ( compile_error!($($args)*) );
);

#[cfg(test)]
mod tests {
use internal::{Err, IResult, Needed};
Expand Down

0 comments on commit e826f28

Please sign in to comment.