TorchLean API

NN.Tensor.Internal.Syntax.Span

Source locations #

TorchLean.Tensor.Internal records source locations as half-open ranges measured in Unicode scalar values. A span stores a natural-number offset and length, so its endpoint cannot precede its start. The type does not certify bounds within a particular source string.

A half-open source range, measured in Unicode scalar values.

  • offset : Nat

    Number of Unicode scalar values preceding the range.

  • length : Nat

    Number of Unicode scalar values contained in the range.

Instances For

    The first offset after a source span.

    Instances For

      The empty span at offset.

      Instances For

        The half-open range from start to stop, empty at start when stop < start.

        Instances For

          The range from left.offset to right.stop.

          This is the smallest containing span when left.offset ≤ right.offset and left.stop ≤ right.stop, as for the ordered delimiters supplied by the parsers.

          Instances For
            @[simp]
            theorem TorchLean.Tensor.Internal.Syntax.Span.stop_mk (offset length : Nat) :
            { offset := offset, length := length }.stop = offset + length

            The endpoint of an explicitly constructed span is offset plus length.

            @[simp]

            A point span ends at its starting offset.

            The start of a span never lies after its endpoint.

            A value together with its location in source text.

            • value : α

              Parsed value.

            • span : Span

              Source range from which the value was parsed.

            Instances For
              @[instance_reducible]
              Instances For
                def TorchLean.Tensor.Internal.Syntax.instDecidableEqLocated.decEq {α✝ : Type u_1} [DecidableEq α✝] (x✝ x✝¹ : Located α✝) :
                Decidable (x✝ = x✝¹)
                Instances For
                  @[instance_reducible]