Re: flex default rule

John Millaway <johnmillaway@yahoo.com>
3 Apr 2006 01:39:51 -0400

          From comp.compilers

Related articles
flex default rule dmaziuk@bmrb.wisc.edu (Dimitri Maziuk) (2006-04-01)
Re: flex default rule johnmillaway@yahoo.com (John Millaway) (2006-04-03)
Re: flex default rule dmaziuk@bmrb.wisc.edu (Dimitri Maziuk) (2006-04-03)
Re: flex default rule cdodd@acm.org (Chris Dodd) (2006-04-03)
Re: flex default rule dmaziuk@bmrb.wisc.edu (Dimitri Maziuk) (2006-04-08)
| List of all articles for this month |

From: John Millaway <johnmillaway@yahoo.com>
Newsgroups: comp.compilers
Date: 3 Apr 2006 01:39:51 -0400
Organization: Compilers Central
References: 06-04-001
Keywords: lex
Posted-Date: 03 Apr 2006 01:39:51 EDT

Hi, Named rules like "{SEMI}" are not expanded inside character classes. The
problem is in these lines:


> SEMI ^;
> %%
> <INITIAL>[^{SEMI}]


Note that the ^ in SEMI means beginning of line. The ^ in [^] means character
class complement. So, it's not clear what you're trying to match. Anything
but a semi-colon?


        [^;]


Anything but a semi-colon preceeded by a newline?


        [^\n]|\n[^;]


A newline followed by anything but a semicolon?


      ^[^;]




Or is your input always delimited by \n; ? Then just match on


      \n; BEGIN(YYSEMI);


without trying to account for all possible newline types or [\n;] combos.


-Millaway


Post a followup to this message

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