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
449449
450450 defp add_buffer_to_acc ( "" , acc ) , do: acc
451451 defp add_buffer_to_acc ( buffer , acc ) , do: [ buffer | acc ]
452- end
453452
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
454464
455465defmodule String.Normalizer do
456466 @ moduledoc false
@@ -516,7 +526,11 @@ defmodule String.Normalizer do
516526 end
517527
518528 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+
520534 defp canonical_order ( unquote ( << cp :: utf8 >> ) <> rest , acc ) do
521535 canonical_order ( unquote ( decomposition ) <> rest , acc )
522536 end
You can’t perform that action at this time.
0 commit comments