The letter case wanted for each token.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(source_t), | intent(in) | :: | source |
the source |
||
| type(statement_view_t), | intent(in) | :: | views(:) |
the view of each item (see statement_views) |
||
| type(case_options_t), | intent(in) | :: | opts |
the case wanted for each category |
function compute_case(source, views, opts) result(marks) !! The letter case wanted for each token. type(source_t), intent(in) :: source !! the source type(statement_view_t), intent(in) :: views(:) !! the view of each item (see [[statement_views]]) type(case_options_t), intent(in) :: opts !! the case wanted for each category type(case_marks_t) :: marks integer :: k, t, a, b allocate (marks%whole(source%tokens%n), marks%part(source%tokens%n)) marks%whole = CASE_KEEP marks%part = CASE_KEEP do t = 1, source%tokens%n associate (tok => source%tokens%tok(t)) select case (tok%kind) case (TK_DOTOP) marks%whole(t) = opts%operators case (TK_INT, TK_REAL) marks%whole(t) = opts%types ! their only letters: an exponent and a kind end select if (opts%types /= CASE_KEEP .and. (tok%kind == TK_DOTOP .or. tok%kind == TK_STRING)) then call kind_part(source%text(tok%first:tok%last), tok%kind, a, b) if (b >= a) marks%part(t) = opts%types end if end associate end do do k = 1, source%stmts%n if (source%stmts%s(k)%kind /= SK_CODE) cycle if (opts%keywords /= CASE_KEEP) call statement_case(views(k), opts%keywords, marks%whole) if (opts%procedures /= CASE_KEEP .or. opts%constants /= CASE_KEEP .or. opts%types /= CASE_KEEP) & call names_case(views(k), opts, marks%whole) end do end function compute_case