Optimized lexer