# HG changeset patch # User mario # Date 1193947118 -3600 # Node ID ec7799ec929b22b0096c94df1ce4483c74191ca9 # Parent 0e381bdb8888948a933e76e13545e6226e793cac fixing include bug (only ocured for includes in main program file). diff -r 0e381bdb8888 -r ec7799ec929b stage1_2/iec.flex --- a/stage1_2/iec.flex Thu Nov 01 09:42:33 2007 +0100 +++ b/stage1_2/iec.flex Thu Nov 01 20:58:38 2007 +0100 @@ -769,8 +769,15 @@ } -<> { - if (--include_stack_ptr < 0) { +<> { /* NOTE: We must not change the value of include_stack_ptr + * just yet. We must only decrement it if we are NOT + * at the end of the main file. + * If we have finished parsing the main file, then we + * must leave include_stack_ptr at 0, in case the + * parser is called once again with a new file. + * (In fact, we currently do just that!) + */ + if (include_stack_ptr == 0) { /* yyterminate() terminates the scanner and returns a 0 to the * scanner's caller, indicating "all done". * @@ -782,6 +789,7 @@ yyterminate(); } else { + --include_stack_ptr; yy_delete_buffer(YY_CURRENT_BUFFER); yy_switch_to_buffer((include_stack[include_stack_ptr]).buffer_state); yylineno = include_stack[include_stack_ptr].lineno;