Move entries to a different time

This commit is contained in:
Joscha 2021-12-21 19:24:27 +01:00
parent 05a4582f13
commit 1ac39c69f2
9 changed files with 99 additions and 26 deletions

View file

@ -618,9 +618,23 @@ fn parse_stmt_move(p: Pair<'_, Rule>) -> Result<Statement> {
let span = (&p.as_span()).into();
let mut p = p.into_inner();
let from = parse_datum(p.next().unwrap())?.value;
let to = parse_datum(p.next().unwrap())?.value;
assert_eq!(p.next(), None);
Ok(Statement::Move { span, from, to })
let mut to = None;
let mut to_time = None;
for p in p {
match p.as_rule() {
Rule::datum => to = Some(parse_datum(p)?.value),
Rule::time => to_time = Some(parse_time(p)?.value),
_ => unreachable!(),
}
}
Ok(Statement::Move {
span,
from,
to,
to_time,
})
}
fn parse_stmt_remind(p: Pair<'_, Rule>) -> Result<Statement> {