示例#1
0
void dcl(void)
{
   int ns;
   for (ns = 0; gettoken() == '*'; ) /* count *'s */
      ns++;
   /* doing smthing fishy */
   if(tokentype == '(')
   {
      print_sol();
      dirdcl();
   }
   
   dirdcl();
   while (ns-- > 0)
      strcat(out, " pointer to");
}
示例#2
0
void dcl(void) {
  int ns;
  for(ns = 0; gettoken() == '*';)
    ns++;
  dirdcl();
  while(ns-- > 0)
    strcat(out, " pointer to");
}
示例#3
0
void dcl( void ){
  int ns;

  for( ns = 0; gettoken() == '*'; )  /* cuenta *s */
    ns++;
  dirdcl();
  while( ns-- > 0 )
    strcat( out, " apuntador a" );
}
示例#4
0
/* dcl: parse a declarator */
int dcl(void)
{
    int ns, temp;
    for (ns = 0; gettoken() == '*'; ) /* count *'s */
         ns++;
    temp = dirdcl();
    while (ns-- > 0)
         strcat(out, " pointer to");
    return temp;
}
示例#5
0
/* Private funtion definitions */
static void dcl( void ) {
  int ns;
  for ( ns = 0; gettoken() == '*'; ) {
    ns++;
  }
  dirdcl();
  while ( ns-- > 0 ) {
    strcat( out, " pointer to" );
  }
}
示例#6
0
int dcl(void)
{
	int ns;
	for (ns = 0; gettoken() == '*'; )
		ns++;
	if (!dirdcl())
		return 0;
	while (ns-- > 0)
		strcat(out, " pointer to");
	return 1;
}
示例#7
0
文件: 5-18.c 项目: 1sps/knr
int dcl(void) /* with error recovery */
{
	int ns;

	for (ns = 0; gettoken() == '*';)
		ns++;
	if(dirdcl() == -1)
		return -1;
	while (ns-- > 0)
		strcat(out, " pointer to");
	return 0;
}
示例#8
0
文件: dcl.c 项目: cheyuni/TCPL
/* dcl:  parse a declarator */
int dcl(void)
{
	char tmp[1000];

	tmp[0] = '\0';
	while (tokentype == '*') {
		while (gettoken() == QUALIFIER) {
			strcat(tmp, " ");
			strcat(tmp, token);
		}
		strcat(tmp, " pointer to");
	}
	if (dirdcl() != 0)
		return 1;
	strcat(out, tmp);

	return 0;
}
示例#9
0
void dcl(StringBuffer &bin, StringList &vout) { // 선언자를 분석하고 결과 출력
    // declarator: * direct-declarator (1)
    int pointer_count = 0;
    char ch;
    while (bin.is_empty() == false) { // 버퍼에 문자가 남아있는 동안
        ch = bin.getc(); // 문자를 획득하고 확인한다
        if (ch == '*') { // *라면 그만큼 포인터를 출력하기 위해
            ++pointer_count; // 카운터를 증가시킨다
        }
        else { // *가 아니라면 포인터를 되돌리고 탈출한다
            bin.ungetc();
            break;
        }
    }
    // declarator: * direct-declarator (2)
    dirdcl(bin, vout); // *을 모두 획득했으므로 직접 선언자를 분석한다
    while (pointer_count > 0) { // 선언자의 분석이 오른쪽에서 먼저 진행되므로
        vout.push_back("*"); // 왼쪽에서 획득한 기호를 오른쪽의 분석이
        --pointer_count; // 종료된 후에 출력해야 한다
    }
}
示例#10
0
/** parse declaration (syntax analize) */
void dcl(void) {
	int ns;

	/** count stars */
	for (ns = 0; gettoken() == '*'; )
		ns++;

	/** 3. check last called gettoken() results */
	if (tokentype == ERR) {
		printf("error[2]: some error symbol inserted\n");
		return;
	}

	dirdcl();

	/** 3. check dirdcl() results (assume error message already printed) */
	if (tokentype == ERR)
		return;

	while (ns-- > 0)
		strcat(out, " pointer to");
}