Re: Bug in qi::symbols::find

Francois Barel <[email protected]> Tue, 17 Nov 2009 09:30:39 +0100
Newsgroups gmane.comp.parsers.spirit.devel
Message-ID <[email protected]>
Daniel James wrote:
> I found a bug in symbol's find method that I 'fixed' earlier. I didn't
> realise that it needed to check that the whole symbol had been found,
> so it is matching symbols that start with the search string. I've
> checked a fix into trunk but this is too late for release. Sorry.
> Hopefully it's an obscure enough corner of the library that it
> shouldn't be too big a problem.

As far as I understand, the previous behavior was that
qi::symbols::find behaved like qi::parse: it returned a match when a
full symbol was found at the beginning of the input (but without
checking that the full input was matched). That means if you required
a full match, you had to check for begin == end yourself afterwards
(as for qi::parse).

This was brought up in
 http://thread.gmane.org/gmane.comp.parsers.spirit.general/15967

The drawback I see with your change is that users can no longer check
if an input string starts with a symbol (without using the full-blown
qi::parse API). Although I don't use that feature currently, I can
think of cases where it would be useful to have. So I think that if
find() keeps this new behavior of checking for a full match, we should
add a new method or overload, as suggested by Carl Barron in the
thread above, to keep the old behavior available.

Regards,
François

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july