Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unescaped whitespace in is_whitespace/1 #1

Merged
merged 2 commits into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions lib/unicode_guards.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ defmodule Unicode.Guards do
defguard is_currency_symbol(codepoint)
when is_integer(codepoint) and match?(codepoint, "[[:Sc:]]")


@doc """
Guards whether a UTF8 codepoint is a whitespace symbol
character.
Expand All @@ -69,7 +68,7 @@ defmodule Unicode.Guards do

"""
defguard is_whitespace(codepoint)
when is_integer(codepoint) and match?(codepoint, "[[\u0009-\u000d][:Zs:]]")
when is_integer(codepoint) and match?(codepoint, "[[\\u0009-\\u000d][:Zs:]]")

@doc """
Guards whether a UTF8 codepoint is a unicode separator symbol
Expand All @@ -79,7 +78,7 @@ defmodule Unicode.Guards do

"""
defguard is_separator(codepoint)
when is_integer(codepoint) and match?(codepoint, "[[:Zs:]]")
when is_integer(codepoint) and match?(codepoint, "[[:Zs:]]")

@doc """
Guards whether a UTF8 codepoint is a unicode quote symbol
Expand All @@ -92,7 +91,7 @@ defmodule Unicode.Guards do

"""
defguard is_quote_mark(codepoint)
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMark:]]")
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMark:]]")

@doc """
Guards whether a UTF8 codepoint is a unicode left quote symbol
Expand All @@ -102,7 +101,7 @@ defmodule Unicode.Guards do

"""
defguard is_quote_mark_left(codepoint)
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkLeft:]]")
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkLeft:]]")

@doc """
Guards whether a UTF8 codepoint is a unicode right quote symbol
Expand All @@ -112,7 +111,7 @@ defmodule Unicode.Guards do

"""
defguard is_quote_mark_right(codepoint)
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkRight:]]")
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkRight:]]")

@doc """
Guards whether a UTF8 codepoint is a unicode quote symbol that can
Expand All @@ -122,7 +121,7 @@ defmodule Unicode.Guards do

"""
defguard is_quote_mark_ambidextrous(codepoint)
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkAmbidextrous:]]")
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkAmbidextrous:]]")

@doc """
Guards whether a UTF8 codepoint is a unicode quote symbol that is
Expand All @@ -132,7 +131,7 @@ defmodule Unicode.Guards do

"""
defguard is_quote_mark_single(codepoint)
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkSingle:]]")
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkSingle:]]")

@doc """
Guards whether a UTF8 codepoint is a unicode quote symbol that is
Expand All @@ -142,7 +141,7 @@ defmodule Unicode.Guards do

"""
defguard is_quote_mark_double(codepoint)
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkDouble:]]")
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkDouble:]]")

@doc """
Guards whether a UTF8 codepoint is a printable.
Expand All @@ -152,7 +151,7 @@ defmodule Unicode.Guards do

"""
defguard is_printable(codepoint)
when is_integer(codepoint) and match?(codepoint, "[[:printable:]]")
when is_integer(codepoint) and match?(codepoint, "[[:printable:]]")

@doc """
Guards whether a UTF8 codepoint is a visible.
Expand All @@ -165,6 +164,5 @@ defmodule Unicode.Guards do

"""
defguard is_visible(codepoint)
when is_integer(codepoint) and match?(codepoint, "[[:visible:]]")

when is_integer(codepoint) and match?(codepoint, "[[:visible:]]")
end
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "a10c6eb62cca416019663129699769f0c2ccf39428b3bb3c0cb38c718a0c186d"},
"makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "d4b316c7222a85bbaa2fd7c6e90e37e953257ad196dc229505137c5e505e9eff"},
"nimble_parsec": {:hex, :nimble_parsec, "0.5.3", "def21c10a9ed70ce22754fdeea0810dafd53c2db3219a0cd54cf5526377af1c6", [:mix], [], "hexpm", "589b5af56f4afca65217a1f3eb3fee7e79b09c40c742fddc1c312b3ac0b3399f"},
"unicode_set": {:hex, :unicode_set, "0.5.1", "17433e103392a863e7ec3e4be330e23186daec986b46d28c5f255631ca11bc05", [:mix], [{:ex_unicode, "~> 1.5", [hex: :ex_unicode, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "6cd855f958152edd7cb06af05763ff3c4831970ba2bb872f2f1e78c2d99eb7b1"},
"unicode_set": {:hex, :unicode_set, "0.7.0", "d5256d31d7c672e1ac0d830e1f04f3fe698b2894ae1f25b55ea5dfa550c8315a", [:mix], [{:ex_unicode, "~> 1.5", [hex: :ex_unicode, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "ca5d6a085e4bc1a17ae8afd90b15b2682539281efac99fc3df4fd62a08318a40"},
}