🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Michael Henning Fri, 31 Mar 1989 06:35
lex bug ?
#1005
Author: Michael Henning
Date: Fri, 31 Mar 1989 06:35
47 lines
1653 bytes
I came across the following today. The problems show up both under AIX and
Xenix. Could anyone please enlighten me as to whether these are real bugs
or am I just overlooking something ?

Problem 1:

The following lex input file recognizes comments as a '*' at the beginning
of a line followed by any number of characters to the end of the line:

%%
^\*.*$	printf("comment: %s\n", yytext);

If the file is changed to

comment	^\*.*$
%%
{comment}	printf("comment: %s\n", yytext);

then comments are no longer recognised.


Problem 2:

The following lex input file is supposed to recognize empty lines.

{empty_line}	^$
%%
{empty_line}	printf("empty line\n");

The program compiles, but does not recognize empty lines. If the program
is changed to

%%
^$	printf("empty line\n");

then lex reports a syntax error on line 2.


Any help on these would be greatly appreciated, I have not used lex before,
and the documentation is somewhat terse in places...

					Michi.
-- 
               | The opinions expressed are my own, not those of my employer. |
               |                                                              |
               | Michael (Michi) Henning                                      |
               | - We have three Michaels here, that's why they call me Michi |
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads