Documentation

Lean.Data.Position

structure Lean.Position :
Instances For
    def Lean.instDecidableEqPosition.decEq (x✝ x✝¹ : Position) :
    Decidable (x✝ = x✝¹)
    Equations
      Instances For
        Equations
          Instances For
            Equations
              Instances For
                Equations
                  Instances For
                    structure Lean.FileMap :

                    Content of a file together with precalculated positions of newlines.

                    • source : String

                      The content of the file.

                    • positions : Array String.Pos.Raw

                      The positions of newline characters. The first entry is always 0 and the last always the index of the last character. In particular, if the last character is a newline, that index will appear twice.

                    Instances For
                      class Lean.MonadFileMap (m : TypeType) :
                      Instances

                        The last line should always be positions.size - 1.

                        Equations
                          Instances For
                            def Lean.FileMap.getLine (fmap : FileMap) (x : Nat) :

                            The line numbers associated with the positions of the FileMap. fmap.getLine i is the iᵗʰ entry of #[1, 2, …, n-1, n-1] where n is the size of positions.

                            Equations
                              Instances For
                                Equations
                                  Instances For
                                    Equations
                                      Instances For

                                        Convert a Lean.Position to a String.Pos.

                                        Equations
                                          Instances For

                                            Returns the position of the start of (1-based) line line. This gives the same result as map.ofPosition ⟨line, 0⟩, but is more efficient.

                                            Equations
                                              Instances For
                                                Equations
                                                  Instances For