| 847 | } |
| 848 | |
| 849 | static int leftmatch( |
| 850 | const char *pattern, /* first char of pattern to match in text */ |
| 851 | const char *context) /* last char of text to be matched */ |
| 852 | |
| 853 | { |
| 854 | const char *pat; |
| 855 | const char *text; |
| 856 | int count; |
| 857 | |
| 858 | if (*pattern == '\0') |
| 859 | /* null string matches any context */ |
| 860 | { |
| 861 | return 1; |
| 862 | } |
| 863 | |
| 864 | /* point to last character in pattern string */ |
| 865 | count = (int)strlen(pattern); |
| 866 | |
| 867 | pat = pattern + (count - 1); |
| 868 | |
| 869 | text = context; |
| 870 | |
| 871 | for (; count > 0; pat--, count--) |
| 872 | { |
| 873 | /* First check for simple text or space */ |
| 874 | if (isalpha(*pat) || *pat == '\'' || *pat == ' ') |
| 875 | { |
| 876 | if (*pat != *text) |
| 877 | { |
| 878 | return 0; |
| 879 | } |
| 880 | else |
| 881 | { |
| 882 | text--; |
| 883 | continue; |
| 884 | } |
| 885 | } |
| 886 | |
| 887 | switch (*pat) |
| 888 | { |
| 889 | |
| 890 | case '#': /* One or more vowels */ |
| 891 | |
| 892 | if (!isvowel(*text)) |
| 893 | return 0; |
| 894 | |
| 895 | text--; |
| 896 | |
| 897 | while (isvowel(*text)) |
| 898 | text--; |
| 899 | |
| 900 | break; |
| 901 | |
| 902 | case ':': /* Zero or more consonants */ |
| 903 | while (isconsonant(*text)) |
| 904 | text--; |
| 905 | |
| 906 | break; |
no test coverage detected