[Gambas-user] pcre component 0.0.3 - working
Rob
sourceforge-raindog2 at ...94...
Fri Oct 1 18:00:42 CEST 2004
On Friday 01 October 2004 09:59, Nelson Ferraz wrote:
> How difficult would it be to integrate the regexps into the
> language itself? Something like (given MyStr = "quick brown
> fox"):
> IF MyStr MATCH "fox" THEN ...
> Or even:
> IF MyStr LIKE "fox" THEN ...
> In this case, we'd be overriding a Gambas keyword.
I haven't the faintest idea, but (a) Benoit alluded to doing this
eventually and (b) I think there may be hooks in the API for
it.... My C is still a bit rusty but it's all coming back to me
;) It would replace 3 lines of code (DIM, then NEW, then
checking the offset) with 1, but for most of my uses I need
access to the submatches so I'd still have to explicitly create
an object.
I've decided it would also be cool to make available the offsets
for each submatch (I don't even know how to get at those in
perl!) so I'll probably add that, and of course all the
properties need to be read-only, so there'll be at least one
more version before I'm done with it. I'd also like to write a
Replace method that would be sort of like the s/from/to/g in
perl, except returning a value rather than operating on the
buffer directly. (But I'm about to go away for the weekend, so
I dunno if I'll do anything with it for a couple days.)
Next up after this is a POSIX component just to keep my skills
fresh ;) I haven't come up with too many other easily wrapped
libs that I actually need yet, but I have wanted a few of the
POSIX functions at times.
I wonder if it would be possible to write something that would
dlopen an arbitrary shared library and allow access to its
functions using a mechanism like VB's "Declare" statement.
Sadly, that's probably beyond my skill level right now and the
SEGV'ing would be rampant.
Rob
More information about the User
mailing list