Creating subroutines for checking tok type