Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
allow unival terms, because why not?
  • Loading branch information
TimToady committed Nov 25, 2015
1 parent 4d8a904 commit 8ef5a59
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Perl6/Actions.nqp
Expand Up @@ -6591,6 +6591,9 @@ Compilation unit '$file' contained the following violations:
make $qast;
}

my $nuprop := nqp::unipropcode("NumericValueNumerator");
my $deprop := nqp::unipropcode("NumericValueDenominator");

method numish($/) {
if $<integer> {
make $*W.add_numeric_constant($/, 'Int', $<integer>.ast);
Expand All @@ -6599,6 +6602,14 @@ Compilation unit '$file' contained the following violations:
elsif $<rad_number> { make $<rad_number>.ast; }
elsif $<rat_number> { make $<rat_number>.ast; }
elsif $<complex_number> { make $<complex_number>.ast; }
elsif $<unum> {
my $code := nqp::ord($/.Str);
my int $nu := +nqp::getuniprop_str($code, $nuprop);
my int $de := +nqp::getuniprop_str($code, $deprop);
!$de || $de == '1'
?? make $*W.add_numeric_constant($/, 'Int', +$nu)
!! make $*W.add_constant('Rat', 'type_new', $nu, $de, :nocache(1));
}
else {
make $*W.add_numeric_constant($/, 'Num', +$/);
}
Expand Down
1 change: 1 addition & 0 deletions src/Perl6/Grammar.nqp
Expand Up @@ -3282,6 +3282,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
| 'Inf' >>
| '+Inf' >>
| '-Inf' >>
| <unum=:No+:Nl>
]
}

Expand Down

0 comments on commit 8ef5a59

Please sign in to comment.