Handling EOF in source codes

I'm writing a front-end analyzer for a new lang based on LLVM.
Now I'm working on syntax error handling (the hardest to handle really!).
My problem is that the parser uses lexical analyzer's tokens and when it doesn't expect an EOF, it doesn't handle it.
This results in infinite while's and I don't know how to send the control back to the parser's "root function".

Sorry I know this has little to do with LLVM but I need an idea since LLVM philosophy is to not use exceptions.