File tree Expand file tree Collapse file tree 4 files changed +5519
-18
lines changed
src/Data/Text/Internal/Fusion Expand file tree Collapse file tree 4 files changed +5519
-18
lines changed Original file line number Diff line number Diff line change @@ -35,14 +35,19 @@ parseCF :: FilePath -> IO (Either ParseError CaseFolding)
3535parseCF name = parse entries name <$> readFile name
3636
3737mapCF :: CaseFolding -> [String ]
38- mapCF (CF _ ms) = typ ++ ( map nice . filter p $ ms) ++ [last ]
38+ mapCF (CF _ ms) = typ ++ map printUnusual ms' ++ map printUsual usual ++ [last ]
3939 where
40+ ms' = filter p ms
41+ p f = status f `elem` " CF" &&
42+ mapping f /= [toLower (code f)]
43+ unusual = map code ms'
44+ usual = filter (\ c -> toLower c /= c && c `notElem` unusual) [minBound .. maxBound ]
45+
4046 typ = [" foldMapping :: Char# -> _"
4147 ," {-# NOINLINE foldMapping #-}"
4248 ," foldMapping = \\ case" ]
4349 last = " _ -> unI64 0"
44- nice c = " -- " ++ name c ++ " \n " ++
50+ printUnusual c = " -- " ++ name c ++ " \n " ++
4551 " " ++ showC (code c) ++ " # -> unI64 " ++ show (ord x + (ord y `shiftL` 21 ) + (ord z `shiftL` 42 ))
4652 where x: y: z: _ = mapping c ++ repeat '\ 0 '
47- p f = status f `elem` " CF" &&
48- mapping f /= [toLower (code f)]
53+ printUsual c = " " ++ showC c ++ " # -> unI64 " ++ show (ord (toLower c))
Original file line number Diff line number Diff line change @@ -41,18 +41,23 @@ parseSC name = parse entries name <$> readFile name
4141mapSC :: String -> (Case -> String ) -> (Char -> Char ) -> SpecialCasing
4242 -> [String ]
4343mapSC which access twiddle (SC _ ms) =
44- typ ++ ( map nice . filter p $ ms) ++ [last ]
44+ typ ++ map printUnusual ms' ++ map printUsual usual ++ [last ]
4545 where
46+ ms' = filter p ms
47+ p c = [k] /= a && a /= [twiddle k] && null (conditions c)
48+ where a = access c
49+ k = code c
50+ unusual = map code ms'
51+ usual = filter (\ c -> twiddle c /= c && c `notElem` unusual) [minBound .. maxBound ]
52+
4653 typ = [which ++ " Mapping :: Char# -> _"
4754 ," {-# NOINLINE " ++ which ++ " Mapping #-}"
4855 ,which ++ " Mapping = \\ case" ]
4956 last = " _ -> unI64 0"
50- nice c = " -- " ++ name c ++ " \n " ++
57+ printUnusual c = " -- " ++ name c ++ " \n " ++
5158 " " ++ showC (code c) ++ " # -> unI64 " ++ show (ord x + (ord y `shiftL` 21 ) + (ord z `shiftL` 42 ))
5259 where x: y: z: _ = access c ++ repeat '\ 0 '
53- p c = [k] /= a && a /= [twiddle k] && null (conditions c)
54- where a = access c
55- k = code c
60+ printUsual c = " " ++ showC c ++ " # -> unI64 " ++ show (ord (twiddle c))
5661
5762ucFirst (c: cs) = toUpper c : cs
5863ucFirst [] = []
You can’t perform that action at this time.
0 commit comments