@@ -155,8 +155,11 @@ defmodule Unicode.Guards do
155155
156156 @ doc false
157157 # Replaced by `is_graph/1`.
158- defguard is_visible ( codepoint )
159- when is_integer ( codepoint ) and match? ( codepoint , "[[:visible:]]" )
158+ defmacro is_visible ( codepoint ) do
159+ quote generated: true , location: :keep do
160+ is_integer ( unquote ( codepoint ) ) and match? ( unquote ( codepoint ) , "[[:visible:]]" )
161+ end
162+ end
160163
161164 @ doc """
162165 Guards whether a UTF8 codepoint is a graphic character.
@@ -166,8 +169,11 @@ defmodule Unicode.Guards do
166169 non-space, non-control and non-surrogate.
167170
168171 """
169- defguard is_graph ( codepoint )
170- when is_integer ( codepoint ) and match? ( codepoint , "[[:graph:]]" )
172+ defmacro is_graph ( codepoint ) do
173+ quote generated: true , location: :keep do
174+ is_integer ( unquote ( codepoint ) ) and match? ( unquote ( codepoint ) , "[[:graph:]]" )
175+ end
176+ end
171177
172178 @ doc """
173179 Guards whether a UTF8 codepoint is a space character.
@@ -187,6 +193,9 @@ defmodule Unicode.Guards do
187193 `[:graph:]` set and the `[:blank:]` set.
188194
189195 """
190- defguard is_print ( codepoint )
191- when is_integer ( codepoint ) and match? ( codepoint , "[[:print:]]" )
196+ defmacro is_print ( codepoint ) do
197+ quote generated: true , location: :keep do
198+ is_integer ( unquote ( codepoint ) ) and match? ( unquote ( codepoint ) , "[[:print:]]" )
199+ end
200+ end
192201end
0 commit comments