folded_length Function

private pure function folded_length(text, kind) result(n)

How much of a token's text, from its start, Fortran reads ignoring case: all of a name, an operator or a number (exponent letters and kinds), the kind prefix of a string, and none of anything else.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: text

the token's text

integer, intent(in) :: kind

its kind (TK_*)

Return Value integer


Called by

proc~~folded_length~~CalledByGraph proc~folded_length folded_length proc~code_signature code_signature proc~code_signature->proc~folded_length proc~same_token same_token proc~same_token->proc~folded_length proc~same_code same_code proc~same_code->proc~code_signature proc~same_code->proc~same_token

Source Code

pure integer function folded_length(text, kind) result(n)
    !! How much of a token's text, from its start, Fortran reads ignoring case: all of a name, an
    !! operator or a number (exponent letters and kinds), the kind prefix of a string, and none of
    !! anything else.
    character(len=*), intent(in) :: text   !! the token's text
    integer, intent(in) :: kind            !! its kind (`TK_*`)
    select case (kind)
    case (TK_NAME, TK_OP, TK_DOTOP, TK_INT, TK_REAL)
        n = len(text)
    case (TK_STRING)
        n = max(0, scan(text, '"'//"'") - 1)
    case default
        n = 0
    end select
end function folded_length