Priority Function

private function Priority(toke)

Arguments

TypeIntentOptionalAttributesName
type(Token) :: toke

Return Value integer


Contents

Source Code


Source Code

  integer function Priority(toke)
    type(Token) :: toke

    if(toke%tokenType == Function_Token) then

      Priority = 5

    elseif(toke%tokenType == Operator_Token) then

      if(toke%tokenString(1:1) == '^') then

        Priority = 4

      elseif(toke%tokenString(1:1) == '/') then

        Priority = 3

      elseif(toke%tokenString(1:1) == '*') then

        Priority = 2

      elseif(toke%tokenString(1:1) == '+' .or. toke%tokenString(1:1) == '-') then

        Priority = 1

      else

        Priority = 0

      endif

    elseif(toke%tokenType == Monadic_Token) then

      Priority = 5

    else

      Priority = 0

    endif

  endfunction Priority