Numerous fixes to property drawers.

This commit is contained in:
Tom Alexander
2023-04-19 19:03:51 -04:00
parent b557b9ca5d
commit 603cc131a0
4 changed files with 37 additions and 19 deletions

View File

@@ -76,13 +76,14 @@ fn property_drawer_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<
recognize(tuple((
parser_with_context!(start_of_line)(context),
space0,
tag(":end:"),
tag_no_case(":end:"),
space0,
alt((line_ending, eof)),
)))(input)
}
pub fn node_property<'r, 's>(
#[tracing::instrument(ret, level = "debug")]
fn node_property<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, NodeProperty<'s>> {
@@ -106,7 +107,8 @@ pub fn node_property<'r, 's>(
))
}
Err(_) => {
let (remaining, (_ws, value)) = tuple((space1, is_not("\r\n")))(remaining)?;
let (remaining, (_ws, value, _line_ending)) =
tuple((space1, is_not("\r\n"), line_ending))(remaining)?;
let source = get_consumed(input, remaining);
Ok((
remaining,
@@ -120,10 +122,7 @@ pub fn node_property<'r, 's>(
}
#[tracing::instrument(ret, level = "debug")]
pub fn node_property_name<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, &'s str> {
fn node_property_name<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
let parser_context =
context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode {
class: ExitClass::Beta,
@@ -140,7 +139,7 @@ pub fn node_property_name<'r, 's>(
}
#[tracing::instrument(ret, level = "debug")]
pub fn node_property_name_end<'r, 's>(
fn node_property_name_end<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, &'s str> {