Expand description
Shared parser span conversion helpers.
Functions§
- opt_
span - Returns
None(skipping O(n) string scans) when position tracking is disabled, orSome(span)with real line/column data when enabled. - opt_
span_ range - Like
opt_spanbut takes a start/end range using exclusive end semantics. - opt_
span_ range_ inclusive - Like
opt_spanbut takes a start/end range using inclusive end semantics. - to_
parser_ span - Convert grammar span (LocatedSpan) to parser span (line/column)
- to_
parser_ span_ range - Convert grammar span range (start, end) to parser span
Convert a grammar span range where
endis the remainder span (i.e. the nomrestafter a match). This sets the end position to theend.location_offset()(start of the remainder), matching inline parser usage patterns liketo_parser_span_range(start, rest). - to_
parser_ span_ range_ inclusive - Convert a grammar span range where
endis the final fragment of the matched range (i.e. inclusive). This preserves the previous block-level semantics where callers pass the last fragment and expect the end to be atend.location_offset() + end.fragment().len().
Type Aliases§
- Grammar
Span - Grammar span type (nom_locate::LocatedSpan)