lexer: Initial implementation of lexer helper functions.