Skip to content

Commit

Permalink
Add Niecza::UCD minimalist access module
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Dec 19, 2011
1 parent 60d6d0d commit 808b2c1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/Niecza/UCD.pm6
@@ -0,0 +1,20 @@
module Niecza::UCD;

sub ranges_num($table, $matcher) is export {
Q:CgOp { (ucd_get_ranges {$table} {$matcher}) }
}
sub get_value_num($table, $ord) is export {
Q:CgOp { (ucd_get_value {$table} {$ord}) }
}

sub ranges($table, $matcher) is export {
my @ranges;
for ranges_num($table, $matcher) -> $low, $limit {
push @ranges, ($limit == $low + 1) ?? chr($low) !!
$(chr($low) .. chr($limit-1));
}
@ranges
}

sub value($table, $chr) is export { get_value_num($table, ord $chr) }

0 comments on commit 808b2c1

Please sign in to comment.