Skip to content

Commit

Permalink
Implement &[+] shortcut form for infix ops.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Apr 20, 2010
1 parent f162a26 commit 1f9b1dd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/Perl6/Actions.pm
Expand Up @@ -682,6 +682,9 @@ method variable($/) {
$past := $<postcircumfix>.ast;
$past.unshift( PAST::Var.new( :name('$/') ) );
}
elsif $<infixish> {
$past := PAST::Op.new( :pirop('find_sub_not_null__Ps'), '&infix:<' ~ $<infixish>.Str ~ '>' );
}
else {
$past := make_variable($/, ~$/);
}
Expand Down
16 changes: 11 additions & 5 deletions src/Perl6/Grammar.pm
Expand Up @@ -728,11 +728,17 @@ token variable {
}
}> {}
[
| <sigil> <twigil>? <desigilname>
| <special_variable>
| <sigil> $<index>=[\d+]
| <sigil> <?[<[]> <postcircumfix>
| $<sigil>=['$'] $<desigilname>=[<[/_!]>]
|| '&'
[
| '[' ~ ']' <infixish>
]
|| [
| <sigil> <twigil>? <desigilname>
| <special_variable>
| <sigil> $<index>=[\d+]
| <sigil> <?[<[]> <postcircumfix>
| $<sigil>=['$'] $<desigilname>=[<[/_!]>]
]
]
[ <?{ $<twigil> && $<twigil>[0] eq '.' }>
[ <.unsp> | '\\' | <?> ] <?before '('> <arglist=.postcircumfix>
Expand Down

0 comments on commit 1f9b1dd

Please sign in to comment.