kojote/vendor/hare-unicode/cmd/ucdtest/main.ha
Lobo Torres c70ec9f648 Add 'vendor/hare-unicode/' from commit '1488c26f46f7f8568235eaee6224983ac46e78ff'
git-subtree-dir: vendor/hare-unicode
git-subtree-mainline: 57979aa6fc
git-subtree-split: 1488c26f46
2024-12-04 13:29:21 -03:00

25 lines
517 B
Hare

use fmt;
use os;
use strings;
use unicode;
export fn main() void = {
const in = os::args[1];
const iter = strings::iter(in);
for (true) {
const rn = match (strings::next(&iter)) {
case let rn: rune =>
yield rn;
case => break;
};
const gc = unicode::rune_gc(rn);
const sc = unicode::rune_script(rn);
const lb = unicode::rune_line_break(rn);
fmt::printfln("'{}'/{:x}: {} : {} : {}",
rn, rn: u32,
unicode::gc_code(gc),
unicode::script_code(sc),
unicode::line_break_code(lb))!;
};
};