1-- This script processes the following source file:
3-- http://unicode.org/Public/UNIDATA/SpecialCasing.txt
15data SpecialCasing = SC { scComments :: [Comment], scCasing :: [Case] }
23 , conditions :: String
25 } deriving (Eq, Ord, Show)
27entries :: Parser SpecialCasing
28entries = SC <$> many comment <*> many (entry <* many comment)
30 entry = Case <$> unichar <* semi
34 <*> manyTill anyToken (string "# ")
35 <*> manyTill anyToken (char '\n')
37parseSC :: FilePath -> IO (Either ParseError SpecialCasing)
38parseSC name = parse entries name <$> readFile name
40mapSC :: String -> (Case -> String) -> (Char -> Char) -> SpecialCasing
42mapSC which access twiddle (SC _ ms) =
43 typ ++ (map nice . filter p $ ms) ++ [last]
45 typ = [which ++ "Mapping :: forall s. Char -> s -> Step (CC s) Char"
46 ,"{-# NOINLINE " ++ which ++ "Mapping #-}"]
47 last = which ++ "Mapping c s = Yield (to" ++ ucFirst which ++ " c) (CC s '\\0' '\\0')"
48 nice c = "-- " ++ name c ++ "\n" ++
49 which ++ "Mapping " ++ showC (code c) ++ " s = Yield " ++ x ++ " (CC s " ++ y ++ " " ++ z ++ ")"
50 where [x,y,z] = (map showC . take 3) (access c ++ repeat '\0')
51 p c = [k] /= a && a /= [twiddle k] && null (conditions c)
55ucFirst (c:cs) = toUpper c : cs
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list