More refactoring of the lexer, mostly function renaming.