Skip to content

Commit

Permalink
Add R metaops for standard infix operators.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Mar 2, 2009
1 parent 67770c3 commit 66595b0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions build/gen_metaop_pir.pl
Expand Up @@ -59,6 +59,8 @@
" optable.'newtok'('infix:%s=', 'equiv'=>'infix::=', 'lvalue'=>1)\n";
my $reducefmt =
" optable.'newtok'('prefix:[%s]', 'equiv'=>'infix:=')\n";
my $reversefmt =
" optable.'newtok'('infix:R%s', 'equiv'=>'infix:%s')\n";
my $hyper_no_dwim_fmt =
" optable.'newtok'(%s, 'equiv'=>'infix:%s')\n" .
" optable.'newtok'('infix:%s', 'equiv'=>'infix:%s', 'subname'=>%s)\n";
Expand Down Expand Up @@ -93,6 +95,15 @@
.tailcall '!REDUCEMETAOP$chain'('$opname', $identity, args)
.end\n);

# Reverse metaops
push @gtokens, sprintf( $reversefmt, $opname, $opname );
push @code, qq(
.sub 'infix:R${opname}'
.param pmc a
.param pmc b
.tailcall 'infix:$opname'(b, a)
.end\n);

# Cross operators.
push @gtokens, sprintf( $crossfmt, $opname );
my $is_chaining = $op_type eq 'comp' ? 1 : 0;
Expand Down

0 comments on commit 66595b0

Please sign in to comment.