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

Safe HaskellNone

Darcs.Patch.TokenReplace

Synopsis

Documentation

tryTokInternal :: String -> ByteString -> ByteString -> ByteString -> Maybe [ByteString]

tryTokInternal takes a String of token chars, an oldToken ByteString, a newToken ByteString and returns the list of token-delimited ByteStrings, with any tokens matching oldToken being replaced by newToken. If newToken is already in the input, we return Nothing.

forceTokReplace :: String -> ByteString -> ByteString -> ByteString -> ByteString

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

breakOutToken :: String -> ByteString -> (ByteString, ByteString, ByteString)

breakOutToken takes a String of token chars and an input ByteString, and returns the ByteString triple of (beforeToken, token, afterToken).