This function checks whether the correct suffix is extracted for a given pattern.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | pattern | |||
character(len=*), | intent(in) | :: | expected_suffix |
function is_valid__suffix(pattern, expected_suffix) result(res) use :: forgex_syntax_tree_optimize_m, only: get_suffix_literal use :: forgex_utf8_m, only: len_utf8 implicit none character(*), intent(in) :: pattern, expected_suffix logical :: res character(:), allocatable :: resulting type(tree_t) :: tree call tree%build(pattern) resulting = get_suffix_literal(tree) if (len_utf8(expected_suffix) == len_utf8(resulting)) then res = expected_suffix == resulting return end if res = .false. end function is_valid__suffix