is_chevron Function

public pure function is_chevron(src, tokens, t)

True if token t is a < or > operator directly next to another one, as in the CUDA kernel launch call k<<<grid, block>>>(x), where they are not relational operators.

Arguments

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

the source the tokens were read from

type(token_list_t), intent(in) :: tokens

tokens of src

integer, intent(in) :: t

index into tokens

Return Value logical


Called by

proc~~is_chevron~~CalledByGraph proc~is_chevron is_chevron proc~convert_relational convert_relational proc~convert_relational->proc~is_chevron proc~statement_gaps statement_gaps proc~statement_gaps->proc~is_chevron proc~compute_gaps compute_gaps proc~compute_gaps->proc~statement_gaps proc~format_text format_text proc~format_text->proc~convert_relational proc~format_pass format_pass proc~format_text->proc~format_pass proc~relayout relayout proc~format_text->proc~relayout proc~format_pass->proc~compute_gaps proc~process_text process_text proc~process_text->proc~format_text proc~process_file process_file proc~process_file->proc~process_text proc~process_stdin process_stdin proc~process_stdin->proc~process_text proc~relayout->proc~format_pass proc~run run proc~run->proc~process_file proc~run->proc~process_stdin

Source Code

pure logical function is_chevron(src, tokens, t)
    !! True if token `t` is a `<` or `>` operator directly next to another one, as in the CUDA
    !! kernel launch `call k<<<grid, block>>>(x)`, where they are not relational operators.
    character(len=*), intent(in) :: src          !! the source the tokens were read from
    type(token_list_t), intent(in) :: tokens     !! tokens of `src`
    integer, intent(in) :: t                     !! index into `tokens`
    is_chevron = .false.
    if (.not. is_angle(t)) return
    if (t > 1) is_chevron = is_angle(t - 1)
    if (t < tokens%n) is_chevron = is_chevron .or. is_angle(t + 1)

contains

    pure logical function is_angle(k)
        !! True if token `k` is a `<` or `>` operator.
        integer, intent(in) :: k   !! index into `tokens`
        is_angle = .false.
        if (tokens%tok(k)%kind /= TK_OP) return
        is_angle = src(tokens%tok(k)%first:tokens%tok(k)%last) == '<' .or. &
                   src(tokens%tok(k)%first:tokens%tok(k)%last) == '>'
    end function is_angle

end function is_chevron