Skip to main content

Module error

Module error 

Source
Expand description

This module provides a custom winnow error type that keeps track of nested context and spans.

ParseStack keeps a stack of nested layers (one per LayerParser) together with the span positions that were being parsed.

The error type requires the usage of winnow’s [LocatingSlice], which allows our errors to be span-aware.

LayerParsers are created by using the LayerExt trait.

Context messages are attached via the ContextExt functions.

Winnow’s Parser::context with StrContext is supported as well for backwards compatibility. Once migrated, this backwards compatibility will be phased out.

Modules§

context 🔒
The StringContext type
context_parser 🔒
A ContextParser that attaches context messages to a parser.
layer 🔒
A single Layer of a ParseStack error.
layer_parser 🔒
The LayerParser, which is used to mark beginnings of a new layer.
parse_stack 🔒
The ParseStack error type.
render 🔒
Rendering logic for ParseStack errors.

Structs§

ContextParser
A parser that attaches context to the ParseStack in case of an error.
LayerParser
The parser returned by LayerExt::layer
ParseStack
A custom nested and span-aware parser error.

Traits§

ContextExt
The trait that adds context functions to all parsers over Input.
LayerExt
Extension trait that adds a LayerExt::layer function to all parsers

Type Aliases§

Input
A convenience type alias around LocatingSlice.
PResult
Return type alias for parsers that uses the ParseStack error type.