aboutsummaryrefslogtreecommitdiff
path: root/mendeleev.f90
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2022-09-29 09:56:15 +0200
committerIgor Pashev <pashev.igor@gmail.com>2022-09-29 10:01:27 +0200
commit42d05c8a3f59f99daccaf65a117d183828446d71 (patch)
treeaff35e0dc058164cb29810a2fc44366ef8d9d758 /mendeleev.f90
parentdbf2f4d6d117d8ef951224f07ccf62bb89d6ec6b (diff)
downloadmendeleev-42d05c8a3f59f99daccaf65a117d183828446d71.tar.gz
Test the longest tail
Diffstat (limited to 'mendeleev.f90')
-rw-r--r--mendeleev.f906
1 files changed, 1 insertions, 5 deletions
diff --git a/mendeleev.f90 b/mendeleev.f90
index c7df836..5abe2a4 100644
--- a/mendeleev.f90
+++ b/mendeleev.f90
@@ -171,23 +171,19 @@ contains
character(len=*), intent(in) :: word
type(formula_t), pointer :: formula
- logical :: has_tail
type(formula_t), pointer :: f
allocate(formula)
allocate(formula%elements(len(word)))
- do
+ do while (formula%tail <= len(word))
f => formula
- has_tail = .false.
do while (associated(f))
if (f%tail <= len(word)) then
call advance(word, f)
- if (.not. has_tail) has_tail = f%tail <= len(word)
end if
f => f%next
end do
- if (.not. has_tail) exit
end do
end function explode
end program mendeleev