Crate kparse

source ·
Expand description

Addons for a nom parser.

  • A error code trait.

  • A richer error type ParserError.

  • A thin error type TokenizerError.

  • A tracking/logging system for the parser.

  • A simple framework to test parser functions.

  • Took some inspiration from nom_supreme and implemented a similar subset of postfix functions. They are integrated with the error Code and the error types of this crate.

  • SourceStr and SourceBytes to get context information around a Span. Can retrieve line/column information and context data without burdening every single span.

  • Uses LocatedSpan for debug builds and replaces with plan &str or &[u8] for release builds. Tracking is compiled away completely for release builds.




  • Defines a type alias for the span type. Switches between ParseSpan<> in debug mode and plain type in release mode.


  • Central struct for tracking.


  • Parser error code.
  • Analog function for err_into() working on a parser, but working on the Result instead.
  • This trait is used for Track.err() where the function wants to accept both E and nom::Err<E>.
  • This trait catches the essentials for an error type within this library.
  • Adds some common parser combinators as postfix operators to parser.
  • This is an extension trait for nom-Results.
  • This trait is implemented for an input type. It takes a tracking event and its raw data, converts if necessary and sends it to the actual tracker.

Type Aliases