michi@anvil.oz (Michael Henning) (03/31/89)
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 |