Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Character classes in Parrot

9 views
Skip to first unread message

Patrick R. Michaud

unread,
Nov 11, 2004, 9:24:56 AM11/11/04
to perl6-i...@perl.org
Does Parrot have anything available (yet?) for testing membership in
character classes-- things like isspace, isupper, islower, etc?
I searched around a bit in the docs, online references, and P6PE
and found very little about it.

How about for creating and manipulating character classes?

Apologies in advance if I've simply overlooked something.

Pm

Leopold Toetsch

unread,
Nov 12, 2004, 6:11:26 AM11/12/04
to Patrick R. Michaud, perl6-i...@perl.org
Patrick R. Michaud <pmic...@pobox.com> wrote:
> Does Parrot have anything available (yet?) for testing membership in
> character classes-- things like isspace, isupper, islower, etc?

RSN or when Dan's string stuff is merged.

> How about for creating and manipulating character classes?

There is an implementation of bit sets in imcc/sets.c. The old rx code
has some bitmap stuff in src/rx.c. But that's broken WRT memory leaks.
It uses a bitmap for chars < 256 and a linear string for anything bigger
- suboptimal.

So it's probably best to to create a BitSet PMC. That could use a bitset
for the "normal" range of the charset and an additional hash for other
values, which is searched only if it's there.

> Apologies in advance if I've simply overlooked something.

No problem, the source tree is huge.

> Pm

leo

Dan Sugalski

unread,
Nov 12, 2004, 8:18:34 AM11/12/04
to Patrick R. Michaud, perl6-i...@perl.org
At 7:24 AM -0700 11/11/04, Patrick R. Michaud wrote:
>Does Parrot have anything available (yet?) for testing membership in
>character classes-- things like isspace, isupper, islower, etc?
>I searched around a bit in the docs, online references, and P6PE
>and found very little about it.

Not yet. I've got some basic code in the new string branch to provide
a few checks (whitespace, alpha, number, and punctuation) but that's
it for now.

>How about for creating and manipulating character classes?

Nope, not yet. Character classes do need to be addressed, though,
since they're... interesting to handle.

--
Dan

--------------------------------------it's like this-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk

0 new messages