Trait nom_supreme::final_parser::RecreateContext [−][src]
pub trait RecreateContext<I>: Sized {
fn recreate_context(original_input: I, tail: I) -> Self;
}
Expand description
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
fn recreate_context(original_input: I, tail: I) -> Self
fn recreate_context(original_input: I, tail: I) -> Self
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.