Switch record parsing to a real parser
For now quite a while we have been using regexp-based or split()-based pseudo-parsers in order to extract informations from our codebase. I think this approach leads to a lots of downsides:
- lots of code (i.e. for split()),
- hard to read code (i.e. regexps)
- hard to extend code (both).
- No good error message (probably just raise a random StopIteration or something).
In this commit, I finally implemented a proper parser using parser combinators for records. This makes the code easier to read, very compact (whole parser is 5 lines), and provides good support for error messages which indicate what and where the error is (e.g. "ValueError: Expected r'[0-9]+' but found end of source").
I think in general we should use such a parser moving forward, eventually implementing more advanced ones using parser combinators as well.
This commit also moves a few generic functions tests around and adds type annotation.