diff --git a/src/parser/org_source.rs b/src/parser/org_source.rs
index 8afd74b..c0e70f4 100644
--- a/src/parser/org_source.rs
+++ b/src/parser/org_source.rs
@@ -1,10 +1,14 @@
use std::ops::RangeBounds;
use nom::Compare;
+use nom::InputIter;
+use nom::InputLength;
use nom::InputTake;
+use nom::InputTakeAtPosition;
+use nom::Offset;
use nom::Slice;
-#[derive(Debug)]
+#[derive(Debug, Copy, Clone)]
pub struct OrgSource<'s> {
full_source: &'s str,
start: usize,
@@ -107,6 +111,91 @@ impl<'s> std::fmt::Display for OrgSource<'s> {
}
}
+impl<'s> InputLength for OrgSource<'s> {
+ fn input_len(&self) -> usize {
+ todo!()
+ }
+}
+
+impl<'s> InputIter for OrgSource<'s> {
+ type Item = <&'s str as InputIter>::Item;
+
+ type Iter = <&'s str as InputIter>::Iter;
+
+ type IterElem = <&'s str as InputIter>::IterElem;
+
+ fn iter_indices(&self) -> Self::Iter {
+ todo!()
+ }
+
+ fn iter_elements(&self) -> Self::IterElem {
+ todo!()
+ }
+
+ fn position
(&self, predicate: P) -> Option
+ where
+ P: Fn(Self::Item) -> bool,
+ {
+ todo!()
+ }
+
+ fn slice_index(&self, count: usize) -> Result {
+ todo!()
+ }
+}
+
+impl<'s> Offset for OrgSource<'s> {
+ fn offset(&self, second: &Self) -> usize {
+ todo!()
+ }
+}
+
+impl<'s> InputTakeAtPosition for OrgSource<'s> {
+ type Item = <&'s str as InputTakeAtPosition>::Item;
+
+ fn split_at_position>(
+ &self,
+ predicate: P,
+ ) -> nom::IResult
+ where
+ P: Fn(Self::Item) -> bool,
+ {
+ todo!()
+ }
+
+ fn split_at_position1>(
+ &self,
+ predicate: P,
+ e: nom::error::ErrorKind,
+ ) -> nom::IResult
+ where
+ P: Fn(Self::Item) -> bool,
+ {
+ todo!()
+ }
+
+ fn split_at_position_complete>(
+ &self,
+ predicate: P,
+ ) -> nom::IResult
+ where
+ P: Fn(Self::Item) -> bool,
+ {
+ todo!()
+ }
+
+ fn split_at_position1_complete>(
+ &self,
+ predicate: P,
+ e: nom::error::ErrorKind,
+ ) -> nom::IResult
+ where
+ P: Fn(Self::Item) -> bool,
+ {
+ todo!()
+ }
+}
+
#[cfg(test)]
mod tests {
use super::*;
diff --git a/src/parser/util.rs b/src/parser/util.rs
index 47a64d4..b858a77 100644
--- a/src/parser/util.rs
+++ b/src/parser/util.rs
@@ -14,6 +14,7 @@ use nom::multi::many0;
use nom::multi::many_till;
use nom::sequence::tuple;
+use super::org_source::OrgSource;
use super::parser_context::ContextElement;
use super::Context;
use crate::error::CustomError;
@@ -113,6 +114,15 @@ pub fn blank_line(input: &str) -> Res<&str, &str> {
recognize(tuple((space0, alt((line_ending, eof)))))(input)
}
+/// A line containing only whitespace and then a line break
+///
+/// It is up to the caller to ensure this is called at the start of a line.
+#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
+pub fn new_blank_line<'s>(input: OrgSource<'s>) -> Res, OrgSource<'s>> {
+ not(eof)(input)?;
+ recognize(tuple((space0, alt((line_ending, eof)))))(input)
+}
+
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn element_trailing_whitespace<'r, 's>(
context: Context<'r, 's>,