Re: lex rules

Esmond Pitt <>
1 Dec 2000 13:36:36 -0500

          From comp.compilers

Related articles
lex rules (Blake Stone) (2000-11-30)
Re: lex rules (2000-12-01)
Re: lex rules (Esmond Pitt) (2000-12-01)
| List of all articles for this month |

From: Esmond Pitt <>
Newsgroups: comp.compilers
Date: 1 Dec 2000 13:36:36 -0500
Organization: Melbourne Software Company Pty Ltd
References: 00-11-176
Keywords: lex
Posted-Date: 01 Dec 2000 13:36:36 EST

Are you using lex or flex?

lex has a bug that things inside {} are not treated as single units.

e.g. your {EncName} is not treated as ([A-Za-z][A-Za-z0-9._]*) but as

This gets tricky if you have constructions like {name}? &c, the ? only
applies to the last part of the thing expanded, not the whole.

This was fixed in flex at my request in about 1991. You should use flex
anyway, it's miles better. If you can't, and if this is your problem,
change all your name definitions to be inside brackets, e.g.

ws ([ \t\r\n]+)

Esmond Pitt
[This turned out indeed to be the problem - private communication with
original poster - EJP.]

Post a followup to this message

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