fdoc

subroutineparse_sumrecursiveprivate

recursive subroutine parse_sum(c, s, id)

Terms added and subtracted.

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_sum(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 :: right, kind

    call parse_product(c, s, id)
    do while (at_word(s, '+') .or. at_word(s, '-'))
        kind = merge(E_ADD, E_SUB, at_word(s, '+'))
        call next_token(c, s)
        call parse_product(c, s, right)
        id = new_expr(c, kind, id, right)
    end do
end subroutine parse_sum

Graphs

Calls

Called by