Support comments at the end of the line in diary sexp.
This commit is contained in:
parent
466716881e
commit
2048d8f0b6
@ -0,0 +1 @@
|
|||||||
|
%%(foo bar) ; baz
|
@ -1,9 +1,12 @@
|
|||||||
use nom::branch::alt;
|
use nom::branch::alt;
|
||||||
use nom::bytes::complete::tag;
|
use nom::bytes::complete::tag;
|
||||||
|
use nom::character::complete::anychar;
|
||||||
use nom::character::complete::line_ending;
|
use nom::character::complete::line_ending;
|
||||||
use nom::character::complete::space0;
|
use nom::character::complete::space0;
|
||||||
use nom::combinator::eof;
|
use nom::combinator::eof;
|
||||||
|
use nom::combinator::opt;
|
||||||
use nom::combinator::recognize;
|
use nom::combinator::recognize;
|
||||||
|
use nom::multi::many_till;
|
||||||
use nom::sequence::tuple;
|
use nom::sequence::tuple;
|
||||||
|
|
||||||
use super::org_source::OrgSource;
|
use super::org_source::OrgSource;
|
||||||
@ -24,6 +27,11 @@ pub fn diary_sexp<'r, 's>(
|
|||||||
let (remaining, _clock) = tag("%%")(remaining)?;
|
let (remaining, _clock) = tag("%%")(remaining)?;
|
||||||
let (remaining, _gap_whitespace) = space0(remaining)?;
|
let (remaining, _gap_whitespace) = space0(remaining)?;
|
||||||
let (remaining, _sexp) = recognize(sexp)(remaining)?;
|
let (remaining, _sexp) = recognize(sexp)(remaining)?;
|
||||||
|
let (remaining, _trailing_comment) = opt(tuple((
|
||||||
|
space0,
|
||||||
|
tag(";"),
|
||||||
|
many_till(anychar, alt((line_ending, eof))),
|
||||||
|
)))(remaining)?;
|
||||||
let (remaining, _trailing_whitespace) =
|
let (remaining, _trailing_whitespace) =
|
||||||
recognize(tuple((space0, alt((line_ending, eof)))))(remaining)?;
|
recognize(tuple((space0, alt((line_ending, eof)))))(remaining)?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user