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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | text |
the token's text |
||
| integer, | intent(in) | :: | kind |
its kind ( |
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