Steve,
I was able to reproduce this with 5.0-beta2 and stepped through it in the debugger. It turns out that the issue seems to be caused by include_stack_ptr being left to a value of -1 after we hit EOF on the first mapfile.
Then the second parse starts with include_stack_ptr=-1 and never returns an "unexpected EOF" error.
The following patch seems to fix the issue, but I'm not sure if that's the best way to go. I think forcing include_stack_ptr=0 in some initialization code might be better so that in case of errors during parsing of an included file we still start up clean, but I didn't look for or find the right location to do it. I'll leave that to you.
--- maplexer.l (revision 6436)
+++ maplexer.l (working copy)
@@ -521,9 +521,10 @@
<INITIAL>\n { msyylineno++; }
<INITIAL><<EOF>> {
- if( --include_stack_ptr < 0 )
+ if( --include_stack_ptr < 0 ) {
+ include_stack_ptr = 0;
return(EOF); /* end of main file */
- else {
+ } else {
fclose(YY_CURRENT_BUFFER->yy_input_file);
msyy_delete_buffer( YY_CURRENT_BUFFER );
msyy_switch_to_buffer(include_stack[include_stack_ptr]);