Sophie

Sophie

distrib > Mandriva > 2010.1 > i586 > by-pkgid > 5a4bdb0fa6a47c773819f19c8f0c89eb > files > 256

dparser-1.15-2mdv2010.1.i586.rpm


/*
 * ambig.c
 *
 * $Revision: 1.1 $
 */

#include "d.h"
#undef DPN_TO_PN
#define DPN_TO_PN(_dpn) \
  ((PNode *)(((char*)(_dpn))-(int)(&((PNode*)0)->parse_node)))

extern void print_paren(PNode *);

struct D_ParseNode *
my_ambiguity_fn(struct D_Parser *pp, int n, struct D_ParseNode **v )
{
	int i;
	char *s;
	printf( "my_ambiguity_fn: %d possibilities:\n", n );

	s = v[0]->start_loc.s;
	while (s != v[0]->end)
		putchar( s[0] ), s++;

	for (i=0; i<n; i++) {

		printf( "\n\t" );
		print_paren( DPN_TO_PN( v[i] ) );
		printf( "\n" );

	}

	exit(0);
}