Introduce unit testing to the project. Refactor error, lexer and type modules. Fix various bugs.

Lexer:
* Expand public interface of `lexer` module to allow testing.
* Error message during panic-mode recovery outputs state (if relevant).
* Use a LoggerMock if no logger is provided. 
* Rewrite lexing of char and string literals:
  * Simplify and annotate regexes; build master regexes piece by piece.
  * Lex well-formed tokens separately from malformed ones.
  * Use python built-ins to return properly escaped values.
  * Terminate string literals with null byte.
  * Allow empty string literal. Refactor error for empty character literal.
  * Fix return value in literals ending with a single or double quote.
  * Simplify error reporting. Drop errors of char/string literals spanning multiple lines.

Parser:
* Completely delegate construction of type nodes to `type` module.
* Move default `start` argument out of `parse` function, to enable unit testing of individual grammar rules.

Error:
* DRY: Merge `DummyLogger` and `LoggerMock`.

Type:
* Add map of built-in types from `parser`.
* Add error reporting for built-in type redefinition.

Tests:
* Add almost complete unit tests for `lexer` module.
* Add almost complete unit tests for `type` module.
* Drop functional tests replaced by unit tests.

misc:
* Beautify code. Fix some `pylint` warnings.
* Fix typos and wrong comments.
`ptest.sh` exits with status code=1 on first bad input file. `nosetests` will run only if all functional tests complete correctly. So it's already implemented.