[augeas-devel] Weird print result with Perl bindings on amd64

David Lutterkort lutter at redhat.com
Fri Jan 16 21:07:29 UTC 2009


On Fri, 2009-01-16 at 21:35 +0100, Dominique Dumont wrote:
> David Lutterkort <lutter at redhat.com> writes:
> 
> >> I wonder why you apply the '-' operator to the regexes ?  (instead of
> >> applying the '-' operator on the *results* of the the regexes)
> >
> > I don't understand what you mean. Can you give an example ?
> 
> Currently, '-' is applied to regex, the end result is a very complex
> regular expression.
> 
> I was thinking about delaying the computation of '-' until you have
> the actual string to test.
> 
> In other words, when you parse the file (or when you parse to tree to
> write the file back), you would evaluate the lens in 2 separate regex
> evaluations. In Perl notation, this would be like:
> 
>   $string =~ /[A-Za-z0-9]+/ and not  $string =~ /Match/ 
> 
> Is that possible ?

It would become very complex very quickly since the 're1 - re2'
construct can be part of a more complicated expression involving regexps
(e.g. 're1 . ((re2 - re3) | re4)*' etc.)

Since the computation of the '-' isn't the culprit at all for the bug
you ran into, it wouldn't really buy us anything - this or a similar
regexp might just as well have been entered by the user.

At issue is that the meaning of /[A-Z]/ changes depending on the user's
locale, though for lenses we always want that interpreted
as /[ABCD..XYZ]/, i.e. in the C locale.

David





More information about the augeas-devel mailing list