[Gambas-devel] gb.pcre 0.0.4
Rob
sourceforge-raindog2 at ...19...
Tue Oct 5 17:07:50 CEST 2004
On Tuesday 05 October 2004 10:51, Benoit Minisini wrote:
> Good work, Rob.
> I suggest you the following interface:
> 1) Rename the class from 'Regex' to 'RegExp'.
OK, I only made it "Regex" because I can't physically say the
word "RegExp" ;)
> 2) Make a virtual class '.RegExpSubmatches' and make a
> property 'SubMatch' that returns it.
[...]
> This way, we could have the following syntax:
> MyRegExp = NEW RegExp("...", "...")
> PRINT MyRegExp.SubMatch[1].Text
Actually, with my existing code it's shorter:
MyRegExp = NEW RegEx("...", "...")
PRINT MyRegExp.SubMatch(1)
But I see the value of making it a virtual class. I almost did
that originally but I just wanted to get the code working. Is
there any way I can make a "default property" of a virtual class
such that
MyRegExp.Submatch[1]
returns the submatch text the same as MyRegExp.Submatch[1].Text,
but
MyRegExp.Submatch[1].Offset
would still work?
> If you are not easy with virtual classes, look at the ListBox
> code to see how it returns ListBox items.
Thank you, I certainly will be consulting the Qt component for
all this "virtual class within virtual class" stuff.
> As for a 'MATCH' keyword, this would need support from the
> interpreter, exactly like the Eval() subroutine. So I'm not
> sure I will do it now.
I don't see how you could do it anyway unless I made a static
version of the class. I have made a module (which i added to my
local copy of the IDE) to do a match or replace in 5 or 6
different ways anyway, so maybe once gambas code can be used in
components I can make a gb.pcre.match component or something.
Rob
More information about the Devel
mailing list