File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -449,8 +449,18 @@ defmodule String.Break do
449
449
450
450
defp add_buffer_to_acc ( "" , acc ) , do: acc
451
451
defp add_buffer_to_acc ( buffer , acc ) , do: [ buffer | acc ]
452
- end
453
452
453
+ # Decompose
454
+
455
+ def decompose ( entries , map ) do
456
+ for entry <- entries do
457
+ case map do
458
+ % { ^ entry => match } -> decompose ( match , map )
459
+ % { } -> << entry :: utf8 >>
460
+ end
461
+ end
462
+ end
463
+ end
454
464
455
465
defmodule String.Normalizer do
456
466
@ moduledoc false
@@ -516,7 +526,11 @@ defmodule String.Normalizer do
516
526
end
517
527
518
528
for { cp , decomposition } <- decompositions do
519
- decomposition = decomposition |> Enum . map ( & << & 1 :: utf8 >> ) |> IO . iodata_to_binary ( )
529
+ decomposition =
530
+ decomposition
531
+ |> String.Break . decompose ( decompositions )
532
+ |> IO . iodata_to_binary ( )
533
+
520
534
defp canonical_order ( unquote ( << cp :: utf8 >> ) <> rest , acc ) do
521
535
canonical_order ( unquote ( decomposition ) <> rest , acc )
522
536
end
You can’t perform that action at this time.
0 commit comments