[][src]Trait nom_supreme::final_parser::RecreateContext

pub trait RecreateContext<I>: Sized {
    pub fn recreate_context(original_input: I, tail: I) -> Self;
}

Trait for types which represent an absolute location of a parse error in an input

This trait is implemented for "full location context" types; that is, for types that capture the exact location (and possibly other related context) of a parse error for the purpose of reporting. Two such types are provided by nom-supreme: Location, which captures the line and column number of the error, and ByteOffset, which captures the byte offset of the error.

This trait is usually paired with ExtractContext, a trait used by nom error types to convert the stored input tail types into location contexts. ExtractContext is in turn used by final_parser to create & return parse errors with the full attached context.

Required methods

pub fn recreate_context(original_input: I, tail: I) -> Self[src]

Given the original input, as well as the context reported by nom, recreate a context in the original string where the error occurred.

This function may return garbage or panic if the tail is not associated with the original input.

Loading content...

Implementors

impl<'_> RecreateContext<&'_ str> for Location[src]

impl<I> RecreateContext<I> for I[src]

impl<I: Offset> RecreateContext<I> for ByteOffset[src]

Loading content...