A Span is a section of the SourceInput. It is determined by a start position and an end position.

REPRESENTATION INVARIANT: (not verified)

  • both start and end positions belongs to the same SourceReader
  • start position appears before end position, if both of them are not Unkwnown.

API

  • A Span represents a span of a SourceInput. Either both start and end are known, or both are unknown. If end is unknown but not the start, they are made equal (the span is a single position). If start is unknown but not the end, the end is considered an incorrect value, and made unknown.

    Parameters

    • Optional start: SourcePosition
    • Optional end: SourcePosition

    Returns Span

end: SourcePosition = SourceReader.UnknownPosition

The end position of the span.

start: SourcePosition = SourceReader.UnknownPosition

The start position of the span.