Added a function to check the tag type of a token