Heavy refactoring, integration with xctool, various improvements

Sorry to contribute back a big blob but I have been testing and modifying things in parallel for a while. Credits @swolchok for suggesting several neat python idioms (but the ugly lines are still my fault ;-)).

Changes:
- optimizes performance by not constructing the whole json compilation database in memory
- adds support for logs coming from xctool's json-reporter
- now uses code using a tokenizer (shlex for -rare- complicated cases, a simple 'split' otherwise)
- makes ObjectiveC implicit headers explicit
- makes .pth recovery work also for .h source files
- groups the top-level into main() for better python style