Documentation

ParseIt.Input

Parser inputs #

Iterators for common parser inputs, with HasPos instances for error reporting:

Iterator over the characters of a String.Slice.

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

    Positions are byte offsets into the slice.

    Equations
    @[inline]

    Iterator over the characters of s.

    Equations
    Instances For
      @[inline]

      The remaining characters as a slice.

      Equations
      Instances For

        Iterator over the bytes of a ByteArray.

        • data : ByteArray

          The bytes being iterated over.

        • pos : Nat

          The current index in data.

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

          Positions are byte indices.

          Equations
          @[inline]

          Iterator over the bytes of data.

          Equations
          Instances For

            Iterator over the bits of a BitVec, least significant bit first.

            • width : Nat

              The width of bits.

            • bits : BitVec self.width

              The bits being iterated over.

            • pos : Nat

              The index of the current bit.

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

              Positions are bit indices.

              Equations
              @[inline]

              Iterator over the bits of bits, least significant bit first.

              Equations
              Instances For
                @[instance_reducible]

                Positions are array indices.

                Equations

                Running parsers #

                def ParseIt.captureSlice {ε α : Type} {m : Type → Type} [Monad m] (p : ParserT ε CharIterator Char m α) :

                captureSlice p parses p and returns its result together with the slice of input that p consumed. The slice is a view into the input; no characters are copied.

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

                  Run p on the characters of s.

                  Equations
                  Instances For
                    @[inline]
                    def ParseIt.Parser.parseString {ε α : Type} (p : Parser ε CharIterator Char α) (s : String) :
                    Except ε α

                    Run p on the characters of s.

                    Equations
                    Instances For
                      @[inline]
                      def ParseIt.Parser.parseByteArray {ε α : Type} (p : Parser ε ByteIterator UInt8 α) (data : ByteArray) :
                      Except ε α

                      Run p on the bytes of data.

                      Equations
                      Instances For
                        @[inline]
                        def ParseIt.Parser.parseBitVec {ε α : Type} {w : Nat} (p : Parser ε BitIterator Bool α) (bits : BitVec w) :
                        Except ε α

                        Run p on the bits of bits, least significant bit first.

                        Equations
                        Instances For
                          @[inline]
                          def ParseIt.Parser.parseArray {ε τ α : Type} (p : Parser ε (Std.Iterators.Types.ArrayIterator τ) τ α) (xs : Array τ) :
                          Except ε α

                          Run p on the elements of xs.

                          Equations
                          Instances For
                            @[inline]
                            def ParseIt.Parser.parseVector {ε τ α : Type} {n : Nat} (p : Parser ε (Std.Iterators.Types.ArrayIterator τ) τ α) (xs : Vector τ n) :
                            Except ε α

                            Run p on the elements of xs. Vectors use the array iterator.

                            Equations
                            Instances For
                              @[inline]
                              def ParseIt.Parser.parseList {ε τ α : Type} (p : Parser ε (Std.Iterators.Types.ListIterator τ) τ α) (xs : List τ) :
                              Except ε α

                              Run p on the elements of xs. Lists have no HasPos instance.

                              Equations
                              Instances For