diff options
author | 2011-12-20 14:37:53 -0400 | |
---|---|---|
committer | 2011-12-20 14:37:53 -0400 | |
commit | ee3b5b2a4279292d55af43c772cdfd0c56420798 (patch) | |
tree | 0227fb4732ef376ac9123a9a89b924793ed841e2 /Git/Filename.hs | |
parent | 6897460d350df41f1e98147f96fde1b66171bc19 (diff) |
use Common in a few more modules
Diffstat (limited to 'Git/Filename.hs')
-rw-r--r-- | Git/Filename.hs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Git/Filename.hs b/Git/Filename.hs index 69f36d086..35b553250 100644 --- a/Git/Filename.hs +++ b/Git/Filename.hs @@ -13,22 +13,21 @@ import Data.Char import Data.Word (Word8) import Text.Printf +import Common + decode :: String -> FilePath decode [] = [] decode f@(c:s) -- encoded strings will be inside double quotes - | c == '"' = unescape ("", middle) + | c == '"' && end s == ['"'] = unescape ("", beginning s) | otherwise = f where e = '\\' - middle = init s unescape (b, []) = b -- look for escapes starting with '\' - unescape (b, v) = b ++ beginning ++ unescape (handle rest) + unescape (b, v) = b ++ fst pair ++ unescape (handle $ snd pair) where pair = span (/= e) v - beginning = fst pair - rest = snd pair isescape x = x == e -- \NNN is an octal encoded character handle (x:n1:n2:n3:rest) @@ -38,7 +37,7 @@ decode f@(c:s) isOctDigit n2 && isOctDigit n3 fromoctal = [chr $ readoctal [n1, n2, n3]] - readoctal o = read $ "0o" ++ o :: Int + readoctal o = Prelude.read $ "0o" ++ o :: Int -- \C is used for a few special characters handle (x:nc:rest) | isescape x = ([echar nc], rest) |