darcs-2.16.3: a distributed, interactive, smart revision control system

Safe HaskellNone




tryTokReplace :: String -> ByteString -> ByteString -> ByteString -> Maybe ByteString Source #

tryTokReplace tokChars old new input tries to find the token old and replace it with the token new everywhere in the input, returning Just the modified input, unless the token new is already in the input in which case Nothing is returned. A token is a sequence of bytes that match the class defined by tokChars. This function is supposed to work efficiently with large inputs i.e. whole files.

forceTokReplace :: String -> ByteString -> ByteString -> ByteString -> ByteString Source #

forceTokReplace tokChars old new input replaces all occurrences of the old token with the new one, throughout the input.

annotateReplace :: String -> ByteString -> ByteString -> ByteString -> Bool Source #

Check if a token replace operation touches the given line.

breakToTokens :: ByteString -> [ByteString] Source #

Break a Bytestring into tokens, according to defaultToks, discarding non-tokens.