Evaluate REMINDs
This commit is contained in:
parent
fe22c66c5c
commit
66da16f4e3
6 changed files with 115 additions and 29 deletions
|
|
@ -34,6 +34,16 @@ pub enum Error {
|
|||
from: NaiveDate,
|
||||
to: NaiveDate,
|
||||
},
|
||||
/// A `REMIND`'s delta did not move backwards in time from the entry's start
|
||||
/// date. Instead, it either remained at the start date (`to == from`) or
|
||||
/// moved forwards in time (`from < to`).
|
||||
#[error("remind delta did not move backwards")]
|
||||
RemindDidNotMoveBackwards {
|
||||
index: usize,
|
||||
span: Span,
|
||||
from: NaiveDate,
|
||||
to: NaiveDate,
|
||||
},
|
||||
/// A `MOVE a TO b` statement was executed, but there was no entry at the
|
||||
/// date `a`.
|
||||
#[error("tried to move nonexisting entry")]
|
||||
|
|
@ -135,6 +145,19 @@ impl Error {
|
|||
);
|
||||
Self::print_at(sources, index, span, msg);
|
||||
}
|
||||
Error::RemindDidNotMoveBackwards {
|
||||
index,
|
||||
span,
|
||||
from,
|
||||
to,
|
||||
} => {
|
||||
let msg = format!(
|
||||
"Remind delta did not move backwards\
|
||||
\nMoved from {} to {}",
|
||||
from, to
|
||||
);
|
||||
Self::print_at(sources, index, span, msg);
|
||||
}
|
||||
Error::MoveWithoutSource { index, span } => {
|
||||
let msg = "Tried to move nonexisting entry".to_string();
|
||||
Self::print_at(sources, index, span, msg);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue