Permalink
Browse files

Implement s[].=flip form (fixes #112)

  • Loading branch information...
sorear committed May 21, 2012
1 parent eacfab8 commit a5f35dcb76f5826da427d2f0bee3a4ec4bd0a64f
Showing with 7 additions and 2 deletions.
  1. +3 −0 src/NieczaActions.pm6
  2. +4 −2 src/STD.pm6
View
@@ -2544,6 +2544,9 @@ method sibble($/) {
$repl = $<infixish>.ast.base.with_args($/,
mkcall($/, '&prefix:<~>', $OpLexical.new(name => '$/')),
$<right>.ast);
+ } elsif $<infixish>.ast ~~ $Operator_DotEq {
+ $repl = $<right>.ast.with_args($/,
+ mkcall($/, '&prefix:<~>', $OpLexical.new(name => '$/')));
} else {
$/.CURSOR.sorry("Unhandled operator in substitution");
$repl = mklex($/, 'Any');
View
@@ -2480,9 +2480,11 @@ grammar P6 is STD {
<.ws>
[ <?[ \[ \{ \( \< ]> <.obs('brackets around replacement', 'assignment syntax')> ]?
[ <infixish> || <panic: "Missing assignment operator"> ]
- [ <?{ $<infixish>.Str eq '=' || $<infixish>.<assign_meta_operator> }> || <.panic: "Malformed assignment operator"> ]
+ [ <?{ $<infixish>.Str eq ('=' | '.=') || $<infixish>.<assign_meta_operator> }> || <.panic: "Malformed assignment operator"> ]
<.ws>
- <right=EXPR(item %item_assignment)>
+ [ <?{ $<infixish> eq '.=' }> ::> <right=.dottyopish>
+ || <right=EXPR(item %item_assignment)>
+ ]
||
{ $lang = $lang2.unbalanced($stop); }
<right=.nibble($lang)> $stop || <.panic: "Malformed replacement part; couldn't find final $stop">

0 comments on commit a5f35dc

Please sign in to comment.