link-grammar-5.8.0/link-grammar/parse/prune.c
/** Find if a connector t can form link x so post_process_match(s, x)==true.
 *  Only t may have a head-dependent indicator, which is skipped if found.
 *  The leading uppercase characters must exactly match.
 *  The rest (the subscript) should be able to from the subscript of x.
 *  (*e) is a character that exists in x at the same position as in s
 *  (e indicates both the character and its position in s); t is ok
 *  iff this character post-process-matches the corresponding one at s,
 *  and the rest post-process-match or are '*'.
 *  Examples:
 *     s="Xabc"; t="Xa*c"; e=s[3]; // *e == 'c'; // Returns true;
 *     s="Xabc"; t="Xa*c"; e=s[2]; // *e == 'b'; // Returns false;
 *     s="Xabc"; t="Xa*d"; e=s[1]; // *e == 'a'; // Returns false;
 *     s="X*ab"; t="Xcab"; e=s[1]; // *e == '*'; // Returns false;
 *     s="Xa*b"; t="Xacb"; e=s[1]; // *e == 'a'; // Returns false;
 *     s="Xa*b"; t="Xa";   e=s[1]; // *e == 'a'; // Returns true;
 *     s="Xa*#"; t="Xa*d"; e=s[1]; // *e == 'a'; // Returns true;
 *     s="Xa*#"; t="Xa";   e=s[2]; // *e == '*'; // Returns true;
 *     s="X";    t="Xab";  e=s[1]; // *e = '\0'; // Returns true;
 */
Find if a connector t can form link x so post_process_match(s, x)==true.
Only t may have a head-dependent indicator, which is skipped if found.
The leading uppercase characters must exactly match.
The rest (the subscript) should be able to from the subscript of x.
(*e) is a character that exists in x at the same position as in s
(e indicates both the character and its position in s); t is ok
iff this character post-process-matches the corresponding one at s,
and the rest post-process-match or are '*'.
Find if a connector t can form link x so post_process_match ( s x ) == true . Only t may have a head - dependent indicator which is skipped if found . The leading uppercase characters must exactly match . The rest ( the subscript ) should be able to from the subscript of x . ( * e ) is a character that exists in x at the same position as in s ( e indicates both the character and its position in s ) ; t is ok iff this character post - process - matches the corresponding one at s and the rest post - process - match or are ' * ' .
static bool can_form_link(const char *s, const char *t, const char *e)
{
	if (islower(*t)) t++; 
	while (isupper(*s))
	{
		if (*s != *t) return false;
		s++;
		t++;
	}
	if (isupper(*t)) return false;
	while (*t != '\0')
	{
		if (*s == '\0') return true;
		if (*s != *t && *s != '#' && (s == e || *t != '*')) return false;
		s++;
		t++;
	}
	while (*s != '\0')
	{
		if (*s != '*' && *s != '#' && s == e) return false;
		s++;
	}
	return true;
}
static bool can_form_link ( const char * s , const char * t , const char * e ) { if ( islower ( * t ) ) t ++ ; while ( isupper ( * s ) ) { if ( * s != * t ) return false ; s ++ ; t ++ ; } if ( isupper ( * t ) ) return false ; while ( * t != ' \0 ' ) { if ( * s == ' \0 ' ) return true ; if ( * s != * t && * s != ' ' && ( s == e || * t != ' ' ) ) return false ; s ++ ; t ++ ; } while ( * s != ' \0 ' ) { if ( * s != ' ' && * s != ' ' && s == e ) return false ; s ++ ; } return true ; }
Find if a connector t can form link x so post_process_match(s, x)==true.
Find if a connector t can form link x so post_process_match ( s x ) == true .
/* Skip head-dependent indicator */