flex: doubt regarding the meaning of some character classes
by Rui Maciel » Tue, 21 Oct 2008 06:02:20 GMT
After browsing the flex manual I've stumbled on the patterns section
where it is said that patterns can be expressed with the help of
character class expressions. The patterns are as follows:
[:alnum:] [:alpha:] [:blank:]
[:cntrl:] [:digit:] [:graph:]
[:lower:] [:print:] [:punct:]
[:space:] [:upper:] [:xdigit:]
Some of those patterns appear to be straight forward but I don't have a
clue regarding the exact meaning of a whole bunch of them. To make
matters worse, it appears that there is absolutely no information
covering that, not only in the flex manual but also anywhere.
So, could anyone please post the meaning of those character classes?
Thanks in advance
Rui Maciel
Re: flex: doubt regarding the meaning of some character classes
by Martien Verbruggen » Tue, 21 Oct 2008 07:37:39 GMT
On 19 Oct 2008 21:02:20 GMT,
The POSIX character classes all correspond to functions of the same name
with 'is' prepended. So, the character class [:isdigit:] has a
corresponding C function isdigit(), which you can look up for the
definition.
Martien
--
|
Martien Verbruggen |
| Curiouser and curiouser, said Alice.
|
Re: flex: doubt regarding the meaning of some character classes
by James Kanze » Tue, 21 Oct 2008 18:04:42 GMT
On Oct 20, 12:37 am, Martien Verbruggen < XXXX@XXXXX.COM >
Which doesn't really answer much. The C functions are locale
dependent; is this also true of the flex character classes? And
if so, which locale: the one when flex is run, or the one when
the generated program is run? (I can make some guesses, but
this is the sort of thing which absolutely must be documented
for any serious program.)
James Kanze (GABI Software) email: XXXX@XXXXX.COM
Conseils en informatique orient objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sard, 78210 St.-Cyr-l'ole, France, +33 (0)1 30 23 00 34
Re: flex: doubt regarding the meaning of some character classes
by Robert Harris » Tue, 21 Oct 2008 19:42:34 GMT
The flex info manual (that accompanies the distribution) is, I believe,
completely clear about it (the flex character classes are locale
dependent and depend on the locale in which flex is run) - see the
chapter entitled "Patterns".
Robert
Re: flex: doubt regarding the meaning of some character classes
by dickey » Tue, 21 Oct 2008 23:56:54 GMT
It seems to say that, but when I look at the generated code, it has only
a table for POSIX codes.
--
Thomas E.{*filter*}ey
http://www.**--****.com/
ftp://invisible-island.net
Re: flex: doubt regarding the meaning of some character classes
by Rui Maciel » Thu, 23 Oct 2008 18:37:03 GMT
Thanks, Martien! Knowing that those character classes were defined in the
POSIX standards did the trick. After a quick search I even stumbled on
the following wikipedia article:
http://www.**--****.com/ #POSIX_character_classes
It has a nifty table that lists both the expanded regex expression and
the general description of that pattern.
Once again thanks, Martien. Kudos!
Rui Maciel
Re: flex: doubt regarding the meaning of some character classes
by James Kanze » Fri, 24 Oct 2008 18:48:00 GMT
On Oct 20, 12:42 pm, Robert Harris < XXXX@XXXXX.COM >
Yes. That makes sense, but it does mean that if you deliver
flex source code, you need to warn your users about this,
possibly specifying that they must use the correct locale (or
setting it in your makefile).
On the other hand, the isxxx functions aren't really of much use
today, now that everything is UTF-8. Not sure how flex handles
this issue, however.
James Kanze (GABI Software) email: XXXX@XXXXX.COM
Conseils en informatique orient objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sard, 78210 St.-Cyr-l'ole, France, +33 (0)1 30 23 00 34
Re: flex: doubt regarding the meaning of some character classes
by James Kanze » Fri, 24 Oct 2008 18:49:38 GMT
On Oct 20, 4:56 pm, XXXX@XXXXX.COM (Thomas E.{*filter*}ey)
So you ran flex in the POSIX locale. The manual is actually
very precise about this, presenting it as a warning.
James Kanze (GABI Software) email: XXXX@XXXXX.COM
Conseils en informatique orient objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sard, 78210 St.-Cyr-l'ole, France, +33 (0)1 30 23 00 34
Re: flex: doubt regarding the meaning of some character classes
by dickey » Sat, 25 Oct 2008 00:29:20 GMT
Perhaps you can quote the relevant paragraph, so we can agree on what it says.
--
Thomas E.{*filter*}ey
http://www.**--****.com/
ftp://invisible-island.net
Re: flex: doubt regarding the meaning of some character classes
by dickey » Sat, 25 Oct 2008 00:42:33 GMT
hmm - "info", from "new" flex (new bugs, no improvements ;-).
I hadn't looked closely at the documentation, see that it does put
that in the "info" file. Perhaps someone will improve that aspect,
sometime.
--
Thomas E.{*filter*}ey
http://www.**--****.com/
ftp://invisible-island.net
Re: flex: doubt regarding the meaning of some character classes
by James Kanze » Sat, 25 Oct 2008 17:21:20 GMT
On Oct 23, 5:29 pm, XXXX@XXXXX.COM (Thomas E.{*filter*}ey)
A word of caution. Character classes are expanded
immediately when seen in the flex input. This means the
character classes are sensitive to the locale in which
flex is executed, and the resulting scanner will not be
sensitive to the runtime locale. This may or may not be
desirable.
Exactly where Robert said I'd find it, in the section on
Patterns. Immediately after the presentation of [:...:].
James Kanze (GABI Software) email: XXXX@XXXXX.COM
Conseils en informatique orient objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sard, 78210 St.-Cyr-l'ole, France, +33 (0)1 30 23 00 34
Re: flex: doubt regarding the meaning of some character classes
by dickey » Sun, 26 Oct 2008 07:13:05 GMT
....
However - back to my comment (documentation is one thing, reality
another).
The note in (flex "2.5.35" for the sake of discussion) does not
correspond to
what I'm seeing. A simple lex with just this pattern
WORD [[:alpha:]]([[:alnum:]])*
produces the same file whether my current locale is "C" or "en_US" or
"fr_FR".
The relevant information for character classes appears to be in a
table
beginning
static yyconst flex_int32_t yy_ec[256] =
(The same observation applies to "2.5.4a").
Thomas E.{*filter*}ey < XXXX@XXXXX.COM >
http://www.**--****.com/
ftp://invisible-island.net
Re: flex: doubt regarding the meaning of some character classes
by James Kanze » Mon, 27 Oct 2008 19:08:32 GMT
> produces the same file whether my current locale is "C">or
> "en_US" or "fr_FR".
I'd rank that as a bug then.
James Kanze (GABI Software) email: XXXX@XXXXX.COM
Conseils en informatique orient objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sard, 78210 St.-Cyr-l'ole, France, +33 (0)1 30 23 00 34
Re: flex: doubt regarding the meaning of some character classes
by dickey » Sat, 22 Nov 2008 10:36:46 GMT
I agree (and it would be nice to say that I reported it to the developers,
but having tried to do so with _these_ particular developers before,
I'm not inclined to do that again).
It's a trivial thing to find/fix (and it's not possible that it could
have worked as documented in flex 2.5.35 - perhaps it'll be fixed in
2.5.36, assuming that the developers read this newsgroup).
Since it's related to some work I've been contemplating for vile,
I did the fix to "old flex", and made that available here:
http://www.**--****.com/
(it's the change related to "isascii" ;-)
--
Thomas E.{*filter*}ey
http://www.**--****.com/
ftp://invisible-island.net
Similar Threads:
1.Doubt regarding Flash Banner
Hi all,
I have a flash banner with me, when i insert the banner into a web
site that should exactly fit to the screen,
I mean if the user watches the banner in 800 x 600 resolution then it
should display as 800 X 600 and if the
user is watching it in 1280 X 1024 pixels then the banner should
exactly fit the screen resolution
If any one knows about this please send me a mail .....
Thanks & Regards
vamsi
2.Doubt regarding eventObject.target
Hi All,
I am a newbie to flash. I downloaded a flash file from a website and
checked the code of it using a decompiler and i was not able to understand the
attached code. Someone please help me in understanding the purpose of it.
The onLoadComplete method is invoked when the loading of the SWF are complete,
but after that nothing happens.
So, i doubt the evenObject.target.onAnimDone... Am not sure what this code
does...
Somebody please help.
Thanks in advance,
Prabakaran Srinivasan.
_loc1.onLoadComplete = function (eventObject)
{
var parent = this;
eventObject.target.onAnimDone = function (clip)
{
parent.onAnimDone(clip);
};
}
3.Doubt regarding fetching the values popped of the stack for a getURL2 Call
Hi All,
Is there any ways to get the popped values (url and target) from the stack which had been popped off during the getURL2 Call?
4.Regarding "cli" and "sti" doubt
In my driver program I use "cli" to disable all the interrupts.
After calling "cli" I am not calling "sti". I was expecting all the
interrupts will be disabled ("Key board, mouse should not work"). But
all the devices are able to work!!!
what may be the reason.
Thanks in advance,
Navaneetham
5.doubt regarding bzImage file
Hi,
i have a bzImage file.(this i compiled sometimes ago). Is it possible
to extract conf file which i used for getting this particular bzImage
file.
kernel version: 2.4.20-8
Linux distribution : Redhat 9.0
ThankX in advance
6. doubt regarding Cisco Certification Exams?
7. doubt regarding .tgz
8. [ot] doubt regarding .tgz