Module knuffel::span

source ·
Expand description

Knuffel supports to kinds of the span for parsing

  1. Span which only tracks byte offset from the start of the source code
  2. LineSpan which also track line numbers

This distinction is important during parsing stage as Span is normally faster. And LineSpan is still faster than find out line/column number for each span separately, and is also more convenient if you need this information.

On the other hand, on the decode stage you can convert your span types into more elaborate thing that includes file name or can refer to the defaults as a separate kind of span. See traits::DecodeSpan.

Structs

  • Reexport of miette::SourceSpan trait that we use for parsing Span within a SourceCode with an associated message.
  • Line and column position of the datum in the source code
  • Span with line and column number
  • Normal byte offset span
  • Wraps the structure to keep source code span, but also dereference to T