Re: YYLess equivalent in JLex

Gerwin Klein <lsf@gmx.net>
27 Jun 1999 00:00:54 -0400

          From comp.compilers

Related articles
YYLess equivalent in JLex binesh@hex21.com (Binesh Bannerjee) (1999-06-12)
Re: YYLess equivalent in JLex lsf@gmx.net (Gerwin Klein) (1999-06-14)
Re: YYLess equivalent in JLex binesh@hex21.com (Binesh Bannerjee) (1999-06-19)
Re: YYLess equivalent in JLex lsf@gmx.net (Gerwin Klein) (1999-06-27)
| List of all articles for this month |
From: Gerwin Klein <lsf@gmx.net>
Newsgroups: comp.compilers
Date: 27 Jun 1999 00:00:54 -0400
Organization: Technische Universitaet Muenchen, Germany
References: 99-06-046 99-06-061 99-06-077
Keywords: lex, Java

Binesh Bannerjee wrote:
> JFlex seems to choke on %unicode or %full... Which isn't too encouraging...
> %7bit seems to work fine... What am I doing wrong? [..]


Nothing wrong with what you're doing. It's a bug, JFlex screws up
completely on this. I've reproduced it, and it's something in the
character-class code. There is a simple workaround though: just place
the the %full or %unicode switches before any macro declarations - it
will work then.


So instead of


%%
identifier=([a-zA-Z_][a-zA-Z0-9_]*)
digits=([0-9]+)
whitespace=([\ \t\r\n\f]+)
%class JFlexScanner
%integer
%full
%%


write


%%
%class JFlexScanner
%integer
%full
identifier=([a-zA-Z_][a-zA-Z0-9_]*)
digits=([0-9]+)
whitespace=([\ \t\r\n\f]+)
%%


I checked my tests, and all of them use this second style of "first
switches, then macros". That's why this bug slipped through. It's
another of those implicit assumptions. Bad thing for a test suite ;-)


BTW: the next release is due next week. It will be fixed then..


Regards,
Gerwin


Post a followup to this message

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