yylineno sometimes incorrect if noinput option set
flex 2.6.4 (via winflexbison)
if %option yylineno noinput is set, then yylineno sometimes reports incorrect values (sequentially increasing but offset by a random number). for any given full run of the scanner it is randomly correct or incorrect, depending on planetary alignment.
i believe it is because, afaict, when noinput is set there does not seem to be any code path that initializes yy_buffer_state::yy_bs_lineno to 0 during buffer setup. but i'm not sure because it was hard looking through unfamiliar code.
if it matters: i'm using yy_scan_string to set up the buffer and my full option set is:
%option noinput nounput noyywrap yylineno never-interactive batch warn
%option bison-bridge bison-locations reentrant
%option case-insensitive
workaround option 1: don't set noinput
workaround option 2: manually initialze yy_bs_lineno after creating a buffer e.g.:
YY_BUFFER_STATE yy = yy_scan_string(...);
yy->yy_bs_lineno = 0; /* or maybe it should be 1, i dunno. */
note: other yy_buffer_state members should probably be assessed for similar issues, yy_bs_column in particular.