[Gambas-devel] Bug in the LIKE operator
Georg Brandl
g.brandl at ...78...
Tue Apr 6 17:49:57 CEST 2004
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
More information about the Devel
mailing list