Hi,

while writing a preliminary p6explain, I wondered if the following
should work:
  my $text = "aBc";
  $text ~~ s/B/{ "C"|"D" }/;
  say $text.values; # aCc aDc

This would be extremely handy for p6explain, as I'm currently parsing a
datafile which looks like...
  +
    Standard mathematical infix operator.
  @infix_ops
    + - * /
  [EMAIL PROTECTED]
    Reduce metaoperator.
    Think of a join on the syntax level.

I could then do something like this:
  # $rule is '[EMAIL PROTECTED]'
  $rule ~~ s/[EMAIL PROTECTED]/{ any split " ", %rule{'@infix_ops'} }/;
  copy_contents_to $rule.values;


Comments?


--Ingo

-- 
Linux, the choice of a GNU | self-reference, n. - See self-reference  
generation on a dual AMD   | 
Athlon!                    |

Reply via email to