[Gambas-devel] Bug in the LIKE operator

Benoit Minisini gambas at ...1...
Fri Apr 9 22:31:40 CEST 2004


On Tuesday 06 April 2004 17:49, Georg Brandl wrote:
> Hello brave developers of my favourite BASIC language,
>
> I've most probably found a bug in the Gambas LIKE operator.
>
> Regular expressions of the form "[xyz]" always result in an "Missing
> brace" error. I've looked at the source code, and I think I isolated the
> problem.
>
> Here is my diff:
>
> --- gbx_regexp.c.bk	2004-04-06 17:09:33.935987720 +0200
> +++ gbx_regexp.c	2004-04-06 17:05:48.984185592 +0200
> @@ -161,10 +161,10 @@
>
>        for(;;)
>        {
> -        if (len_pattern == 0)
> -          THROW(E_REGEXP, "Brace missing");
>          if (cp == ']')
>            break;
> +        if (len_pattern == 0)
> +          THROW(E_REGEXP, "Brace missing");
>          _next_pattern();
>        }
>
> The problem is that when the ] brace, which is the last character of the
> pattern, is in cp, len_pattern is already zero, so the exception is
> thrown before the check for the brace is executed.
>
> I hope I described the problem properly.
>
> Thank you,
>
> Georg Brandl
>
>

Thank you very much for your patch. I will include it in the next version.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the Devel mailing list