Implement formula evaluation for DATE statement
This commit is contained in:
parent
c391d76690
commit
cb7c87b8b2
7 changed files with 237 additions and 30 deletions
|
|
@ -6,6 +6,7 @@ use crate::files::primitives::{Span, Time};
|
|||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
/// A delta step resulted in an invalid date.
|
||||
DeltaInvalidStep {
|
||||
span: Span,
|
||||
start: NaiveDate,
|
||||
|
|
@ -13,6 +14,7 @@ pub enum Error {
|
|||
prev: NaiveDate,
|
||||
prev_time: Option<Time>,
|
||||
},
|
||||
/// A time-based delta step was applied to a date without time.
|
||||
DeltaNoTime {
|
||||
span: Span,
|
||||
start: NaiveDate,
|
||||
|
|
@ -29,6 +31,16 @@ pub enum Error {
|
|||
/// A `MOVE a TO b` statement was executed, but there was no entry at the
|
||||
/// date `a`.
|
||||
MoveWithoutSource { span: Span },
|
||||
/// A division by zero has occurred.
|
||||
DivByZero { span: Span, date: NaiveDate },
|
||||
/// A modulo operation by zero has occurred.
|
||||
ModByZero { span: Span, date: NaiveDate },
|
||||
/// Easter calculation failed.
|
||||
Easter {
|
||||
span: Span,
|
||||
date: NaiveDate,
|
||||
msg: &'static str,
|
||||
},
|
||||
}
|
||||
|
||||
pub type Result<T> = result::Result<T, Error>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue