[][src]Trait nom_supreme::final_parser::ExtractContext

pub trait ExtractContext<I, T> {
    pub fn extract_context(self, original_input: I) -> T;
}

Trait for recombining error information with the original input.

This trait is used to take the context information attached to nom errors- specifically, the tail of the input indicating the location of the input- and recombine it with the original input to produce an error with something more useful for error reporting.

Typically, it looks like ExtractContext<I, E<T>> for E<I>. This indicates that some error type E, which is generic over the input type, can be converted into another variant of that error, using T instead of I to hold the result context. Often this context conversion can happen with RecreateContext.

Required methods

pub fn extract_context(self, original_input: I) -> T[src]

Given the context attached to a nom error, and given the original input to the nom parser, extract more the useful context information.

For example, for a string, 1 possible context extraction would be the Location (line and column number) in the original input where the error indicated by self occurred.

Loading content...

Implementations on Foreign Types

impl<I, T> ExtractContext<I, (T, ErrorKind)> for (I, ErrorKind) where
    T: RecreateContext<I>, 
[src]

impl<I, T> ExtractContext<I, Error<T>> for Error<I> where
    T: RecreateContext<I>, 
[src]

impl<I, T> ExtractContext<I, VerboseError<T>> for VerboseError<I> where
    T: RecreateContext<I>,
    I: Clone
[src]

Loading content...

Implementors

impl<I, T> ExtractContext<I, ErrorTree<T>> for ErrorTree<I> where
    I: Clone,
    T: RecreateContext<I>, 
[src]

impl<I, T> ExtractContext<I, ()> for T[src]

Loading content...