Flex yylineno set to 1

后端 未结 1 346
小鲜肉
小鲜肉 2020-12-19 05:19

I\'m writing a simple parser for tcpdump logs, could you please tell me why I can\'t get proper line number?

%{
char str[80];
%}
%option yylineno

...
%%

^{         


        
相关标签:
1条回答
  • 2020-12-19 05:32

    When I tried this, it turned out that I had to have a rule that actually matches newline for yylineno to be updated. With the following rule it worked, and without it yylineno never changed:

    \n { }
    
    0 讨论(0)
提交回复
热议问题