Convert all functions to using the wrapped input type.
This commit is contained in:
@@ -7,6 +7,7 @@ use nom::combinator::eof;
|
||||
use nom::combinator::peek;
|
||||
use nom::combinator::recognize;
|
||||
|
||||
use super::org_source::OrgSource;
|
||||
use super::Context;
|
||||
use crate::error::Res;
|
||||
use crate::parser::object::Entity;
|
||||
@@ -14,7 +15,10 @@ use crate::parser::parser_with_context::parser_with_context;
|
||||
use crate::parser::util::get_consumed;
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
pub fn entity<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Entity<'s>> {
|
||||
pub fn entity<'r, 's>(
|
||||
context: Context<'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, Entity<'s>> {
|
||||
let (remaining, _) = tag("\\")(input)?;
|
||||
let (remaining, entity_name) = name(context, remaining)?;
|
||||
let (remaining, _) = alt((
|
||||
@@ -27,14 +31,17 @@ pub fn entity<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str,
|
||||
Ok((
|
||||
remaining,
|
||||
Entity {
|
||||
source,
|
||||
entity_name,
|
||||
source: source.into(),
|
||||
entity_name: entity_name.into(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn name<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
|
||||
fn name<'r, 's>(
|
||||
context: Context<'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
// TODO: This should be defined by org-entities and optionally org-entities-user
|
||||
|
||||
// TODO: Add the rest of the entities, this is a very incomplete list
|
||||
@@ -43,7 +50,7 @@ fn name<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s st
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn entity_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, ()> {
|
||||
fn entity_end<'r, 's>(context: Context<'r, 's>, input: OrgSource<'s>) -> Res<OrgSource<'s>, ()> {
|
||||
let (remaining, _) = alt((eof, recognize(satisfy(|c| !c.is_alphabetic()))))(input)?;
|
||||
|
||||
Ok((remaining, ()))
|
||||
|
||||
Reference in New Issue
Block a user