Ejemplo n.º 1
0
void GetToken(void)
{
	//int		n	=0;
	// Simply reads in the next statement and places it in the
	// token buffer.

	ParseWhitespace();

	switch (chr_table[*src])
	{
	case LETTER:
		//token_type = IDENTIFIER;
		tok.type=IDENTIFIER;
		GetIdentifier();
		break;
	case DIGIT:
		//token_type = DIGIT;
		tok.type=DIGIT;
		GetNumber();
		break;
	case SPECIAL:
		//token_type = CONTROL;
		tok.type=CONTROL;
		GetPunctuation();
		break;
	}

	//printf("token: %s\n", tok.ident);

	if (!*src && inevent)
	{
		err("Unexpected end of file");
	}
}
Ejemplo n.º 2
0
void GetToken(void)
{
  int i;

  // Simply reads in the next statement and places it in the
  // token buffer.

  ParseWhitespace();
  i=0;

  switch (chr_table[*src])
  {
    case  LETTER: { token_type = IDENTIFIER; GetIdentifier();  break; }
    case   DIGIT: { token_type = DIGIT;      GetNumber();      break; }
    case SPECIAL: { token_type = CONTROL;    GetPunctuation(); break; }
  }

  if (!*src && inevent)
    err("Unexpected end of file");
}