Fix the "d1" bug and related parsing bugs

This patch also adds a number of tests for this type of situation. The major
problem was that the regular expressions specified that any part of the integral
part, fractional part, and decimal point was optional.

See 355fd53 for details