Implement key parser and begin key_suffix parser.

This commit is contained in:
Tom Alexander
2023-07-20 01:13:49 -04:00
parent d5c611674e
commit 339ff5cd26
2 changed files with 73 additions and 1 deletions

View File

@@ -147,12 +147,27 @@ pub enum ContextElement<'r, 's> {
/// The definition inside a footnote reference must have balanced
/// brackets [] inside the definition, so this stores the amount
/// of opening brackets subtracted by the amount of closing
/// brackets within the definition.
/// brackets within the definition must equal zero.
///
/// A reference to the position in the string is also included so
/// unbalanced brackets can be detected in the middle of an
/// object.
FootnoteReferenceDefinition(FootnoteReferenceDefinition<'s>),
/// Stores the current bracket depth inside a citation.
///
/// The global prefix, global suffix, key prefix, and key suffix
/// inside a footnote reference must have balanced brackets []
/// inside the definition, so this stores the amount of opening
/// brackets subtracted by the amount of closing brackets within
/// the definition must equal zero. None of the prefixes or
/// suffixes can be nested inside each other so we can use a
/// single type for this without conflict.
///
/// A reference to the position in the string is also included so
/// unbalanced brackets can be detected in the middle of an
/// object.
CitationBracket(CitationBracket<'s>),
}
pub struct ExitMatcherNode<'r> {
@@ -166,6 +181,12 @@ pub struct FootnoteReferenceDefinition<'s> {
pub depth: usize,
}
#[derive(Debug)]
pub struct CitationBracket<'s> {
pub position: &'s str,
pub depth: usize,
}
impl<'r> std::fmt::Debug for ExitMatcherNode<'r> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("ExitMatcherNode");