subroutinehandle_directiverecursiveprivate
recursive subroutine handle_directive(c, kind, content, on_lines, path)
Act on a directive of type kind, which is $, # or @.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| c | type(fypp_t) | inout | the state | |
| kind | character(len=1) | in | the type of directive | |
| content | character(len=*) | in | its text | |
| on_lines | logical | in | true for a line directive | |
| path | character(len=*) | in | the file |
Calls
Source
Show the code
recursive subroutine handle_directive(c, kind, content, on_lines, path)
type(fypp_t), intent(inout) :: c !! the state
character, intent(in) :: kind !! the type of directive
character(len=*), intent(in) :: content !! its text
logical, intent(in) :: on_lines !! true for a line directive
character(len=*), intent(in) :: path !! the file
integer :: node, expr, at
if (len(content) == 0) then
call fail(c, 'a directive has no content in '//path)
else if (kind == '$') then
call compile(c, content, expr)
node = new_node(c, N_EVAL)
c%nodes(node)%expr = expr
c%nodes(node)%on_lines = on_lines
call append(c, node)
else if (kind == '#') then
at = 1
do while (at <= len(content))
if (.not. in_name(content(at:at))) exit
at = at + 1
end do
call control_directive(c, content(:at - 1), content(skip_blanks(content, at):), on_lines, path)
else
call fail(c, 'direct calls are not supported: '//content)
end if
end subroutine handle_directive