Improve line reader, fix bugs in parser/lexer.