diff -r 64a4504633d4 -r a4f4990d5c66 stage1_2/iec.flex --- a/stage1_2/iec.flex Tue Apr 05 19:42:33 2011 +0100 +++ b/stage1_2/iec.flex Thu Apr 14 17:35:25 2011 +0100 @@ -184,11 +184,13 @@ * back to the bison parser... */ #define YY_USER_ACTION {\ - yylloc.first_line = current_tracking->lineNumber;\ - yylloc.first_column = current_tracking->currentTokenStart;\ - yylloc.last_line = current_tracking->lineNumber;\ - yylloc.last_column = current_tracking->currentChar - 1;\ - current_tracking->currentTokenStart = current_tracking->currentChar;\ + yylloc.first_line = current_tracking->lineNumber;\ + yylloc.first_column = current_tracking->currentTokenStart;\ + yylloc.first_file = current_filename;\ + yylloc.last_line = current_tracking->lineNumber;\ + yylloc.last_column = current_tracking->currentChar - 1;\ + yylloc.last_file = current_filename;\ + current_tracking->currentTokenStart = current_tracking->currentChar;\ } @@ -858,7 +860,13 @@ * the first one (i.e. the one that gets stored in include_stack[0], * which is never free'd! */ - free((char *)current_filename); + /* NOTE: We do __NOT__ free the malloc()'d memory since + * pointers to this filename will be kept by many objects + * in the abstract syntax tree. + * This will later be used to provide correct error + * messages during semantic analysis (stage 3) + */ + /* free((char *)current_filename); */ current_filename = include_stack[include_stack_ptr].filename; yy_push_state(include_end); }