view_is Function

private pure function view_is(v, j, text)

True if the lowercase text of code token j is text, without making a copy of it. Outside the statement only '' matches.

Type Bound

statement_view_t

Arguments

Type IntentOptional Attributes Name
class(statement_view_t), intent(in) :: v

the statement

integer, intent(in) :: j

index into v%code(:)

character(len=*), intent(in) :: text

the text, in lowercase

Return Value logical


Source Code

pure logical function view_is(v, j, text)
    !! True if the lowercase text of code token `j` is `text`, without making a copy of it. Outside
    !! the statement only `''` matches.
    class(statement_view_t), intent(in) :: v   !! the statement
    integer, intent(in) :: j                   !! index into `v%code(:)`
    character(len=*), intent(in) :: text       !! the text, in lowercase
    if (j < 1 .or. j > v%n) then
        view_is = len(text) == 0
    else
        view_is = v%hi(j) - v%lo(j) + 1 == len(text)
        if (view_is) view_is = v%low(v%lo(j):v%hi(j)) == text
    end if
end function view_is