organic/src/parser/diary_sexp.rs

20 lines
670 B
Rust
Raw Normal View History

2023-04-22 00:26:49 +00:00
use nom::bytes::complete::tag;
use nom::character::complete::space0;
2023-04-22 00:22:31 +00:00
use super::Context;
use crate::error::Res;
2023-04-22 00:26:49 +00:00
use crate::parser::util::get_consumed;
use crate::parser::util::start_of_line;
2023-04-22 00:22:31 +00:00
use crate::parser::DiarySexp;
#[tracing::instrument(ret, level = "debug")]
pub fn diary_sexp<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, DiarySexp<'s>> {
2023-04-22 00:26:49 +00:00
start_of_line(context, input)?;
let (remaining, _leading_whitespace) = space0(input)?;
let (remaining, _clock) = tag("%%")(remaining)?;
let (remaining, _gap_whitespace) = space0(remaining)?;
let source = get_consumed(input, remaining);
Ok((remaining, DiarySexp { source }))
2023-04-22 00:22:31 +00:00
}