git.iko.soy/typeable/attoparsec
on master help sign in
Correctly case-fold the initial part of stringCI input (gh-99)
commit53b334bdb36da6df11169c4986adfa73fa74eff8 authorBryan O'Sullivan <bos@serpentine.com> dateSun 5 Apr 2015, 10:32 (12 years ago) parentfb90e79
1 file changed+5−4
Data/Attoparsec/ByteString/Internal.hs+5−4
Data/Attoparsec/ByteString/Internal.hs+5−4
@@ -186,11 +186,12 @@ string_ suspended f s0 = T.Parser $ \t pos more lose succ ->
186186 let n = B.length s
187187 s = f s0
188188 in if lengthAtLeast pos n t
189− then if s == substring pos (Pos n) t
190− then succ t (pos + Pos n) more s
191− else lose t pos more [] "string"
189+ then let t' = substring pos (Pos n) t
190+ in if s == f t'
191+ then succ t (pos + Pos n) more t'
192+ else lose t pos more [] "string"
192193 else let t' = Buf.unsafeDrop (fromPos pos) t
193− in if t' `B.isPrefixOf` s
194+ in if f t' `B.isPrefixOf` s
194195 then suspended s (B.drop (B.length t') s) t pos more lose succ
195196 else lose t pos more [] "string"
196197{-# INLINE string_ #-}