Documentation

Init.Data.String.Pattern.Basic

A step taken during the traversal of a Slice by a forward or backward searcher.

  • rejected {s : Slice} (startPos endPos : s.Pos) : SearchStep s

    The subslice starting at startPos and ending at endPos did not match the pattern.

  • matched {s : Slice} (startPos endPos : s.Pos) : SearchStep s

    The subslice starting at startPos and ending at endPos did not match the pattern.

Instances For

    Provides a conversion from a pattern to an iterator of SearchStep that searches for matches of the pattern from the start towards the end of a Slice.

    • toSearcher (s : Slice) (pat : ρ) : Std.Iter (SearchStep s)

      Builds an iterator of SearchStep corresponding to matches of pat along the slice s. The SearchSteps returned by this iterator must contain ranges that are adjacent, non-overlapping and cover all of s.

    Instances

      Provides simple pattern matching capabilities from the start of a Slice.

      While these operations can be implemented on top of ToForwardSearcher some patterns allow for more efficient implementations. This class can be used to specialize for them. If there is no need to specialize in this fashion, then ForwardPattern.defaultImplementation can be used to automatically derive an instance.

      • startsWith : SliceρBool

        Checks whether the slice starts with the pattern.

      • dropPrefix? (s : Slice) : ρOption s.Pos

        Checks whether the slice starts with the pattern. If it does, the slice is returned with the prefix removed; otherwise the result is none.

      Instances
        @[extern lean_slice_memcmp]
        def String.Slice.Pattern.Internal.memcmp (lhs rhs : Slice) (lstart rstart len : Pos.Raw) (h1 : len.offsetBy lstart lhs.rawEndPos) (h2 : len.offsetBy rstart rhs.rawEndPos) :
        Equations
        Instances For
          @[inline]

          Tries to skip the searcher until the next SearchStep.matched and return it. If no match is found until the end returns none.

          Equations
          Instances For
            @[inline]

            Tries to skip the searcher until the next SearchStep.rejected and return it. If no reject is found until the end returns none.

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

                    Provides a conversion from a pattern to an iterator of SearchStep searching for matches of the pattern from the end towards the start of a Slice.

                    • toSearcher (s : Slice) (pat : ρ) : Std.Iter (SearchStep s)

                      Build an iterator of SearchStep corresponding to matches of pat along the slice s. The SearchSteps returned by this iterator must contain ranges that are adjacent, non-overlapping and cover all of s.

                    Instances

                      Provides simple pattern matching capabilities from the end of a Slice.

                      While these operations can be implemented on top of ToBackwardSearcher, some patterns allow for more efficient implementations. This class can be used to specialize for them. If there is no need to specialize in this fashion, then BackwardPattern.defaultImplementation can be used to automatically derive an instance.

                      • endsWith : SliceρBool

                        Checks whether the slice ends with the pattern.

                      • dropSuffix? (s : Slice) : ρOption s.Pos

                        Checks whether the slice ends with the pattern. If it does, the slice is returned with the suffix removed; otherwise the result is none.

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