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
StringContexttype - context_
parser 🔒 - A
ContextParserthat attaches context messages to a parser. - layer 🔒
- A single
Layerof aParseStackerror. - layer_
parser 🔒 - The
LayerParser, which is used to mark beginnings of a new layer. - parse_
stack 🔒 - The
ParseStackerror type. - render 🔒
- Rendering logic for
ParseStackerrors.
Structs§
- Context
Parser - A parser that attaches context to the
ParseStackin case of an error. - Layer
Parser - The parser returned by
LayerExt::layer - Parse
Stack - A custom nested and span-aware parser error.
Traits§
- Context
Ext - The trait that adds context functions to all parsers over
Input. - Layer
Ext - Extension trait that adds a
LayerExt::layerfunction to all parsers