Disallowing begin blocks for keywords makes some of the tests pass.

This commit is contained in:
Tom Alexander 2023-04-21 22:49:00 -04:00
parent ee126d2673
commit 29c03c6655
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 6 additions and 4 deletions

View File

@ -71,9 +71,7 @@ use organic::parser::sexp::sexp_with_padding;
fn is_expect_fail(name: &str) -> Option<&str> { fn is_expect_fail(name: &str) -> Option<&str> {
match name { match name {
"drawer_drawer_with_headline_inside" => Some("Apparently lines with :end: become their own paragraph. This odd behavior needs to be investigated more."), "drawer_drawer_with_headline_inside" => Some("Apparently lines with :end: become their own paragraph. This odd behavior needs to be investigated more."),
// "element_container_priority_drawer_dynamic_block" => Some("Keyword needs to be implemented."), // "element_container_priority_footnote_definition_dynamic_block" => Some("Keyword needs to be implemented."),
"element_container_priority_dynamic_block_dynamic_block" => Some("Keyword needs to be implemented."),
"element_container_priority_footnote_definition_dynamic_block" => Some("Keyword needs to be implemented."),
"element_container_priority_greater_block_dynamic_block" => Some("Keyword needs to be implemented."), "element_container_priority_greater_block_dynamic_block" => Some("Keyword needs to be implemented."),
"element_container_priority_section_dynamic_block" => Some("Keyword needs to be implemented."), "element_container_priority_section_dynamic_block" => Some("Keyword needs to be implemented."),
_ => None, _ => None,

View File

@ -1,11 +1,13 @@
use nom::branch::alt; use nom::branch::alt;
use nom::bytes::complete::is_not; use nom::bytes::complete::is_not;
use nom::bytes::complete::tag; use nom::bytes::complete::tag;
use nom::bytes::complete::tag_no_case;
use nom::character::complete::line_ending; use nom::character::complete::line_ending;
use nom::character::complete::space0; use nom::character::complete::space0;
use nom::character::complete::space1; use nom::character::complete::space1;
use nom::combinator::eof; use nom::combinator::eof;
use nom::combinator::opt; use nom::combinator::not;
use nom::combinator::peek;
use nom::combinator::recognize; use nom::combinator::recognize;
use nom::sequence::tuple; use nom::sequence::tuple;
@ -21,6 +23,8 @@ pub fn keyword<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str,
let (remaining, rule) = recognize(tuple(( let (remaining, rule) = recognize(tuple((
space0, space0,
tag("#+"), tag("#+"),
not(peek(tag_no_case("call"))),
not(peek(tag_no_case("begin"))),
is_not(" \t\r\n:"), is_not(" \t\r\n:"),
tag(":"), tag(":"),
alt((recognize(tuple((space1, is_not("\r\n")))), space0)), alt((recognize(tuple((space1, is_not("\r\n")))), space0)),