mwh/minigrace — pull request #22 by DanielGibbsNZ (2013-06-21 07:51:52+00:00)
Title: Read source lines before lexing.

This decouples the reading of the source code into `util.lines` and `util.cLines` from the actual lexing of the code.
It doesn't appear to have a huge impact on performance. This implementation only requires one extra pass of the code and adds no more than 1 second* when compiling an individual file (from the compiler) and only adds about 4 seconds* when compiling from scratch (`make js` after `make clean`).

The benefits of this are that the lexing code no longer has to worry about updating `util.lines` and `util.cLines`, resulting in more succinct lexing logic, and lines of code shown in error messages will be complete even if the error occurs in the middle of lexing a line.

* Running on majoribanks with make configured to use all four cores.