39 #define RUNE_ERROR ((rune_t)0xFFFD) 52 extern const char *
sys_rune_next(
const char *str, rune_t *rune);
114 if (r >=
'A' && r <=
'Z') {
117 if (r >= 0x00C0 && r <= 0x00D6) {
120 if (r >= 0x00D8 && r <= 0x00DE) {
131 if (r >=
'a' && r <=
'z') {
137 if (r >= 0x00E0 && r <= 0x00F6) {
140 if (r >= 0x00F8 && r <= 0x00FF) {
163 if (r >=
'a' && r <=
'z') {
166 if (r >= 0x00E0 && r <= 0x00F6) {
169 if (r >= 0x00F8 && r <= 0x00FE) {
182 if (r >=
'A' && r <=
'Z') {
185 if (r >= 0x00C0 && r <= 0x00D6) {
188 if (r >= 0x00D8 && r <= 0x00DE) {
284 if (r >= 0x00 && r <= 0x1F) {
290 if (r >= 0x80 && r <= 0x9F) {
sys_iostream_t * stream
source (private)
Tokenizer state, grouping a stream into maximal runs of same-class runes.
int32_t rune_t
A single decoded Unicode code point.
static bool sys_rune_is_symbol(rune_t r)
Reports whether r is a symbol character (math, currency, or modifier symbols).
static bool sys_rune_is_punct(rune_t r)
Reports whether r is a punctuation character.
size_t bytes
length of the current token, in bytes
static bool sys_rune_is_space(rune_t r)
Reports whether r is a space character (space, \t, \n, \v, \f, \r, U+0085 NEL, or U+00A0 NBSP)...
static bool sys_rune_is_alpha(rune_t r)
Reports whether r is a letter.
unclassified - also covers RUNE_ERROR
size_t sys_rune_tokenize_token(sys_rune_tokenize_t *it, char *buf, size_t cap)
Read the current token's text.
System abstraction headers and process lifecycle hooks.
bool sys_rune_valid(const char *str)
Check whether a string is well-formed UTF-8.
struct sys_iostream_t sys_iostream_t
An opaque byte stream.
static bool sys_rune_is_lower(rune_t r)
Reports whether r is a lowercase letter.
static bool sys_rune_is_control(rune_t r)
Reports whether r is a control character.
sys_rune_class_t
Classification of a rune, or of a maximal run of same-class runes.
size_t runes
number of runes in the current token
static bool sys_rune_is_upper(rune_t r)
Reports whether r is an uppercase letter.
bool sys_rune_tokenize_next(sys_rune_tokenize_t *it)
Advance to the next maximal run of same-class runes.
see sys_rune_is_control()
size_t sys_rune_count(const char *str)
Count the runes in a UTF-8 string.
struct sys_rune_tokenize_t sys_rune_tokenize_t
Tokenizer state, grouping a stream into maximal runs of same-class runes.
sys_rune_class_t isa
classification shared by the whole token
const char * sys_rune_next(const char *str, rune_t *rune)
Decode the next UTF-8 rune from a string.
static bool sys_rune_is_digit(rune_t r)
Reports whether r is a decimal digit.
static rune_t sys_rune_to_lower(rune_t r)
Converts r to its lowercase form, if it has one.
ptrdiff_t start
absolute stream position where the current token begins
sys_rune_tokenize_t sys_rune_tokenize_init(sys_iostream_t *stream)
Initialize a tokenizer over a stream.
static rune_t sys_rune_to_upper(rune_t r)
Converts r to its uppercase form, if it has one.
sys_rune_class_t sys_rune_isa(rune_t r)
Classify a single rune.