-module(sqlode@char_utils). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/sqlode/char_utils.gleam"). -export([is_digit/1, is_alpha/1, is_uppercase_letter/1, is_alpha_or_underscore/1, is_alnum_or_underscore/1, all_digits/1]). -file("src/sqlode/char_utils.gleam", 3). -spec is_digit(binary()) -> boolean(). is_digit(G) -> case G of <<"0"/utf8>> -> true; <<"1"/utf8>> -> true; <<"2"/utf8>> -> true; <<"3"/utf8>> -> true; <<"4"/utf8>> -> true; <<"5"/utf8>> -> true; <<"6"/utf8>> -> true; <<"7"/utf8>> -> true; <<"8"/utf8>> -> true; <<"9"/utf8>> -> true; _ -> false end. -file("src/sqlode/char_utils.gleam", 10). -spec is_alpha(binary()) -> boolean(). is_alpha(G) -> Cp@1 = case gleam@string:to_utf_codepoints(G) of [Cp] -> gleam_stdlib:identity(Cp); _ -> 0 end, ((Cp@1 >= 65) andalso (Cp@1 =< 90)) orelse ((Cp@1 >= 97) andalso (Cp@1 =< 122)). -file("src/sqlode/char_utils.gleam", 18). -spec is_uppercase_letter(binary()) -> boolean(). is_uppercase_letter(G) -> Cp@1 = case gleam@string:to_utf_codepoints(G) of [Cp] -> gleam_stdlib:identity(Cp); _ -> 0 end, (Cp@1 >= 65) andalso (Cp@1 =< 90). -file("src/sqlode/char_utils.gleam", 26). -spec is_alpha_or_underscore(binary()) -> boolean(). is_alpha_or_underscore(G) -> is_alpha(G) orelse (G =:= <<"_"/utf8>>). -file("src/sqlode/char_utils.gleam", 30). -spec is_alnum_or_underscore(binary()) -> boolean(). is_alnum_or_underscore(G) -> (is_alpha(G) orelse is_digit(G)) orelse (G =:= <<"_"/utf8>>). -file("src/sqlode/char_utils.gleam", 41). -spec all_digits_loop(binary()) -> boolean(). all_digits_loop(Value) -> case gleam_stdlib:string_pop_grapheme(Value) of {error, _} -> true; {ok, {Char, Rest}} -> case is_digit(Char) of true -> all_digits_loop(Rest); false -> false end end. -file("src/sqlode/char_utils.gleam", 34). -spec all_digits(binary()) -> boolean(). all_digits(Value) -> case Value of <<""/utf8>> -> false; _ -> all_digits_loop(Value) end.