TopToken Function

public function TopToken(stack)

Arguments

TypeIntentOptionalAttributesName
class(TokenStack) :: stack

Return Value type(Token)


Contents

Source Code


Source Code

  type(Token) function TopToken(stack)
    class(TokenStack) :: stack

    if(stack%top_index > 0) then
      TopToken%tokenString = stack%tokens(stack%top_index)%tokenString
      TopToken%tokenType = stack%tokens(stack%top_index)%tokenType
      TopToken%tokenIndex = stack%tokens(stack%top_index)%tokenIndex
    else
      TopToken%tokenString = ''
    endif

  endfunction TopToken