@@ -175,7 +175,8 @@ string_ suspended f s0 = T.Parser $ \t pos more lose succ ->
175175 | T.null ft -> suspended s s t pos more lose succ
176176 | otherwise -> lose t pos more [] "string"
177177 Just (pfx,ssfx,tsfx)
178− | T.null ssfx -> succ t (pos + Pos (T.lengthWord16 pfx)) more pfx
178+ | T.null ssfx -> let l = Pos (T.lengthWord16 pfx)
179+ in succ t (pos + l) more (substring pos l t)
179180 | not (T.null tsfx) -> lose t pos more [] "string"
180181 | otherwise -> suspended s ssfx t pos more lose succ
181182{-# INLINE string_ #-}
@@ -220,16 +221,8 @@ stringCI s = go 0
220221
221222-- | Satisfy a literal string, ignoring case for characters in the ASCII range.
222223asciiCI :: Text -> Parser Text
223−asciiCI input = do
224− (k,t) <- ensure n
225− if asciiToLower t == s
226− then advance k >> return t
227− else fail "asciiCI"
224+asciiCI s = string_ (stringSuspended asciiToLower) asciiToLower s
228225 where
229− n = T.length input
230− s = asciiToLower input
231−
232− -- convert letters in the ASCII range to lower-case
233226 asciiToLower = T.map f
234227 where
235228 offset = ord 'a' - ord 'A'