Documentation

Std.Internal.Parsec.Basic

Represents an error that can occur during parsing.

  • eof : Error

    Indicates that the parser reached the end of the input unexpectedly.

  • other (s : String) : Error

    Represents any other kind of parsing error with an associated message.

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

      The result of parsing some string.

      • success {α ι : Type} (pos : ι) (res : α) : ParseResult α ι

        Parsing succeeded, returning the new position pos and the parsed result res.

      • error {α ι : Type} (pos : ι) (err : Error) : ParseResult α ι

        Parsing failed, returning the position pos where the error occurred and the error err.

      Instances For
        def Std.Internal.Parsec.instReprParseResult.repr {α✝ ι✝ : Type} [Repr α✝] [Repr ι✝] :
        ParseResult α✝ ι✝NatFormat
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          A Parsec ι α represents a parser that consumes input of type ι and, produces a ParseResult containing a value of type α (the result of parsing) and the remaining input.

          Equations
          Instances For
            class Std.Internal.Parsec.Input (ι : Type) (elem idx : outParam Type) [DecidableEq idx] [DecidableEq elem] :

            Interface for an input iterator with position tracking and lookahead support.

            • pos : ιidx
            • next : ιι
            • curr : ιelem
            • hasNext : ιBool
            • next' (it : ι) : hasNext it = trueι
            • curr' (it : ι) : hasNext it = trueelem
            Instances
              @[inline]
              def Std.Internal.Parsec.pure {α ι : Type} (a : α) :
              Parsec ι α
              Equations
              Instances For
                @[inline]
                def Std.Internal.Parsec.bind {ι α β : Type} (f : Parsec ι α) (g : αParsec ι β) :
                Parsec ι β
                Equations
                Instances For
                  @[inline]
                  def Std.Internal.Parsec.fail {α ι : Type} (msg : String) :
                  Parsec ι α

                  Parser that always fails with the given error message.

                  Equations
                  Instances For
                    @[inline]
                    def Std.Internal.Parsec.tryCatch {α ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] {β : Type} (p : Parsec ι α) (csuccess : αParsec ι β) (cerror : UnitParsec ι β) :
                    Parsec ι β

                    Try p, then decide what to do based on success or failure without consuming input on failure.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      @[always_inline]
                      Equations
                      • One or more equations did not get rendered due to their size.
                      @[inline]
                      def Std.Internal.Parsec.orElse {α ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] (p : Parsec ι α) (q : UnitParsec ι α) :
                      Parsec ι α

                      Try p, and if it fails without consuming input, run q () instead.

                      Equations
                      Instances For
                        @[inline]
                        def Std.Internal.Parsec.attempt {α ι : Type} (p : Parsec ι α) :
                        Parsec ι α

                        Attempt to parse with p, but don't consume input on failure.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          @[always_inline]
                          instance Std.Internal.Parsec.instAlternative {ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] :
                          Equations
                          • One or more equations did not get rendered due to their size.
                          @[inline]
                          def Std.Internal.Parsec.eof {ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] :

                          Succeeds only if input is at end-of-file.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            @[specialize #[]]
                            partial def Std.Internal.Parsec.manyCore {α ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] (p : Parsec ι α) (acc : Array α) :
                            Parsec ι (Array α)
                            @[inline]
                            def Std.Internal.Parsec.many {α ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] (p : Parsec ι α) :
                            Parsec ι (Array α)
                            Equations
                            Instances For
                              @[inline]
                              def Std.Internal.Parsec.many1 {α ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] (p : Parsec ι α) :
                              Parsec ι (Array α)
                              Equations
                              Instances For
                                @[inline]
                                def Std.Internal.Parsec.any {ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] :
                                Parsec ι elem

                                Gets the next input element.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  @[inline]
                                  def Std.Internal.Parsec.satisfy {ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] (p : elemBool) :
                                  Parsec ι elem

                                  Checks if the next input element matches some condition.

                                  Equations
                                  Instances For
                                    @[inline]

                                    Fails if p succeeds, otherwise succeeds without consuming input.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      @[inline]
                                      def Std.Internal.Parsec.peek? {ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] :
                                      Parsec ι (Option elem)

                                      Peeks at the next element, returns some if exists else none, does not consume input.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        @[inline]
                                        def Std.Internal.Parsec.peekWhen? {ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] (p : elemBool) :
                                        Parsec ι (Option elem)

                                        Peeks at the next element, returns some elem if it satisfies p, else none. Does not consume input.

                                        Equations
                                        Instances For
                                          @[inline]
                                          def Std.Internal.Parsec.peek! {ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] :
                                          Parsec ι elem

                                          Peeks at the next element, errors on EOF, does not consume input.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            @[inline]
                                            def Std.Internal.Parsec.peekD {ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] (default : elem) :
                                            Parsec ι elem

                                            Peeks at the next element or returns a default if at EOF, does not consume input.

                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For
                                              @[inline]
                                              def Std.Internal.Parsec.skip {ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] :

                                              Consumes one element if available, otherwise errors on EOF.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                @[specialize #[]]
                                                partial def Std.Internal.Parsec.manyCharsCore {ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] (p : Parsec ι Char) (acc : String) :

                                                Parses zero or more chars with p, accumulates into a string.

                                                @[inline]
                                                def Std.Internal.Parsec.manyChars {ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] (p : Parsec ι Char) :

                                                Parses zero or more chars with p into a string.

                                                Equations
                                                Instances For
                                                  @[inline]
                                                  def Std.Internal.Parsec.many1Chars {ι elem idx : Type} [DecidableEq idx] [DecidableEq elem] [Input ι elem idx] (p : Parsec ι Char) :

                                                  Parses one or more chars with p into a string, errors if none.

                                                  Equations
                                                  Instances For