major parser code update

- performed deep analysis of the parser's code and a full code audit
- fixes all known parser bugs
- parser is now code-complete, nearly finished (some further tests are required) and will be production-ready soon