summaryrefslogtreecommitdiff
path: root/src/func/macros.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-12-04 20:20:02 +0100
committerLaurenz <laurmaedje@gmail.com>2019-12-04 20:20:02 +0100
commitf72b1505bebf8d2fe1a60d386a3a3c3b67d4f903 (patch)
tree09fa7137a2bae5454e6f9cecc1936633c90965d4 /src/func/macros.rs
parent9fb31defd037a90bf8f9e38fa33acae23a70b269 (diff)
Unify error types ♾
Diffstat (limited to 'src/func/macros.rs')
-rw-r--r--src/func/macros.rs23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/func/macros.rs b/src/func/macros.rs
index 78cf1f56..0ffdc857 100644
--- a/src/func/macros.rs
+++ b/src/func/macros.rs
@@ -111,7 +111,7 @@ macro_rules! function {
macro_rules! parse {
(forbidden: $body:expr) => {
if $body.is_some() {
- pr!("unexpected body");
+ error!("unexpected body");
}
};
@@ -127,23 +127,16 @@ macro_rules! parse {
if let Some(body) = $body {
$crate::syntax::parse(body, $ctx)?
} else {
- pr!("expected body");
+ error!("expected body");
}
)
}
-/// Early-return with a formatted parsing error or yield
-/// an error expression without returning when prefixed with `@`.
+/// Early-return with a formatted typesetting error or construct an error
+/// expression without returning when prefixed with `@`.
#[macro_export]
-macro_rules! pr {
- (@$($tts:tt)*) => ($crate::syntax::ParseError::new(format!($($tts)*)));
- ($($tts:tt)*) => (return Err(pr!(@$($tts)*)););
-}
-
-/// Early-return with a formatted layouting error or yield
-/// an error expression without returning when prefixed with `@`.
-#[macro_export]
-macro_rules! lr {
- (@$($tts:tt)*) => ($crate::layout::LayoutError::new(format!($($tts)*)));
- ($($tts:tt)*) => (return Err(lr!(@$($tts)*)););
+macro_rules! error {
+ (@unexpected_argument) => (error!(@"unexpected argument"));
+ (@$($tts:tt)*) => ($crate::TypesetError::with_message(format!($($tts)*)));
+ ($($tts:tt)*) => (return Err(error!(@$($tts)*)););
}