functionis_tablepureprivate
pure logical function is_table(block)
True if block is a table: a header line with |, then a separator line.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| block | character(len=*) | in | the chunk |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| is_table | logical |
Source
Show the code
pure logical function is_table(block)
character(len=*), intent(in) :: block !! the chunk
integer :: a, b
is_table = .false.
a = index(block, NL)
if (a == 0) return
if (index(block(:a - 1), '|') == 0) return
b = index(block(a + 1:), NL)
b = merge(len(block), a + b - 1, b == 0)
if (b <= a) return
is_table = verify(block(a + 1:b), '|:- ') == 0 .and. index(block(a + 1:b), '-') > 0
end function is_table