Improve parsing of literal numbers, to include invalid representations

These are then reported as a SemanticError.
Resolves #2595