Expand description
Error management
Parsers are generic over their error type, requiring that it implements
the error::ParseError<Input>
trait.
Structs
default error type, only contains the error’ location and code
VerboseError
alloc
This error type accumulates errors and their position when backtracking
through a parse tree. With some post processing (cf
examples/json.rs
),
it can be used to display user friendly error messagesEnums
Indicates which parser returned an error
VerboseErrorKind
alloc
Error context for
VerboseError
Traits
This trait is required by the
context
combinator to add a static string
to an existing errorThis trait is required by the
map_res
combinator to integrate
error types from external functions, like std::str::FromStrThis trait must be implemented by the error type of a nom parser.
Functions
Combines an existing error with a new one created from the input
position and an ErrorKind. This is useful when backtracking
through a parse tree, accumulating error context on the way
Create a new error from an input position, a static string and an existing error.
This is used mainly in the context combinator, to add user friendly information
to errors when backtracking through a parse tree
convert_error
alloc
Transforms a
VerboseError
into a trace with input position informationdbg_dmp
std
Prints a message and the input if the parser fails.
Converts an ErrorKind to a number
Creates an error from the input position and an ErrorKind