Refactor the case statement in highlighter for better readability. [ci skip]