[Flex-help] flex internal error - end of buffer missed
flex is a tool for generating scanners
Brought to you by:
wlestes
|
From: Derek C. <der...@gm...> - 2012-12-18 17:33:45
|
Hello all,
I am getting the error about end of buffer missed when trying to parse a
buffer that is filled from a socket connection.
Do I need to manually append a \0 to the end of that buffer?
Some background on what I am doing:
I have threads that are recieving HTTP traffic. I am using lex to parse
some of the HTTP requests. This means I have multiple threads calling
yy_scan_bytes(&buf, buf_size);
yylex();
In my scanner, I have a this rule:
<<EOF>> {yyterminate(); yy_delete_buffer(YY_CURRENT_BUFFER);}
Is this the right approach? My understanding was that yy_scan_bytes made a
copy of the buffer, so I wanted a rule in my EOF to delete that copy. Do I
need to do anything else as part of the EOF rule?
Do I need a mutex around calls to yylex() since I am using this in a
threaded environment?
Thanks for answering my questions..I think I am sold on how lex works..its
bene pretty easy to get parsing the right things out of the input, ive just
run into a few small snags.
|