0

I have a simple lex file.

%{
#include <stdio.h>
%}

space_char      [ \t\^M]
space           {space_char}+ 

%%

%%

int yywrap(void) {
    return 1;
}

int main(void) {
    yylex();
    return 0;
}

When I compile this file with flex-2.5.35, it gives following errors: lex.l:5: bad character: lex.l:5: name defined twice

But, with flex-2.5.4, it runs fine. I understand this error is due to special character ctrl-m (carriage-return). I want to know if flex-2.5.35 doesn't support special characters like ctrl-l, ctrl-m? And if so, then what's the alternate way? Please note, I am restricted with the use of 2.5.35 only.

Thanks.

David Gorsline
  • 4,933
  • 12
  • 31
  • 36
Dharmendra
  • 384
  • 1
  • 5
  • 22

1 Answers1

0

As in C, you can use \r for the carriage return character.

rici
  • 234,347
  • 28
  • 237
  • 341