diff --git a/src/parser/actions.pm b/src/parser/actions.pm index 6c5fda8c6b4..47e69fb47fc 100644 --- a/src/parser/actions.pm +++ b/src/parser/actions.pm @@ -818,8 +818,11 @@ method method_def($/) { my $block := $.ast; $block.blocktype('method'); - if $ { - $block.name( ~$ ); + if $ { + my $name := ~$; + my $match := Perl6::Grammar::opname($name, :grammar('Perl6::Grammar') ); + if $match { $name := add_optoken($block, $match); } + $block.name( $name ); } # Add lexical 'self' and a slot for the candidate dispatcher list. @@ -3118,7 +3121,7 @@ sub add_optoken($block, $match) { my $equiv := 'infix:+'; if $category eq 'prefix' { $equiv := 'prefix:+' } elsif $category eq 'postfix' { $equiv := 'postfix:++' } - elsif $category eq 'circumfix' { $equiv := 'term:' } + elsif $category eq 'circumfix' || $category eq 'postcircumfix' { $equiv := 'term:' } my $past := PAST::Op.new( :name('newtok'), :pasttype('callmethod'), PAST::Op.new( :inline(" %r = get_hll_global ['Perl6';'Grammar'], '$optable'") diff --git a/src/parser/grammar.pg b/src/parser/grammar.pg index d2fbe08b505..7f599755990 100644 --- a/src/parser/grammar.pg +++ b/src/parser/grammar.pg @@ -426,7 +426,7 @@ rule routine_def { rule method_def { [ - | $=[<[ ! ]>?] [ | ]* + | $=[<[ ! ]>?] [ | ]* | * | :: ] @@ -873,7 +873,7 @@ token subshortname { + } -token category { 'infix' | 'prefix' | 'postfix' | 'circumfix' | 'trait_auxiliary' } +token category { 'infix' | 'prefix' | 'postfix' | 'circumfix' | 'postcircumfix' | 'trait_auxiliary' } ## used internally to convert p6 opnames to internal ones regex opname {