You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Nathaniel Alfred <Al...@swx.com> on 2006/09/20 10:39:11 UTC

Wildcard matcher matching wild things

The head of 2.1 contains a new WildcardMatcherHelper [1] to replace the
rather obscure WildcardHelper [2] implementation.  WMH is now used for
matching wildcard patterns in map:match.  

Although the code is a lot clearer than WH, it is still very complex
logic.  A number of bugs in the original WMH code have been fixed in the
meantime, but a few more seem to be lurking..

I recently fixed two bugs but now I am facing yet another one.  This
time it is a false positive where "*" matches what should be matched
only by "**".  Rather than submerging myself into the WMH code for
fixing it I am inclined to rewrite the stuff one more time.

Along the lines already discussed in  the thread following [1] I would
use the regexp library to do the heavy lifting.  Since map:match is the
most frequently executed pipeline instruction, speed is an issue.  That
can be mastered by a) caching the compiled regexps and b) handling the
simple pattern with a single * or ** as special cases without using
regexps.

At the same time regexps would also remove the known limitation that
"**/*/*" cannot match because "**" is over-greedy in the current WMH
implementation.

WDYT?

Cheers, Alfred.

[1] http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=115096562921641&w=2
[2] http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=114915395328845&w=2
 
 
This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please notify the sender urgently and then immediately delete the message and any copies of it from your system. Please also immediately destroy any hardcopies of the message. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. The sender's company reserves the right to monitor all e-mail communications through their networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of the sender's company.

Re: Wildcard matcher matching wild things

Posted by Reinhard Poetz <re...@apache.org>.
Nathaniel Alfred wrote:
> The head of 2.1 contains a new WildcardMatcherHelper [1] to replace the
> rather obscure WildcardHelper [2] implementation.  WMH is now used for
> matching wildcard patterns in map:match.  
> 
> Although the code is a lot clearer than WH, it is still very complex
> logic.  A number of bugs in the original WMH code have been fixed in the
> meantime, but a few more seem to be lurking..
> 
> I recently fixed two bugs but now I am facing yet another one.  This
> time it is a false positive where "*" matches what should be matched
> only by "**".  Rather than submerging myself into the WMH code for
> fixing it I am inclined to rewrite the stuff one more time.
> 
> Along the lines already discussed in  the thread following [1] I would
> use the regexp library to do the heavy lifting.  Since map:match is the
> most frequently executed pipeline instruction, speed is an issue.  That
> can be mastered by a) caching the compiled regexps and b) handling the
> simple pattern with a single * or ** as special cases without using
> regexps.
> 
> At the same time regexps would also remove the known limitation that
> "**/*/*" cannot match because "**" is over-greedy in the current WMH
> implementation.
> 
> WDYT?

As you and Bertrand said, speed and compatibility are very important. If your 
new implementation takes care of both and is proved by tests, I don't see a problem.

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

		
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

Re: Wildcard matcher matching wild things

Posted by Bertrand Delacretaz <bd...@apache.org>.
On 9/20/06, Nathaniel Alfred <Al...@swx.com> wrote:

> ...WDYT?..

Using the regexp library makes sense, but backwards compatiblity is
very important in this case, as subtle differences in matching might
break a lot of things in existing apps.

As long as test cases are plenty (I haven't checked), what you suggest
shouldn't be a problem.

-Bertrand

Re: Wildcard matcher matching wild things

Posted by Joerg Heinicke <jo...@gmx.de>.
On 20.09.2006 10:39, Nathaniel Alfred wrote:

> Since map:match is the
> most frequently executed pipeline instruction, speed is an issue.  That
> can be mastered by a) caching the compiled regexps and b) handling the
> simple pattern with a single * or ** as special cases without using
> regexps.

Just wondering, did you actually do some performance comparisons?

Regards,
Jörg