Fix the infinite loop when an input file lacks EOF
The input scanner can be trapped in an infinite loop if the given input file does not have EOF (and is not ended with a 'whitespace'). The problem is caused by unget(), which keeps rolling back the scanner pointer without hitting an EOF at the end of the file. This makes getch() function keep returning the last character of the file and never ends, and the effect of advance() is always counteracted by unget().
This commit is contained in:
parent
ba00f67d2f
commit
19647a32b9
4 changed files with 14 additions and 5 deletions
2
Test/baseResults/preprocessor.eof_missing.vert.out
Normal file
2
Test/baseResults/preprocessor.eof_missing.vert.out
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
noEOF
|
||||
|
||||
1
Test/preprocessor.eof_missing.vert
Normal file
1
Test/preprocessor.eof_missing.vert
Normal file
|
|
@ -0,0 +1 @@
|
|||
noEOF
|
||||
|
|
@ -13,3 +13,4 @@ preprocessor.simple.vert
|
|||
preprocessor.success_if_parse_would_fail.vert
|
||||
preprocessor.defined.vert
|
||||
preprocessor.many.endif.vert
|
||||
preprocessor.eof_missing.vert
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue