fdoc

subroutineparse_postfixrecursiveprivate

recursive subroutine parse_postfix(c, s, id)

A primary with what follows it: calls, subscripts and methods.

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_postfix(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
    character(len=:), allocatable :: method
    integer :: object

    call parse_primary(c, s, id)
    do
        if (allocated(c%error)) return
        if (at_word(s, '(')) then
            object = id
            id = new_expr(c, E_CALL, object)
            call next_token(c, s)
            call parse_arguments(c, s, id, ')')
            call expect(c, s, ')')
        else if (at_word(s, '[')) then
            object = id
            call next_token(c, s)
            call parse_subscript(c, s, object, id)
            call expect(c, s, ']')
        else if (at_word(s, '.')) then
            object = id
            call next_token(c, s)
            method = s%word
            call next_token(c, s)
            call expect(c, s, '(')
            id = new_expr(c, E_METHOD, object)
            c%exprs(id)%text = method
            call parse_arguments(c, s, id, ')')
            call expect(c, s, ')')
        else
            return
        end if
    end do
end subroutine parse_postfix

Graphs

Calls

Called by