Skip to content

Commit

Permalink
Change Actions.nqp to use getstrfromname on MoarVM
Browse files Browse the repository at this point in the history
Use getstrfromname instead of getcodepointfromname so we can retrieve
grapheme clusters and not just single codepoints.
  • Loading branch information
samcv committed Jan 11, 2017
1 parent 3f7c360 commit 31b2b51
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/HLL/Actions.nqp
Expand Up @@ -203,11 +203,19 @@ class HLL::Actions {
}

method charname($/) {
my $codepoint := $<integer>
?? $<integer>.made
#?if !moar
my $codepoint := ?? $<integer>.made
!! nqp::codepointfromname(~$/);
$/.CURSOR.panic("Unrecognized character name $/") if $codepoint < 0;
$/.CURSOR.panic("Unrecognized character name $/") if $codepoint < 0;
make nqp::chr($codepoint);
#?endif
#?if moar
my $codepoint := $<integer>
?? nqp::chr($<integer>.made)
!! nqp::getstrfromname(~$/);
$/.CURSOR.panic("Unrecognized character name $/") if $codepoint eq '';
make $codepoint;
#?endif
}

method charnames($/) {
Expand Down

0 comments on commit 31b2b51

Please sign in to comment.