Fix scientific notation parse error and refactor.

Moved the lexer into its own class so that it's slightly cleaner and
easier to find things.