Packages
toon_codec
1.0.0
TOON (Token-Oriented Object Notation) encoder/decoder - a compact, token-efficient format for LLM input
Current section
Files
Jump to
Current section
Files
src/toon_codec@internal@char.erl
-module(toon_codec@internal@char).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/toon_codec/internal/char.gleam").
-export([is_key_start/1, is_key_char/1, is_digit/1, is_whitespace/1, is_newline/1]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(false).
-file("src/toon_codec/internal/char.gleam", 20).
?DOC(false).
-spec is_key_start(binary()) -> boolean().
is_key_start(Char) ->
gleam_stdlib:contains_string(
<<"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_"/utf8>>,
Char
).
-file("src/toon_codec/internal/char.gleam", 24).
?DOC(false).
-spec is_key_char(binary()) -> boolean().
is_key_char(Char) ->
gleam_stdlib:contains_string(
<<"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_."/utf8>>,
Char
).
-file("src/toon_codec/internal/char.gleam", 28).
?DOC(false).
-spec is_digit(binary()) -> boolean().
is_digit(Char) ->
gleam_stdlib:contains_string(<<"0123456789"/utf8>>, Char).
-file("src/toon_codec/internal/char.gleam", 32).
?DOC(false).
-spec is_whitespace(binary()) -> boolean().
is_whitespace(Char) ->
(Char =:= <<" "/utf8>>) orelse (Char =:= <<"\t"/utf8>>).
-file("src/toon_codec/internal/char.gleam", 36).
?DOC(false).
-spec is_newline(binary()) -> boolean().
is_newline(Char) ->
(Char =:= <<"\n"/utf8>>) orelse (Char =:= <<"\r"/utf8>>).