[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Flex character classes
From: |
Markus Schöpflin |
Subject: |
Flex character classes |
Date: |
Wed, 29 May 2002 11:29:23 +0200 |
Hi there,
recently I was trying to write a scanner for the HTTP protocol
with flex and I encountered some problems when specifying
character classes.
For example, RFC 2616 tells me, that TEXT is defined as "<any
OCTET except CTLs, but including LWS>.
What I tried was the following:
OCTET [\x00-\xff]
CTL [\x00-\x1f\x7f]
CR \x0d
LF \x0a
CRLF {CR}{LF}
LWS {CRLF}({SP}|{HT})+
And now for TEXT:
TEXT [^{CTL}]|{LWS}
This works as OCTET includes any charater and therefore the
set difference of OCTET minus CTL can be expressed as [^{CTL}].
But later on you have a defition of "qdtext" which is "<any
TEXT except <">>".
How do I specify this with flex? Is there anything like a set
difference operator for character classes? For example:
qdtext (({OCTET}\{CTL})\["])|{LWS}
Thanks, Markus
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Flex character classes,
Markus Schöpflin <=