fdoc

subroutineparse_comparerecursiveprivate

recursive subroutine parse_compare(c, s, id)

Comparisons.

Arguments

NameTypeIntentAttributesDescription
ctype(fypp_t)inout

the state

stype(scan_t)inout

the expression

idintegerout

the result

Calls

Source

Show the code
recursive subroutine parse_compare(c, s, id)
    type(fypp_t), intent(inout) :: c    !! the state
    type(scan_t), intent(inout) :: s    !! the expression
    integer, intent(out) :: id          !! the result
    integer :: first, op, right

    call parse_sum(c, s, first)
    id = first
    do
        op = 0
        if (at_word(s, '==')) op = C_EQ
        if (at_word(s, '!=')) op = C_NE
        if (at_word(s, '<')) op = C_LT
        if (at_word(s, '>')) op = C_GT
        if (at_word(s, '<=')) op = C_LE
        if (at_word(s, '>=')) op = C_GE
        if (at_word(s, 'in')) op = C_IN
        if (at_word(s, 'not')) op = C_NOT_IN
        if (op == 0) return
        call next_token(c, s)
        if (op == C_NOT_IN) call expect(c, s, 'in')
        call parse_sum(c, s, right)
        if (id == first) id = new_expr(c, E_COMPARE, first)
        call push_id(c%exprs(id)%args, right)
        call push_id(c%exprs(id)%ops, op)
    end do
end subroutine parse_compare

Graphs

Calls

Called by