Fixing more errors.

This commit is contained in:
Tom Alexander
2023-09-03 00:27:50 -04:00
parent 15e8d1ab77
commit b54c6d366c
7 changed files with 118 additions and 72 deletions

View File

@@ -10,17 +10,23 @@ use nom::combinator::recognize;
use nom::combinator::verify;
use nom::multi::many_till;
use super::object_parser::standard_set_object;
use super::org_source::BracketDepth;
use super::org_source::OrgSource;
use super::util::exit_matcher_parser;
use super::util::maybe_consume_object_trailing_whitespace_if_not_exiting;
use super::Context;
use super::Object;
use crate::context::parser_with_context;
use crate::context::ContextElement;
use crate::context::ExitClass;
use crate::context::ExitMatcherNode;
use crate::context::RefContext;
use crate::error::CustomError;
use crate::error::MyError;
use crate::error::Res;
use crate::parser::util::get_consumed;
use crate::parser::Subscript;
use crate::parser::Superscript;
use crate::types::Object;
use crate::types::Subscript;
use crate::types::Superscript;
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn subscript<'r, 's>(
@@ -151,11 +157,11 @@ fn script_with_braces<'r, 's>(
) -> Res<OrgSource<'s>, Vec<Object<'s>>> {
let (remaining, _) = tag("{")(input)?;
let exit_with_depth = script_with_braces_end(remaining.get_brace_depth());
let parser_context =
context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode {
class: ExitClass::Gamma,
exit_matcher: &exit_with_depth,
}));
let parser_context = ContextElement::ExitMatcherNode(ExitMatcherNode {
class: ExitClass::Gamma,
exit_matcher: &exit_with_depth,
});
let parser_context = context.with_additional_node(&parser_context);
let (remaining, (children, _exit_contents)) = many_till(
parser_with_context!(standard_set_object)(&parser_context),
@@ -168,8 +174,9 @@ fn script_with_braces<'r, 's>(
fn script_with_braces_end(
starting_brace_depth: BracketDepth,
) -> impl for<'r, 's> Fn(Context<'r, 's>, OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
move |context: Context, input: OrgSource<'_>| {
) -> impl for<'b, 'r, 's> Fn(RefContext<'b, 'r, 's>, OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>>
{
move |context, input: OrgSource<'_>| {
_script_with_braces_end(context, input, starting_brace_depth)
}
}