subroutineparse_argumentsrecursiveprivate
recursive subroutine parse_arguments(c, s, id, closing)
The arguments of call id, up to closing.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| c | type(fypp_t) | inout | the state | |
| s | type(scan_t) | inout | the expression | |
| id | integer | in | the call | |
| closing | character(len=*) | in | the token that ends them |
Calls
Source
Show the code
recursive subroutine parse_arguments(c, s, id, closing)
type(fypp_t), intent(inout) :: c !! the state
type(scan_t), intent(inout) :: s !! the expression
integer, intent(in) :: id !! the call
character(len=*), intent(in) :: closing !! the token that ends them
integer :: value, keyword, saved
character(len=:), allocatable :: word
allocate (c%exprs(id)%args(0), c%exprs(id)%names(0))
do while (.not. at_word(s, closing) .and. s%kind /= T_END .and. .not. allocated(c%error))
keyword = 0
if (s%kind == T_NAME) then
word = s%word
saved = s%pos
call next_token(c, s)
if (at_word(s, '=')) then
call intern(c, word, keyword)
call next_token(c, s)
else
s%pos = saved - len(word)
call next_token(c, s)
end if
end if
call parse_test(c, s, value)
if (at_word(s, 'for')) call parse_comprehension(c, s, value, value)
call push_id(c%exprs(id)%args, value)
call push_id(c%exprs(id)%names, keyword)
if (.not. at_word(s, ',')) exit
call next_token(c, s)
end do
end subroutine parse_arguments