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

@@ -23,7 +23,7 @@ use crate::parser::LatexFragment;
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn latex_fragment<'r, 's>(
context: Context<'r, 's>,
context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, LatexFragment<'s>> {
let (remaining, _) = alt((
@@ -47,7 +47,7 @@ pub fn latex_fragment<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn raw_latex_fragment<'r, 's>(
context: Context<'r, 's>,
context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let (remaining, _) = tag("\\")(input)?;
@@ -60,7 +60,7 @@ fn raw_latex_fragment<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn name<'r, 's>(
_context: Context<'r, 's>,
_context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
alpha1(input)
@@ -68,7 +68,7 @@ fn name<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn brackets<'r, 's>(
context: Context<'r, 's>,
context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let (remaining, body) = alt((
@@ -100,7 +100,7 @@ fn brackets<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn escaped_parenthesis_fragment<'r, 's>(
context: Context<'r, 's>,
context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let (remaining, _) = tag("\\(")(input)?;
@@ -119,7 +119,7 @@ fn escaped_parenthesis_fragment<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn escaped_bracket_fragment<'r, 's>(
context: Context<'r, 's>,
context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let (remaining, _) = tag("\\[")(input)?;
@@ -138,7 +138,7 @@ fn escaped_bracket_fragment<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn double_dollar_fragment<'r, 's>(
context: Context<'r, 's>,
context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
// TODO: The documentation on the dollar sign versions is incomplete. Test to figure out what the real requirements are. For example, can this span more than 3 lines and can this contain a single $ since its terminated by $$?
@@ -158,7 +158,7 @@ fn double_dollar_fragment<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn dollar_char_fragment<'r, 's>(
context: Context<'r, 's>,
context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let (_, _) = pre(context, input)?;
@@ -172,7 +172,7 @@ fn dollar_char_fragment<'r, 's>(
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn pre<'r, 's>(_context: Context<'r, 's>, input: OrgSource<'s>) -> Res<OrgSource<'s>, ()> {
pub fn pre<'r, 's>(_context: RefContext<'r, 's>, input: OrgSource<'s>) -> Res<OrgSource<'s>, ()> {
let preceding_character = input.get_preceding_character();
if let Some('$') = preceding_character {
return Err(nom::Err::Error(CustomError::MyError(MyError(
@@ -183,7 +183,7 @@ pub fn pre<'r, 's>(_context: Context<'r, 's>, input: OrgSource<'s>) -> Res<OrgSo
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn post<'r, 's>(_context: Context<'r, 's>, input: OrgSource<'s>) -> Res<OrgSource<'s>, ()> {
pub fn post<'r, 's>(_context: RefContext<'r, 's>, input: OrgSource<'s>) -> Res<OrgSource<'s>, ()> {
// TODO: What about eof? Test to find out.
// TODO: Figure out which punctuation characters should be included.
@@ -193,7 +193,7 @@ pub fn post<'r, 's>(_context: Context<'r, 's>, input: OrgSource<'s>) -> Res<OrgS
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn bordered_dollar_fragment<'r, 's>(
context: Context<'r, 's>,
context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let (_, _) = pre(context, input)?;
@@ -219,7 +219,7 @@ fn bordered_dollar_fragment<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn open_border<'r, 's>(
_context: Context<'r, 's>,
_context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
recognize(verify(none_of(".,;$"), |c| !c.is_whitespace()))(input)
@@ -227,7 +227,7 @@ pub fn open_border<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn close_border<'r, 's>(
_context: Context<'r, 's>,
_context: RefContext<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, ()> {
let preceding_character = input.get_preceding_character();