diff --git a/Sources/Parsing/ParserPrinters/PrefixThrough.swift b/Sources/Parsing/ParserPrinters/PrefixThrough.swift index 5c08341b5a..d7db24f823 100644 --- a/Sources/Parsing/ParserPrinters/PrefixThrough.swift +++ b/Sources/Parsing/ParserPrinters/PrefixThrough.swift @@ -32,12 +32,11 @@ public struct PrefixThrough: Parser where Input.SubSequence = let original = input while let index = input.firstIndex(where: { self.areEquivalent(first, $0) }) { input = input[index...] - if input.count >= count, - zip(input[index...], self.possibleMatch).allSatisfy(self.areEquivalent) + if let matchEndIndex = input.index(index, offsetBy: count, limitedBy: input.endIndex), + zip(input[..: Parser where Input.SubSequence == I let original = input while let index = input.firstIndex(where: { self.areEquivalent(first, $0) }) { input = input[index...] - if input.count >= count, - zip(input[index...], self.possibleMatch).allSatisfy(self.areEquivalent) + if let matchEndIndex = input.index(index, offsetBy: count, limitedBy: input.endIndex), + zip(input[..