Skip to main content

Module utils

Module utils 

Source
Expand description

Utility types and helpers for lexing and parsing.

Contains common utilities including:

  • Generic array deque and type-level numbers (re-exported from hybrid-arraydeque)
  • Delimited and escaped sequence helpers
  • Display traits for human-readable, SDL, and syntax tree output
  • Positioned character iterators
  • Message and knowledge types for error reporting

Re-exports§

pub use Owned;
pub use Ref;
pub use hybrid_arraydeque as arraydeque;
pub use typenum;

Modules§

knowledge
Common knowledge types for lexing and parsing.

Structs§

ArrayDeque
Re-export of hybrid-arraydeque for direct access. A fixed-capacity, stack-allocated double-ended queue (deque) backed by Array.
CompactDisplay
A wrapper that implements Display for compact formatting.
CowStr
Feature-aware message container with a unified API.
Delimited
A value delimited by opening and closing markers with source location tracking.
EscapedLexeme
A generic escape sequence representation using a lexeme.
HumanDisplay
A wrapper that implements Display using DisplayHuman formatting.
Ignored
A marker type representing ignored values.
MultiCharEscape
A multi-character escape sequence representation.
OneOf
Feature-aware slice with a unified API.
PositionedChar
A character paired with its byte position in the source input.
PrettyDisplay
A wrapper that implements Display for pretty formatting.
SingleCharEscape
A single-character escape sequence representation.
SyntaxTreeDisplay
A helper struct for displaying in a SyntaxTree.
Trimmed
The trimmed-span form of a span-shaped marker, used as a type marker.

Enums§

Expected
An enumeration representing expected tokens or values in parsing contexts.
Lexeme
A compact, zero-copy description of a lexeme in source code.
Maybe
An enum that can hold either a reference or an owned value.

Traits§

CharLen
A trait for character-like types that can report their encoded length in bytes.
DisplayCompact
A trait for formatting values in a compact, space-efficient representation.
DisplayHuman
A trait for displaying values in a human-readable format.
DisplayPretty
A trait for formatting values in a human-friendly, readable representation.
DisplaySDL
A trait for displaying values with configurable formatting options.
DisplaySyntaxTree
A trait for displaying in a SyntaxTree style.
Downcast
A fallible owned projection to T.
DowncastRef
A fallible borrowed projection to T.
Equivalent
A trait for cross-type equivalence checking.
IntoComponents
Enables destructuring a parsed element into its constituent components.
IntoEquivalent
A trait for converting into an equivalent type.
IsAsciiChar
A trait for checking if a token is an ASCII character.
ToEquivalent
A trait for converting to an equivalent type.

Type Aliases§

MaybeMut
A type alias for a Maybe enum that holds either a mutable reference or an owned value.
MaybeRef
A type alias for a Maybe enum that holds either a reference or an owned value.
PhantomDelimited
A phantom delimited value with no meaningful delimiters, span, or data, used as a type marker.
PhantomLocated
A located value with no meaningful source or span, used as a type marker.
PhantomSliced
A sliced value with no meaningful slice, used as a type marker.
PhantomSpan
A span with no meaningful offsets, used as a type marker.