Switch to using a type for bracket depth.
This is to make changing the type easier in the future.
This commit is contained in:
@@ -10,6 +10,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 crate::error::CustomError;
|
||||
@@ -91,7 +92,7 @@ fn header<'r, 's>(
|
||||
}
|
||||
|
||||
fn header_end(
|
||||
starting_bracket_depth: i16,
|
||||
starting_bracket_depth: BracketDepth,
|
||||
) -> impl for<'r, 's> Fn(Context<'r, 's>, OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
move |context: Context, input: OrgSource<'_>| {
|
||||
_header_end(context, input, starting_bracket_depth)
|
||||
@@ -102,7 +103,7 @@ fn header_end(
|
||||
fn _header_end<'r, 's>(
|
||||
_context: Context<'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
starting_bracket_depth: i16,
|
||||
starting_bracket_depth: BracketDepth,
|
||||
) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
let current_depth = input.get_bracket_depth() - starting_bracket_depth;
|
||||
if current_depth > 0 {
|
||||
@@ -141,7 +142,7 @@ fn argument<'r, 's>(
|
||||
}
|
||||
|
||||
fn argument_end(
|
||||
starting_parenthesis_depth: i16,
|
||||
starting_parenthesis_depth: BracketDepth,
|
||||
) -> impl for<'r, 's> Fn(Context<'r, 's>, OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
move |context: Context, input: OrgSource<'_>| {
|
||||
_argument_end(context, input, starting_parenthesis_depth)
|
||||
@@ -152,7 +153,7 @@ fn argument_end(
|
||||
fn _argument_end<'r, 's>(
|
||||
_context: Context<'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
starting_parenthesis_depth: i16,
|
||||
starting_parenthesis_depth: BracketDepth,
|
||||
) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
let current_depth = input.get_parenthesis_depth() - starting_parenthesis_depth;
|
||||
if current_depth > 0 {
|
||||
|
||||
Reference in New Issue
Block a user