Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(TokenStack), | intent(inout) | :: | stack | |||
type(Token), | intent(out) | :: | tok |
subroutine Pop_TokenStack(stack,tok)
class(TokenStack),intent(inout) :: stack
type(Token),intent(out) :: tok
if(stack%top_index <= 0) then
print*,"Attempt to pop from empty token stack"
else
tok%tokenString = stack%tokens(stack%top_index)%tokenString
tok%tokenType = stack%tokens(stack%top_index)%tokenType
tok%tokenIndex = stack%tokens(stack%top_index)%tokenIndex
stack%top_index = stack%top_index-1
endif
endsubroutine Pop_TokenStack