Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement term:<> categoricals
  • Loading branch information
sorear committed Mar 13, 2011
1 parent a800dde commit 7caf678
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/niecza
Expand Up @@ -69,6 +69,36 @@ my %list_prefix = (:dba('list prefix') , :prec<e=>, :assoc<unary>, :uass
}

augment class NieczaActions {
method FALLBACK($meth, $/) {
if $meth eq '::($name)' { # XXX STD miscompilation
my $p = $<O><prec>;
if $p eq 't=' { # additive
make Operator.funop('&infix:<' ~ self.get_op_sym($/) ~ '>', 2);
} elsif $p eq 'y=' && $<semilist> {
my $sym = $*GOAL eq '}' ?? '{ }' !! $*GOAL eq ']' ?? '[ ]' !!
die "Unhandled postcircumfix ending in $*GOAL";
make Operator.funop('&postcircumfix:<' ~ $sym ~ '>', 1, @( $<semilist>.ast ));
} elsif $p eq 'y=' {
make Operator.funop('&postfix:<' ~ self.get_op_sym($/) ~ '>', 1);
} elsif $p eq 'v=' || $p eq 'o=' {
make Operator.funop('&prefix:<' ~ self.get_op_sym($/) ~ '>', 1);
} elsif $p eq 'z=' && !$<semilist> {
make mkcall($/, '&term:<' ~ self.get_op_sym($/) ~ '>');
}
} elsif substr($meth,0,7) eq 'prefix:' {
make Operator.funop('&prefix:<' ~ self.get_op_sym($/) ~ '>', 1);
} elsif substr($meth,0,8) eq 'postfix:' {
make Operator.funop('&postfix:<' ~ self.get_op_sym($/) ~ '>', 1);
} elsif substr($meth,0,6) eq 'infix:' {
make Operator.funop('&infix:<' ~ self.get_op_sym($/) ~ '>', 2);
} elsif substr($meth,0,5) eq 'term:' {
make mkcall($/, '&term:<' ~ self.get_op_sym($/) ~ '>');
} else {
$/.CURSOR.sorry("Action method $meth not yet implemented");
}
}


method variable($/) {
my $sigil = $<sigil> ?? ~$<sigil> !! substr(~$/, 0, 1);
my $twigil = $<twigil> ?? $<twigil>[0]<sym> !! '';
Expand Down

0 comments on commit 7caf678

Please sign in to comment.