Skip to content

Instantly share code, notes, and snippets.

@MasterDuke17
Last active January 27, 2017 16:39
Show Gist options
  • Save MasterDuke17/e14fe534c3d348c975da200a98abdbb9 to your computer and use it in GitHub Desktop.
Save MasterDuke17/e14fe534c3d348c975da200a98abdbb9 to your computer and use it in GitHub Desktop.
find all Nd chars
my %h;
for ^0xFFFF {
if .chr.uniprop eq 'Nd' {
%h{.unival}.push: $_
}
elsif $_ >= 'a'.ord && $_ <= 'z'.ord {
%h{$_ - 'a'.ord + 10}.push: $_
}
elsif $_ >= 'A'.ord && $_ <= 'Z'.ord {
%h{$_ - 'A'.ord + 10}.push: $_
}
elsif $_ >= 0xFF21 && $_ <= 0xFF3A {
%h{$_ - 0xFF21 + 10}.push: $_
}
elsif $_ >= 0xFF41 && $_ <= 0xFF5A {
%h{$_ - 0xFF41 + 10}.push: $_
}
}
for %h.keys.sort(+*) -> $val {
for @(%h{$val}) -> $char {
say "case $char:";
}
say " ch = $val;\n break;"
}
say "default:\n goto END_WHILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment