Refactoring lexer helpers (part 1).