parser: organize compiled regular expressions

Put them in a dictionary and look them up when you need them. Slower but
no matter right now.
parser: open file for reading only using with statement

Get rid of unused local variables.
parser: get tests to pass
Merge pull request #26 from seliopou/master

Refactor parser code, get tests to pass