diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-10-24 19:10:03 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-10-24 19:10:03 +0200 |
| commit | b4be25e43b1ee9da924d13b7f2e8289f12bd2c3b (patch) | |
| tree | a21fbec7e6907993463d57b8c75758d2014cebeb /src/func/helpers.rs | |
| parent | ecf0ff4d054f11c79ec0ddbbdf45f3dfcf9fc8d7 (diff) | |
Prettify peeking and rearrange syntax/parsing modules 🧶
Diffstat (limited to 'src/func/helpers.rs')
| -rw-r--r-- | src/func/helpers.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/func/helpers.rs b/src/func/helpers.rs index d562284f..ea0f6b2f 100644 --- a/src/func/helpers.rs +++ b/src/func/helpers.rs @@ -1,11 +1,14 @@ -use super::prelude::*; use std::iter::Peekable; use std::slice::Iter; +use super::prelude::*; /// Implement the function trait more concisely. #[macro_export] macro_rules! function { (data: $ident:ident, $($tts:tt)*) => { + #[allow(unused_imports)] + use $crate::func::prelude::*; + impl Function for $ident { function!(@parse $ident, $($tts)*); } @@ -64,7 +67,7 @@ macro_rules! parse { (optional: $body:expr, $ctx:expr) => { if let Some(body) = $body { - Some($crate::parsing::parse(body, $ctx)?) + Some($crate::syntax::parse(body, $ctx)?) } else { None } @@ -72,7 +75,7 @@ macro_rules! parse { (required: $body:expr, $ctx:expr) => { if let Some(body) = $body { - $crate::parsing::parse(body, $ctx)? + $crate::syntax::parse(body, $ctx)? } else { err!("expected body"); } @@ -83,7 +86,7 @@ macro_rules! parse { #[macro_export] macro_rules! err { ($($tts:tt)*) => { - return Err(ParseError::new(format!($($tts)*))); + return Err($crate::syntax::ParseError::new(format!($($tts)*))); }; } |
