Switch to RefContext.

This commit is contained in:
Tom Alexander
2023-09-02 19:16:44 -04:00
parent 12ad3b09f0
commit 564104f1e8
41 changed files with 200 additions and 200 deletions

View File

@@ -24,7 +24,7 @@ use crate::parser::Superscript;
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn subscript<'r, 's>(
context: Context<'r, 's>,
context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Subscript<'s>> {
// We check for the underscore first before checking the pre-character as a minor optimization to avoid walking up the context tree to find the document root unnecessarily.
@@ -44,7 +44,7 @@ pub fn subscript<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn superscript<'r, 's>(
context: Context<'r, 's>,
context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Superscript<'s>> {
// We check for the circumflex first before checking the pre-character as a minor optimization to avoid walking up the context tree to find the document root unnecessarily.
@@ -63,7 +63,7 @@ pub fn superscript<'r, 's>(
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn pre<'r, 's>(_context: Context<'r, 's>, input: OrgSource<'s>) -> Res<OrgSource<'s>, ()> {
fn pre<'r, 's>(_context: RefContext<'r, 's>, input: OrgSource<'s>) -> Res<OrgSource<'s>, ()> {
let preceding_character = input.get_preceding_character();
match preceding_character {
Some(c) if !c.is_whitespace() => {}
@@ -84,7 +84,7 @@ enum ScriptBody<'s> {
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn script_body<'r, 's>(
context: Context<'r, 's>,
context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, ScriptBody<'s>> {
alt((
@@ -102,7 +102,7 @@ fn script_body<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn script_asterisk<'r, 's>(
_context: Context<'r, 's>,
_context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
tag("*")(input)
@@ -110,7 +110,7 @@ fn script_asterisk<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn script_alphanum<'r, 's>(
context: Context<'r, 's>,
context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let (remaining, _sign) = opt(recognize(one_of("+-")))(input)?;
@@ -124,7 +124,7 @@ fn script_alphanum<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn script_alphanum_character<'r, 's>(
_context: Context<'r, 's>,
_context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
recognize(verify(anychar, |c| {
@@ -134,7 +134,7 @@ fn script_alphanum_character<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn end_script_alphanum_character<'r, 's>(
context: Context<'r, 's>,
context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let (remaining, final_char) = recognize(verify(anychar, |c| c.is_alphanumeric()))(input)?;
@@ -146,7 +146,7 @@ fn end_script_alphanum_character<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn script_with_braces<'r, 's>(
context: Context<'r, 's>,
context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Vec<Object<'s>>> {
let (remaining, _) = tag("{")(input)?;
@@ -176,7 +176,7 @@ fn script_with_braces_end(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn _script_with_braces_end<'r, 's>(
_context: Context<'r, 's>,
_context: RefContext<'r, 's>,
input: OrgSource<'s>,
starting_brace_depth: BracketDepth,
) -> Res<OrgSource<'s>, OrgSource<'s>> {