lean2js

Lean2Js.Text

source

Imports 1

Decimal numerals and JS / JSON string escaping, for the printers #

The text primitives the printers reach for: decimal numerals and JS / JSON string escaping.

Both are written as recursions over List Char rather than over String, and neither goes through toString. The generated file has to be something a proof can unfold, and Nat.repr and String.foldl are both walls to a proof that wants to read the characters back.

def

Lean2Js.digitChar

source
(d : Nat) :
Equations
Instances For
    Used by
      def

      Lean2Js.natDigits

      source
      @[irreducible]
      (n : Nat) :

      The decimal digits, most significant first.

      Equations
      Instances For
        Used by
          def

          Lean2Js.renderNat

          source
          (n : Nat) :
          Equations
          Instances For
            Used by
              def

              Lean2Js.renderInt

              source
              :
              Equations
              Instances For
                Used by
                  def

                  Lean2Js.hexDigit

                  source
                  (d : Nat) :
                  Equations
                  Instances For
                    Used by
                      def

                      Lean2Js.hex4

                      source
                      (n : Nat) :
                      Equations
                      Instances For
                        Used by
                          def

                          Lean2Js.escapeChar

                          source
                          (c : Char) :

                          JSON string escaping. It works as is for JS string literals too. U+2028 / U+2029 are not passed through because, legal as they are in JSON, placing them directly in JS source can have them read as line terminators.

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

                              Lean2Js.escapeChars

                              source
                              Equations
                              Instances For
                                Used by
                                  def

                                  Lean2Js.escapeString

                                  source
                                  (s : String) :
                                  Equations
                                  Instances For
                                    Used by