Skip to content

Commit

Permalink
give modern advice on \p and \P
Browse files Browse the repository at this point in the history
  • Loading branch information
TimToady committed Mar 5, 2012
1 parent 292f669 commit 1ad3292
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions STD.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -5054,11 +5054,11 @@ grammar Regex is STD {
:my $m;
:my $p;
<sym=[pP]>
{ $s = $<sym>.Str; $m = $s lt 'a' ?? '-' !! '+'; }
{ $s = $<sym>.Str; $m = $s lt 'a' ?? '-' !! ''; }
[
|| (\w) { $p = $0.Str; $¢.obs("\\$s$p", '<' ~ $m ~ "is$p>"); }
|| '{' $<param>=[\w+] '}' { $p = $<param>.Str; $¢.obs("\\$s\{$p\}", '<' ~ $m ~ "is$p>"); }
|| '{' $<param>=[\w+] \= $<val>=[<-[\}]>*] '}' { $p = $<param>.Str; my $v = $<val>.Str; $¢.obs("\\$s\{$p=$v\}", '<' ~ $m ~ "is$p\('$v')>"); }
|| (\w) { $p = $0.Str; $¢.obs("\\$s$p", '<' ~ $m ~ ":$p>"); }
|| '{' $<param>=[\w+] '}' { $p = $<param>.Str; $¢.obs("\\$s\{$p\}", '<' ~ $m ~ ":$p>"); }
|| '{' $<param>=[\w+] \= $<val>=[<-[\}]>*] '}' { $p = $<param>.Str; my $v = $<val>.Str; $¢.obs("\\$s\{$p=$v\}", '<' ~ $m ~ ":$p\('$v')>"); }
]
}
token backslash:Q { <sym> <.obs('\\Q as quotemeta', 'quotes or literal variable match')> }
Expand Down

0 comments on commit 1ad3292

Please sign in to comment.