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

Safe Haskell | None
Language | Haskell2010

Darcs.Patch.TokenReplace

Synopsis

- tryTokInternal :: String -> ByteString -> ByteString -> ByteString -> Maybe [ByteString]
- forceTokReplace :: String -> ByteString -> ByteString -> ByteString -> ByteString
- breakOutToken :: String -> ByteString -> (ByteString, ByteString, ByteString)
- breakToTokens :: ByteString -> [ByteString]
- defaultToks :: String

# 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).

breakToTokens :: ByteString -> [ByteString] #

defaultToks :: String #