MetaCharacters as Literals in Lex

ant@hall.cray.com (Tony Jones)
Thu, 15 Feb 90 04:01:24 CST

          From comp.compilers

Related articles
MetaCharacters as Literals in Lex ant@hall.cray.com (1990-02-15)
| List of all articles for this month |
Date: Thu, 15 Feb 90 04:01:24 CST
From: ant@hall.cray.com (Tony Jones)

In Lex, how do I include the metacharacter '*' as a literal character in
the left hand side of a rule ?


I am trying to do the following ...
[a-zA-Z0-9/%_*]+ {
...
...
}


Adding the '*' increases %a's and %o's 10 times, and takes 1/2 an hour to
compile the generated 'C'.
Also, correct input such as '/usr/bin/*' fails to match the above rule,
examples such as '/usr/bin/bc' still match correctly


Can anybody tell me what I'm doing wrong (if anything), and point me in the
direction of a good fix.




Thanks
-- tony


Cray Research (UK), Ltd. +44 344 485971 x2177/2207
UUCP : (UK) ...!ukc!crayuk!ant (US) ...!cray!hall!ant
ARPA : (UK) ant@cray.co.uk (US) ant@hall.cray.com
UUNET: uunet!hall!ant
[Looks to me like you've found yet another lex bug; there is an example
in the SysV.3.2 programmer's guide that specifically says that stars in
character classes are supposed to work. You might try the faster and less
buggy flex instead. -John]





Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.