lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, 19 May 2010 05:31:49 -0700, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:

I see from the list archives that this is a pretty low-demand request,
but I could do with some way to access isprint and isgraph, in order
to test whether characters fall into that class.

The most consistent way with present practice would be to add regex
character classes for them. Looking at the current list in lstrlib.c,
the only functions not implemented are indeed isgraph and isprint (as
well as, correctly unimplemented, the obsolete isascii, and the C99
isblank).

So, could we have them, please? The strict definitions in the ISO C
standard are not as straightforward as isgraph == ispunct || isalnum
|| isspace, isprint == !iscntrl[0], and even if they were, we
programmers shouldn't have to work that out.

There is a huge problem here. OK, isgraph can be %g, but %p is already
taken (ispunct) ;)

Well, actually the strict definition in the ISO C standard for isgraph
is this:

The isgraph function tests for any printing character except space (' ').

So, if we add isgraph (as we have %g available), a printing class would
be [%g ] ;)

-- Roberto


Isn't isgraph just %C?