refactor lexer special char recognition