verilog: Support unexpected end of file

I closed #111 by mistake and became unable to reopen it. Sorry!
This PR is for the same purpose, but with code rebased on top of current master.