Fix script parsing

The line-by-line parsing of MATLAB scripts has been corrected as
follows:

* Use StringBuilder instead of concatenation
* Avoid use of BufferedReader.ready()
* Strip out inline comments (as these comment out ALL further code)