subroutinecall_directiveprivate
subroutine call_directive(c, param, on_lines)
#:call name(arguments) or #:block name(arguments).
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| c | type(fypp_t) | inout | the state | |
| param | character(len=*) | in | what follows the directive | |
| on_lines | logical | in | true for a line directive |
Calls
Source
Show the code
subroutine call_directive(c, param, on_lines)
type(fypp_t), intent(inout) :: c !! the state
character(len=*), intent(in) :: param !! what follows the directive
logical, intent(in) :: on_lines !! true for a line directive
type(scan_t) :: s
integer :: at, close_parentheses, node, name, holder
at = index(param, '(')
if (at == 0) then
at = len(param) + 1
close_parentheses = at
else
close_parentheses = index(param, ')', back=.true.)
end if
call intern(c, trim_right(param(:at - 1)), name)
node = new_node(c, N_CALL)
c%nodes(node)%name = name
c%nodes(node)%on_lines = on_lines
c%nodes(node)%source = param
holder = new_expr(c, E_CALL)
if (close_parentheses > at) then
s%text = param(at + 1:close_parentheses - 1)
call next_token(c, s)
call parse_arguments(c, s, holder, '')
if (s%kind /= T_END) call fail(c, 'cannot read the arguments of: '//param)
else
allocate (c%exprs(holder)%args(0), c%exprs(holder)%names(0))
end if
c%nodes(node)%expr = holder
call add_body(c, node, 0)
call open_block(c, node)
end subroutine call_directive