Open up lex.l and scroll down to the defs of yycharno (well, they're on the first screeful, whatever). Do what happens in the lex input macro in the flex YY_INPUT macro. Init things like yylinestartpos in YY_USER_INIT macro. Specifically, init each of the following: yycharno yycharpos yycharposnnl yylinestartpos yyprevlinestartpos yyfilename inAttribute inParts See what fur flies. Presumably there are some lex-specific functions further down that may need to be tweaked.