Implement parser for subscript/superscript with braces.
This commit is contained in:
@@ -194,6 +194,18 @@ pub enum ContextElement<'r, 's> {
|
||||
/// unbalanced brackets can be detected in the middle of an
|
||||
/// object.
|
||||
InlineSourceBlockBracket(InlineSourceBlockBracket<'s>),
|
||||
|
||||
/// Stores the current bracket or parenthesis depth inside a
|
||||
/// superscript or superscript.
|
||||
///
|
||||
/// Inside the braces of a subscript or superscript there must be
|
||||
/// balanced braces {}, so this stores the amount of opening
|
||||
/// braces subtracted by the amount of closing braces within the
|
||||
/// definition must equal zero.
|
||||
///
|
||||
/// A reference to the position in the string is also included so
|
||||
/// unbalanced braces can be detected in the middle of an object.
|
||||
SubscriptSuperscriptBrace(SubscriptSuperscriptBrace<'s>),
|
||||
}
|
||||
|
||||
pub struct ExitMatcherNode<'r> {
|
||||
@@ -225,6 +237,12 @@ pub struct InlineSourceBlockBracket<'s> {
|
||||
pub depth: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SubscriptSuperscriptBrace<'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");
|
||||
|
||||
Reference in New Issue
Block a user