Documentation

Common.Position

@[unbox]
structure Cursor :

A position, expressed as a pair of numbers of UTF-8 codepoints (rather than byte indices).

Instances For
    @[implicit_reducible]
    Equations
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      def instDecidableEqCursor.decEq (x✝ x✝¹ : Cursor) :
      Decidable (x✝ = x✝¹)
      Equations
      Instances For
        Equations
        Instances For
          @[implicit_reducible]
          Equations
          Equations
          Instances For
            @[implicit_reducible]
            Equations
            @[implicit_reducible]
            Equations
            @[implicit_reducible]
            Equations
            def Cursor.lt (c₁ c₂ : Cursor) :
            Equations
            Instances For
              def Cursor.le (c₁ c₂ : Cursor) :
              Equations
              • c₁.le c₂ = (c₁.lt c₂ c₁ = c₂)
              Instances For
                @[implicit_reducible]
                Equations
                @[implicit_reducible]
                Equations
                @[implicit_reducible]
                instance instDecidableLtCursor (c₁ c₂ : Cursor) :
                Decidable (c₁ < c₂)
                Equations
                @[implicit_reducible]
                instance instDecidableEqCursor_1 (c₁ c₂ : Cursor) :
                Decidable (c₁ = c₂)
                Equations
                @[implicit_reducible]
                instance instDecidableLeCursor (c₁ c₂ : Cursor) :
                Decidable (c₁ c₂)
                Equations
                @[implicit_reducible]
                instance instDecidableGtCursor (c₁ c₂ : Cursor) :
                Decidable (c₁ > c₂)
                Equations
                @[implicit_reducible]
                Equations
                @[implicit_reducible]
                Equations
                structure SourceSpan :
                Instances For
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    @[implicit_reducible]
                    Equations
                    def instDecidableEqSourceSpan.decEq (x✝ x✝¹ : SourceSpan) :
                    Decidable (x✝ = x✝¹)
                    Equations
                    Instances For
                      @[implicit_reducible]
                      Equations
                      Equations
                      Instances For
                        Equations
                        Instances For
                          @[implicit_reducible]
                          Equations
                          @[implicit_reducible]
                          Equations
                          Equations
                          Instances For

                            A placeholder position for diagnostics with no real one to report against. Not default/(0 : SourceSpan) — both are ⟨⟨0,0⟩,⟨0,0⟩⟩, but every real position in this codebase has 1-indexed lines (lexing starts at ⟨1,0⟩), so line 0 would render a wrong, off-by-one line number. Line 1 points at a real line even though the span itself stays meaningless.

                            Equations
                            Instances For
                              @[implicit_reducible]
                              Equations
                              @[reducible, never_extract, inline, implemented_by _private.Common.Position.0.Internal.registerSourceImpl]
                              abbrev registerSource {α : Type} (x : α) :
                              SourceSpanα
                              Equations
                              Instances For
                                @[reducible, never_extract, inline, implemented_by _private.Common.Position.0.Internal.posOfImpl]
                                abbrev posOf {α : Type} (x : α) :
                                Equations
                                Instances For

                                  Internal.sourceMap has no clear operation: it grows for the life of the process. This is sound for concurrent compiles as much as sequential ones. No two live values share an address, and posOf requires holding the value to read its position — so whatever holds it is, by definition, not dead, and its slot cannot have been reused by anything else in the meantime.

                                  Values that were never registered are a separate matter this map cannot fix by itself: nullary constructors (Expression.true, Statement.skip) share one tagged-scalar address program-wide and so cannot carry per-occurrence positions this way, and some compiled-in constants have no source span to register at all. Annotation's constructors carry an explicit pos : SourceSpan field instead of using registerSource/posOf, for exactly this reason.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For

                                    Match arbitrary expressions, together with the positions attached to them. If some expressions may not be attached positions (e.g. proofs), one can specify (indices := [n₁ ... nₙ]) to only match on the positions of the nᵢ-th discriminant (1-based indexing).

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For