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

Safe HaskellNone
LanguageHaskell2010

Darcs.Patch.TokenReplace

Synopsis

Documentation

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

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 Source #

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

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

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