Skip to content

Commit 133dfa8

Browse files
authored
Provide multiple validate clauses for base16 (#15337)
It is consistent with the other implementations.
1 parent 39d646f commit 133dfa8

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

lib/elixir/lib/base.ex

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,26 @@ defmodule Base do
376376

377377
defp unquote(validate_name)(<<>>), do: true
378378

379+
defp unquote(validate_name)(<<c1, c2, c3, c4, c5, c6, c7, c8, rest::binary>>) do
380+
unquote(valid_char_name)(c1) and
381+
unquote(valid_char_name)(c2) and
382+
unquote(valid_char_name)(c3) and
383+
unquote(valid_char_name)(c4) and
384+
unquote(valid_char_name)(c5) and
385+
unquote(valid_char_name)(c6) and
386+
unquote(valid_char_name)(c7) and
387+
unquote(valid_char_name)(c8) and
388+
unquote(validate_name)(rest)
389+
end
390+
391+
defp unquote(validate_name)(<<c1, c2, c3, c4, rest::binary>>) do
392+
unquote(valid_char_name)(c1) and
393+
unquote(valid_char_name)(c2) and
394+
unquote(valid_char_name)(c3) and
395+
unquote(valid_char_name)(c4) and
396+
unquote(validate_name)(rest)
397+
end
398+
379399
defp unquote(validate_name)(<<c1, c2, rest::binary>>) do
380400
unquote(valid_char_name)(c1) and
381401
unquote(valid_char_name)(c2) and

0 commit comments

Comments
 (0)