Skip to content

Commit 02ee677

Browse files
BodigrimLysxia
authored andcommitted
Do not try being clever in case fold mapping
1 parent 81d178c commit 02ee677

File tree

2 files changed

+1743
-518
lines changed

2 files changed

+1743
-518
lines changed

scripts/CaseFolding.hs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,12 @@ parseCF :: FilePath -> IO (Either ParseError CaseFolding)
3535
parseCF name = parse entries name <$> readFile name
3636

3737
mapCF :: CaseFolding -> [String]
38-
mapCF (CF _ ms) = typ ++ map printUnusual ms' ++ map printUsual usual ++ [last]
38+
mapCF (CF _ ms) = typ ++ map printUnusual (filter (\f -> status f `elem` "CF") ms) ++ [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-
4640
typ = ["foldMapping :: Char# -> _ {- unboxed Int64 -}"
4741
,"{-# NOINLINE foldMapping #-}"
4842
,"foldMapping = \\case"]
4943
last = " _ -> unI64 0"
5044
printUnusual c = " -- " ++ name c ++ "\n" ++
5145
" " ++ showC (code c) ++ "# -> unI64 " ++ show (ord x + (ord y `shiftL` 21) + (ord z `shiftL` 42))
5246
where x:y:z:_ = mapping c ++ repeat '\0'
53-
printUsual c = " " ++ showC c ++ "# -> unI64 " ++ show (ord (toLower c))

0 commit comments

Comments
 (0)