Skip to content

Commit 3a4862f

Browse files
authored
Merge pull request #1 from nickdichev/fix_unescaped_whitespace
Fix unescaped whitespace in is_whitespace/1
2 parents 3355085 + 0e92abd commit 3a4862f

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

lib/unicode_guards.ex

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ defmodule Unicode.Guards do
5959
defguard is_currency_symbol(codepoint)
6060
when is_integer(codepoint) and match?(codepoint, "[[:Sc:]]")
6161

62-
6362
@doc """
6463
Guards whether a UTF8 codepoint is a whitespace symbol
6564
character.
@@ -69,7 +68,7 @@ defmodule Unicode.Guards do
6968
7069
"""
7170
defguard is_whitespace(codepoint)
72-
when is_integer(codepoint) and match?(codepoint, "[[\u0009-\u000d][:Zs:]]")
71+
when is_integer(codepoint) and match?(codepoint, "[[\\u0009-\\u000d][:Zs:]]")
7372

7473
@doc """
7574
Guards whether a UTF8 codepoint is a unicode separator symbol
@@ -79,7 +78,7 @@ defmodule Unicode.Guards do
7978
8079
"""
8180
defguard is_separator(codepoint)
82-
when is_integer(codepoint) and match?(codepoint, "[[:Zs:]]")
81+
when is_integer(codepoint) and match?(codepoint, "[[:Zs:]]")
8382

8483
@doc """
8584
Guards whether a UTF8 codepoint is a unicode quote symbol
@@ -92,7 +91,7 @@ defmodule Unicode.Guards do
9291
9392
"""
9493
defguard is_quote_mark(codepoint)
95-
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMark:]]")
94+
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMark:]]")
9695

9796
@doc """
9897
Guards whether a UTF8 codepoint is a unicode left quote symbol
@@ -102,7 +101,7 @@ defmodule Unicode.Guards do
102101
103102
"""
104103
defguard is_quote_mark_left(codepoint)
105-
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkLeft:]]")
104+
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkLeft:]]")
106105

107106
@doc """
108107
Guards whether a UTF8 codepoint is a unicode right quote symbol
@@ -112,7 +111,7 @@ defmodule Unicode.Guards do
112111
113112
"""
114113
defguard is_quote_mark_right(codepoint)
115-
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkRight:]]")
114+
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkRight:]]")
116115

117116
@doc """
118117
Guards whether a UTF8 codepoint is a unicode quote symbol that can
@@ -122,7 +121,7 @@ defmodule Unicode.Guards do
122121
123122
"""
124123
defguard is_quote_mark_ambidextrous(codepoint)
125-
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkAmbidextrous:]]")
124+
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkAmbidextrous:]]")
126125

127126
@doc """
128127
Guards whether a UTF8 codepoint is a unicode quote symbol that is
@@ -132,7 +131,7 @@ defmodule Unicode.Guards do
132131
133132
"""
134133
defguard is_quote_mark_single(codepoint)
135-
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkSingle:]]")
134+
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkSingle:]]")
136135

137136
@doc """
138137
Guards whether a UTF8 codepoint is a unicode quote symbol that is
@@ -142,7 +141,7 @@ defmodule Unicode.Guards do
142141
143142
"""
144143
defguard is_quote_mark_double(codepoint)
145-
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkDouble:]]")
144+
when is_integer(codepoint) and match?(codepoint, "[[:QuoteMarkDouble:]]")
146145

147146
@doc """
148147
Guards whether a UTF8 codepoint is a printable.
@@ -152,7 +151,7 @@ defmodule Unicode.Guards do
152151
153152
"""
154153
defguard is_printable(codepoint)
155-
when is_integer(codepoint) and match?(codepoint, "[[:printable:]]")
154+
when is_integer(codepoint) and match?(codepoint, "[[:printable:]]")
156155

157156
@doc """
158157
Guards whether a UTF8 codepoint is a visible.
@@ -165,6 +164,5 @@ defmodule Unicode.Guards do
165164
166165
"""
167166
defguard is_visible(codepoint)
168-
when is_integer(codepoint) and match?(codepoint, "[[:visible:]]")
169-
167+
when is_integer(codepoint) and match?(codepoint, "[[:visible:]]")
170168
end

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
"makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "a10c6eb62cca416019663129699769f0c2ccf39428b3bb3c0cb38c718a0c186d"},
88
"makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "d4b316c7222a85bbaa2fd7c6e90e37e953257ad196dc229505137c5e505e9eff"},
99
"nimble_parsec": {:hex, :nimble_parsec, "0.5.3", "def21c10a9ed70ce22754fdeea0810dafd53c2db3219a0cd54cf5526377af1c6", [:mix], [], "hexpm", "589b5af56f4afca65217a1f3eb3fee7e79b09c40c742fddc1c312b3ac0b3399f"},
10-
"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"},
10+
"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"},
1111
}

0 commit comments

Comments
 (0)