Match objects in cells.

This commit is contained in:
Tom Alexander 2023-04-19 22:09:53 -04:00
parent 55201e905a
commit 49f5b65acf
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 17 additions and 7 deletions

View File

@ -1,4 +1,5 @@
use super::element::Element;
use super::lesser_element::TableCell;
#[derive(Debug)]
pub struct PlainList<'s> {
@ -67,8 +68,3 @@ pub struct TableRow<'s> {
pub source: &'s str,
pub children: Vec<TableCell<'s>>,
}
#[derive(Debug)]
pub struct TableCell<'s> {
pub source: &'s str,
}

View File

@ -1,4 +1,5 @@
use super::object::{Object, TextMarkup};
use super::object::Object;
use super::object::TextMarkup;
#[derive(Debug)]
pub struct Paragraph<'s> {
@ -11,6 +12,12 @@ pub struct Comment<'s> {
pub source: &'s str,
}
#[derive(Debug)]
pub struct TableCell<'s> {
pub source: &'s str,
pub children: Vec<Object<'s>>,
}
impl<'s> Paragraph<'s> {
pub fn of_text(input: &'s str) -> Self {
let mut objects = Vec::with_capacity(1);

View File

@ -6,6 +6,7 @@ use nom::character::complete::space0;
use nom::combinator::not;
use nom::combinator::peek;
use nom::combinator::recognize;
use nom::combinator::verify;
use nom::multi::many1;
use nom::multi::many_till;
use nom::sequence::tuple;
@ -13,8 +14,8 @@ use nom::sequence::tuple;
use super::Context;
use crate::parser::error::Res;
use crate::parser::exiting::ExitClass;
use crate::parser::greater_element::TableCell;
use crate::parser::greater_element::TableRow;
use crate::parser::lesser_element::TableCell;
use crate::parser::object::minimal_set_object;
use crate::parser::parser_context::ContextElement;
use crate::parser::parser_context::ExitMatcherNode;
@ -113,6 +114,12 @@ pub fn org_mode_table_cell<'r, 's>(
exit_matcher: &org_mode_table_cell_end,
}));
let minimal_set_object_matcher = parser_with_context!(minimal_set_object)(&parser_context);
let exit_matcher = parser_with_context!(exit_matcher_parser)(&parser_context);
let (remaining, (children, _exit_contents)) = verify(
many_till(minimal_set_object_matcher, exit_matcher),
|(children, _exit_contents)| !children.is_empty(),
)(input)?;
todo!()
}