link-grammar-5.8.0/link-grammar/dict-common/idiom.c
/**
 * Tear the idiom string apart.
 * Put the parts into a list of Dict_nodes (connected by their right pointers)
 * Sets the string fields of these Dict_nodes pointing to the
 * fragments of the string s.  Later these will be replaced by
 * correct names (with .Ix suffixes).
 * The list is reversed from the way they occur in the string.
 * A pointer to this list is returned.
 * This function is called after is_idiom_string() ensures the validity
 * of the given string.
 */
Tear the idiom string apart.
Put the parts into a list of Dict_nodes (connected by their right pointers)
Sets the string fields of these Dict_nodes pointing to the
fragments of the string s.  Later these will be replaced by
correct names (with .Ix suffixes).
The list is reversed from the way they occur in the string.
A pointer to this list is returned.
This function is called after is_idiom_string() ensures the validity
of the given string.
Tear the idiom string apart . Put the parts into a list of Dict_nodes ( connected by their right pointers ) Sets the string fields of these Dict_nodes pointing to the fragments of the string s . Later these will be replaced by correct names ( with . Ix suffixes ) . The list is reversed from the way they occur in the string . A pointer to this list is returned . This function is called after is_idiom_string () ensures the validity of the given string .
static Dict_node * make_idiom_Dict_nodes(Dictionary dict, const char * string)
{
	Dict_node * dn = NULL;
	char * s = strdupa(string);
	const char * t;
	const char *sm = strchr(s, SUBSCRIPT_MARK);
	for (t = s; NULL != s; t = s)
	{
		s = strchr(s, '_');
		if ((NULL != sm) && (s > sm)) s = NULL;
		if (NULL != s) *s++ = '\0';
		Dict_node *dn_new = (Dict_node *) malloc(sizeof (Dict_node));
		dn_new->right = dn;
		dn = dn_new;
		dn->string = string_set_add(t, dict->string_set);
		dn->file = NULL;
	}
	return dn;
}
static Dict_node * make_idiom_Dict_nodes ( Dictionary dict , const char * string ) { Dict_node * dn = NULL ; char * s = strdupa ( string ) ; const char * t ; const char * sm = strchr ( s , SUBSCRIPT_MARK ) ; for ( t = s ; NULL != s ; t = s ) { s = strchr ( s , ' ' ) ; if ( ( NULL != sm ) && ( s > sm ) ) s = NULL ; if ( NULL != s ) * s ++ = ' \0 ' ; Dict_node * dn_new = ( Dict_node * ) malloc ( sizeof ( Dict_node ) ) ; dn_new -> right = dn ; dn = dn_new ; dn -> string = string_set_add ( t , dict -> string_set ) ; dn -> file = NULL ; } return dn ; }
Tear the idiom string apart.
Tear the idiom string apart .