Skip to content

Commit

Permalink
Add support for defining circumfix operators.
Browse files Browse the repository at this point in the history
  • Loading branch information
tene committed May 15, 2009
1 parent 271bbd0 commit 8ff0e0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/parser/actions.pm
Expand Up @@ -3120,6 +3120,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:' }
my $past := PAST::Op.new( :name('newtok'), :pasttype('callmethod'),
PAST::Op.new(
:inline(" %r = get_hll_global ['Perl6';'Grammar'], '$optable'")
Expand Down
8 changes: 4 additions & 4 deletions src/parser/grammar.pg
Expand Up @@ -873,14 +873,14 @@ token subshortname {
<category> <colonpair>+
}

token category { 'infix' | 'prefix' | 'postfix' | 'trait_auxiliary' }
token category { 'infix' | 'prefix' | 'postfix' | 'circumfix' | 'trait_auxiliary' }

## used internally to convert p6 opnames to internal ones
regex opname {
<category> ':'
[ '<<' \s* [ (\S+) \s* ] '>>'
| '«' \s* [ (\S+) \s* ] '»'
| '<' \s* [ (\S+) \s* ] '>'
[ '<<' \s* [ ([\S+]**[\s+]) \s* ] '>>'
| '«' \s* [ ([\S+]**[\s+]) \s* ] '»'
| '<' \s* [ ([\S+]**[\s+]) \s* ] '>'
]
}

Expand Down

0 comments on commit 8ff0e0a

Please sign in to comment.