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 an offset and a length, so malformed ranges cannot be represented.

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.

        Instances For

          The smallest span containing two spans that occur in source order.

          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
              Instances For
                @[instance_reducible]
                def TorchLean.Tensor.Internal.Syntax.instDecidableEqLocated.decEq {α✝ : Type u_1} [DecidableEq α✝] (x✝ x✝¹ : Located α✝) :
                Decidable (x✝ = x✝¹)
                Instances For
                  @[instance_reducible]
                  def TorchLean.Tensor.Internal.Syntax.Located.map {α : Type u} {β : Type v} (f : αβ) (value : Located α) :

                  Apply a function without changing a value's source location.

                  Instances For
                    @[simp]
                    theorem TorchLean.Tensor.Internal.Syntax.Located.map_value {α : Type u} {β : Type v} (f : αβ) (value : Located α) :
                    (map f value).value = f value.value

                    Mapping a located value applies the function to its payload.

                    @[simp]
                    theorem TorchLean.Tensor.Internal.Syntax.Located.map_span {α : Type u} {β : Type v} (f : αβ) (value : Located α) :
                    (map f value).span = value.span

                    Mapping a located value preserves its source span.