Append token t, growing the storage as needed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(token_list_t), | intent(inout) | :: | self |
the token list |
||
| type(token_t), | intent(in) | :: | t |
token to append |
subroutine push(self, t) !! Append token `t`, growing the storage as needed. class(token_list_t), intent(inout) :: self !! the token list type(token_t), intent(in) :: t !! token to append type(token_t), allocatable :: tmp(:) if (.not. allocated(self%tok)) allocate (self%tok(256)) if (self%n == size(self%tok)) then allocate (tmp(2*self%n)) tmp(1:self%n) = self%tok(1:self%n) call move_alloc(tmp, self%tok) end if self%n = self%n + 1 self%tok(self%n) = t end subroutine push