Slightly refactored lexer modes so that mode transitions are more obvious