Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
conflict solved
  • Loading branch information
mertcanaltin committed Jan 11, 2025
commit 11310f8174331d0b67b5b53641bfef3c40fd5f77
7 changes: 7 additions & 0 deletions include/ada/unicode.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ ada_really_inline constexpr bool is_ascii_hex_digit(char c) noexcept;
*/
ada_really_inline constexpr bool is_ascii_digit(char c) noexcept;

/**
* @private
* @details If a char is between U+0000 and U+007F inclusive, then it's an ASCII
* character.
*/
ada_really_inline constexpr bool is_ascii(char32_t c) noexcept;

/**
* @private
* Checks if the input is a C0 control or space character.
Expand Down
3 changes: 2 additions & 1 deletion src/unicode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,14 @@ ada_really_inline constexpr bool is_ascii_hex_digit(const char c) noexcept {
}

ada_really_inline constexpr bool is_ascii_digit(const char c) noexcept {
// An ASCII digit is a code point in the range U+0030 (0) to U+0039 (9),
// inclusive.
return c >= '0' && c <= '9';
}

ada_really_inline constexpr bool is_ascii(const char32_t c) noexcept {
// If code point is between U+0000 and U+007F inclusive, then return true.
return c <= 0x7F;

}

ada_really_inline constexpr bool is_c0_control_or_space(const char c) noexcept {
Expand Down