State-function-based lexer, no lexing functions implemented yet