Switch to using a type for bracket depth.

This is to make changing the type easier in the future.
This commit is contained in:
Tom Alexander
2023-08-29 11:18:15 -04:00
parent 27a9b5aeb1
commit f29720e5b9
7 changed files with 34 additions and 26 deletions

View File

@@ -11,6 +11,7 @@ use nom::combinator::recognize;
use nom::combinator::verify;
use nom::multi::many_till;
use super::org_source::BracketDepth;
use super::org_source::OrgSource;
use super::Context;
use super::Object;
@@ -170,7 +171,7 @@ fn script_with_braces<'r, 's>(
}
fn script_with_braces_end(
starting_brace_depth: i16,
starting_brace_depth: BracketDepth,
) -> impl for<'r, 's> Fn(Context<'r, 's>, OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
move |context: Context, input: OrgSource<'_>| {
_script_with_braces_end(context, input, starting_brace_depth)
@@ -181,7 +182,7 @@ fn script_with_braces_end(
fn _script_with_braces_end<'r, 's>(
_context: Context<'r, 's>,
input: OrgSource<'s>,
starting_brace_depth: i16,
starting_brace_depth: BracketDepth,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let current_depth = input.get_brace_depth() - starting_brace_depth;
if current_depth > 0 {