Add comments about the sets of objects that can exist.

This commit is contained in:
Tom Alexander 2023-04-21 15:57:45 -04:00
parent 2dabe093f4
commit c2b6b5103a
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 17 additions and 2 deletions

View File

@ -48,6 +48,7 @@ pub fn standard_set_object<'r, 's>(
context: Context<'r, 's>, context: Context<'r, 's>,
input: &'s str, input: &'s str,
) -> Res<&'s str, Object<'s>> { ) -> Res<&'s str, Object<'s>> {
// TODO: add entities, LaTeX fragments, export snippets, footnote references, citations (NOT citation references), inline babel calls, inline source blocks, line breaks, links, macros, targets and radio targets, statistics cookies, subscript and superscript, timestamps, and text markup.
not(|i| context.check_exit_matcher(i))(input)?; not(|i| context.check_exit_matcher(i))(input)?;
let plain_text_matcher = parser_with_context!(plain_text)(context); let plain_text_matcher = parser_with_context!(plain_text)(context);
@ -60,6 +61,7 @@ pub fn minimal_set_object<'r, 's>(
context: Context<'r, 's>, context: Context<'r, 's>,
input: &'s str, input: &'s str,
) -> Res<&'s str, Object<'s>> { ) -> Res<&'s str, Object<'s>> {
// TODO: add text markup, entities, LaTeX fragments, superscripts and subscripts
not(|i| context.check_exit_matcher(i))(input)?; not(|i| context.check_exit_matcher(i))(input)?;
let plain_text_matcher = parser_with_context!(plain_text)(context); let plain_text_matcher = parser_with_context!(plain_text)(context);

View File

@ -18,6 +18,7 @@ use crate::parser::exiting::ExitClass;
use crate::parser::greater_element::TableRow; use crate::parser::greater_element::TableRow;
use crate::parser::lesser_element::TableCell; use crate::parser::lesser_element::TableCell;
use crate::parser::object::minimal_set_object; use crate::parser::object::minimal_set_object;
use crate::parser::object::Object;
use crate::parser::parser_context::ContextElement; use crate::parser::parser_context::ContextElement;
use crate::parser::parser_context::ExitMatcherNode; use crate::parser::parser_context::ExitMatcherNode;
use crate::parser::parser_with_context::parser_with_context; use crate::parser::parser_with_context::parser_with_context;
@ -115,10 +116,11 @@ pub fn org_mode_table_cell<'r, 's>(
class: ExitClass::Beta, class: ExitClass::Beta,
exit_matcher: &org_mode_table_cell_end, exit_matcher: &org_mode_table_cell_end,
})); }));
let minimal_set_object_matcher = parser_with_context!(minimal_set_object)(&parser_context); let table_cell_set_object_matcher =
parser_with_context!(table_cell_set_object)(&parser_context);
let exit_matcher = parser_with_context!(exit_matcher_parser)(&parser_context); let exit_matcher = parser_with_context!(exit_matcher_parser)(&parser_context);
let (remaining, (children, _exit_contents)) = verify( let (remaining, (children, _exit_contents)) = verify(
many_till(minimal_set_object_matcher, exit_matcher), many_till(table_cell_set_object_matcher, exit_matcher),
|(children, exit_contents)| !children.is_empty() || exit_contents.ends_with("|"), |(children, exit_contents)| !children.is_empty() || exit_contents.ends_with("|"),
)(input)?; )(input)?;
@ -136,3 +138,14 @@ fn org_mode_table_cell_end<'r, 's>(
) -> Res<&'s str, &'s str> { ) -> Res<&'s str, &'s str> {
recognize(tuple((space0, alt((tag("|"), peek(line_ending))))))(input) recognize(tuple((space0, alt((tag("|"), peek(line_ending))))))(input)
} }
#[tracing::instrument(ret, level = "debug")]
pub fn table_cell_set_object<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, Object<'s>> {
not(|i| context.check_exit_matcher(i))(input)?;
parser_with_context!(minimal_set_object)(context)(input)
// TODO: add citations, export snippets, footnote references, links, macros, radio targets, targets, and timestamps.
}