[Gambas-devel] gb.pcre 0.0.4

Benoit Minisini gambas at ...1...
Tue Oct 5 16:51:04 CEST 2004


On Monday 04 October 2004 15:58, Rob wrote:
> This version adds SubMatchOffset() and makes all properties
> read-only.  I also threw in a readme file with a synopsis and
> pointer to instructions on building components.
>
> Rob

Good work, Rob.

I suggest you the following interface:

1) Rename the class from 'Regex' to 'RegExp'.

2) Make a virtual class '.RegExpSubmatches' and make a property 'SubMatch' 
that returns it.

3) '.RegExpSubmatches' will have only one method: '_get', and will return a 
virtual class '.RegExpSubmatch'.

4) The virtual class '.RegExpSubmatch' will have three properties:
- Text, that will act as the old method SubMatch(Index).
- Offset, that will act as the old method SubMatchOffset(Index).
- Count, that will act as the old method SubMatchCount(Index).

This way, we could have the following syntax:

MyRegExp = NEW RegExp("...", "...")

PRINT MyRegExp.SubMatch[1].Text
...

If you are not easy with virtual classes, look at the ListBox code to see how 
it returns ListBox items.

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.

Regards,

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




More information about the Devel mailing list