subroutineset_directiveprivate
subroutine set_directive(c, param)
#:set names = expression.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| c | type(fypp_t) | inout | the state | |
| param | character(len=*) | in | what follows the directive |
Calls
Source
Show the code
subroutine set_directive(c, param)
type(fypp_t), intent(inout) :: c !! the state
character(len=*), intent(in) :: param !! what follows the directive
integer, allocatable :: targets(:)
integer :: at, node, expr
call read_targets(c, param, targets, at)
if (allocated(c%error)) return
expr = 0
if (at <= len(param)) then
if (param(at:at) /= '=') then
call fail(c, 'cannot read the assignment: '//param)
return
end if
call compile(c, param(at + 1:), expr)
end if
node = new_node(c, N_SET)
c%nodes(node)%expr = expr
c%nodes(node)%source = param
call move_alloc(targets, c%nodes(node)%block%targets)
call append(c, node)
end subroutine set_directive