Fix bug 1038; Improve error handling when parsing year directives

These changes fix the [1038](http://bugs.ledger-cli.org/show_bug.cgi?id=1038) issue.

Since my understanding about leader's code architecture is still rather limited, the proposed changes may not be the optimal solution or they may have side effects. Please review scrutinizingly, thanks :christmas_tree: