Skip to content

Commit

Permalink
Add ability to declare infix: subs.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed May 14, 2009
1 parent 8349d75 commit ad9e008
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/PARROT_REVISION
@@ -1 +1 @@
38720
38768
12 changes: 11 additions & 1 deletion src/parser/actions.pm
Expand Up @@ -767,7 +767,7 @@ method routine_def($/) {
if $<deflongname> {
my $name := ~$<deflongname>[0];
my $match := Perl6::Grammar::opname($name, :grammar('Perl6::Grammar') );
if $match { $name := ~$match<category> ~ ':' ~ ~$match[0]; }
if $match { $name := add_optoken($block, $match); }
our @?BLOCK;
my $existing := @?BLOCK[0].symbol($name);
if $existing && !$existing<is_proto> && !$existing<is_multi> {
Expand Down Expand Up @@ -3099,6 +3099,16 @@ sub make_sigparam($var) {
}
$sigparam;
}


sub add_optoken($block, $match) {
my $?OPTABLE :=
Q:PIR { %r = get_hll_global ['Perl6';'Grammar'], '$optable' };
my $name := ~$match<category> ~ ':' ~ ~$match[0];
my $category := $match<category>;
$?OPTABLE.newtok($name, :equiv('infix:+'));
$name;
}


# Local Variables:
Expand Down

0 comments on commit ad9e008

Please sign in to comment.