[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: Receiving fatal flex scanner error

Hi All,


To add more,


I have debugged this more, the problem come because during yylex END_OF_BUFFER is handled differently where a BUFFER_NEW is checked and some global are changed. But, in yyinput there is no such specific handling.


Also, what is happening is that:

From yyinput, yywrap gets called it changes the buffer state to BUFFER_NEW but copying characters from yytext till yy_c_buf_p at start of buffer, yy_n_chars global is total number of characters in buffer but yy_n_chars of buffer struct is kept to number of character read from file. Now, at next yy_get_next_buffer called from another yyinput call these global change in similar way. Now at the END_OF_BUFFER case in yylex, the global get changed due to buffer state being BUFFER_NEW. These changed globals are causing fatal error.


Kindly, somebody please provide some inputs.


Thanks & Regards,

Harpreet Singh


From: Harpreet Singh Anand
Sent: Tuesday, August 09, 2011 2:57 PM
To: 'debian-user@lists.debian.org'
Subject: Receiving fatal flex scanner error


Hi All,


I have been using flex (2.5.4-version) for lexical analysis of some files.


For a set of file I am getting following error:


“fatal flex scanner internal error--end of buffer missed”


I have also check the same with 2.5.35 version. It also flags same error.


Is anyone aware of such bug being fixed in any patch.



I have also attached the small lex file and fileset causing the problem.


flex app.l

g++ lex.yy.c

./a.out file1 file2


Intent of Lex file:

It is a simple lex file having simple patterns. There is just a special handling for single line c-style comments “//”. Upon matching “//” I am eating up all characters till newline or file change using yyinput.


Input file set:

File1: last line contains a comment not containing “\n” character.

File2: Has very big comment


Thanks & Regards,

Harpreet Singh



NOTE: This message and its attachments are intended only for the individual or 
entity to which it is addressed and may contain confidential information or 
forward-looking statements regarding product development.  Forward-looking 
statements are subject to change at Atrenta's sole discretion and Atrenta will have 
no liability for the delay or failure to deliver any product or feature mentioned in 
such forward-looking statements.

Reply to: