Rewrite parser more readable, little faster

@benoitc let me know if you are open to this kind of parser rewrite. Some notes:
- marginal performance improvement, around 10%
- more readable (I think, unless you don't like regex)
- couldn't get multiline values to work in existing implementation, so I left it out (I can add it if needed)
- passes all current tests
- possible further speed improvements with compiled regex
Please let me know your thoughts.