Skip to content

Commit

Permalink
Make use of \$ \% \@ \& \\d a worry
Browse files Browse the repository at this point in the history
Inspired by discussion started at
  http://irclog.perlgeek.de/perl6/2015-07-05#i_10852425
ShimmerFairy++ geekosaur++ BenGoldberg++ timotimo++
  • Loading branch information
lizmat committed Jul 6, 2015
1 parent 365a1a6 commit e3d6b7d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/Perl6/Grammar.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -2575,12 +2575,9 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
'\\'
[
| '(' <semiarglist> ')'
| <?before \S> <termish> {
my $sgl := nqp::substr(~$<termish>,0,1);
if $sgl eq '$' || $sgl eq '@' || $sgl eq '%' || $sgl eq '&' {
$/.CURSOR.typed_panic('X::Syntax::P5');
}
}
| <?before '$' | '@' | '%' | '&'> <.worry("To pass an array, hash or sub to a function in Perl 6, just pass it as is. For other uses of Perl 5's ref operator consider binding with ::= instead. Parenthesize as \\(...) if you intended a capture of a single variable.")> <termish>
| <?before \d> <.worry("To refer to a positional match capture, just use $0 (numbering starts at 0). Parenthesize as \\(...) if you intended a capture of a single numeric value.")> <termish>
| <?before \S> <termish>
| {} <.panic: "You can't backslash that">
]
}
Expand Down

0 comments on commit e3d6b7d

Please sign in to comment.