[Jifty-commit] r1101 - in jifty/branches/jifty-jsan: .
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Tue May 23 10:49:46 EDT 2006
Author: jesse
Date: Tue May 23 10:49:44 2006
New Revision: 1101
Modified:
jifty/branches/jifty-jsan/ (props changed)
jifty/branches/jifty-jsan/lib/Jifty/Dispatcher.pm
Log:
r13990 at hualien (orig r1100): audreyt | 2006-05-23 07:47:34 -0400
* Jifty::Dispatcher - Support for {alternation,syntax} in shellglobs.
Like [bracket] it's non-capturing.
Modified: jifty/branches/jifty-jsan/lib/Jifty/Dispatcher.pm
==============================================================================
--- jifty/branches/jifty-jsan/lib/Jifty/Dispatcher.pm (original)
+++ jifty/branches/jifty-jsan/lib/Jifty/Dispatcher.pm Tue May 23 10:49:44 2006
@@ -943,8 +943,9 @@
Private function.
-Turns a metaexpression containing *, ? into a capturing perl regex pattern.
-Also supports the noncapturing [] notation.
+Turns a metaexpression containing C<*> and C<?> into a capturing regex pattern.
+
+Also supports the non-capturing C<[]> and C<{}> notation.
The rules are:
@@ -977,7 +978,11 @@
=item *
-Character classes C<[a-z]> denote character classes; they are not captured.
+Brackets such as C<[a-z]> denote character classes; they are not captured.
+
+=item *
+
+Braces such as C<{xxx,yyy}]> denote alternations; they are not captured.
=back
@@ -1008,6 +1013,8 @@
(
\\ \[ # opening
(?: # one or more characters:
+ \\ \\ \\ \] # ...escaped closing bracket
+ |
\\ [^\]] # ...escaped (but not the closing bracket)
|
[^\\] # ...normal
@@ -1015,6 +1022,20 @@
\\ \] # closing
)
}{$self->_unescape($1)}egx;
+ $glob =~ s{
+ # Braces denote alternations
+ (
+ \\ \{ # opening
+ (?: # one or more characters:
+ \\ \\ \\ \} # ...escaped closing brace
+ |
+ \\ [^\}] # ...escaped (but not the closing brace)
+ |
+ [^\\] # ...normal
+ )+
+ \\ \} # closing
+ )
+ }{'(?:'.join('|', split(/,/, $1)).')'}egx;
$glob;
}
More information about the Jifty-commit
mailing list