[Jifty-commit] r1100 - jifty/trunk/lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Tue May 23 07:47:35 EDT 2006
Author: audreyt
Date: Tue May 23 07:47:34 2006
New Revision: 1100
Modified:
jifty/trunk/lib/Jifty/Dispatcher.pm
Log:
* Jifty::Dispatcher - Support for {alternation,syntax} in shellglobs.
Like [bracket] it's non-capturing.
Modified: jifty/trunk/lib/Jifty/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Dispatcher.pm (original)
+++ jifty/trunk/lib/Jifty/Dispatcher.pm Tue May 23 07:47:34 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