示例#1
0
/******************************************************************
			scan()
See prlex.h for return values other than characters (i.e. > 256)
*******************************************************************/
int scan()
{
	ini_scan();
	getachar();
	if(Ch == EOF)
		return(EOF);
	switch(Ctype[Ch])
	{

	case DI:
		MY_ASSERT(isdigit(Ch)); /* double check */
	case SI:
		MY_ASSERT(isdigit(Ch) || Ch == '-' || Ch == '+');
		return(scan_number(Ch));

	case QU:
		MY_ASSERT(Ch == '"');
		scan_string();
		return(TOKEN_STRING);

	case BR:
		MY_ASSERT(Ch == ')' || Ch == '(');
		return(Ch);

#ifdef CLIPS_SYNTAX
	case QE:
		scan_identifier(?);
		return(TOKEN_VAR);
	case AL:
	case AU:
	case OT:
		scan_identifier(Ch);
		return(TOKEN_ATOM);
#else
	case AL:
		MY_ASSERT(islower(Ch));
		scan_identifier(Ch);
		return(TOKEN_ATOM);

	case US:
		MY_ASSERT(Ch == '_');

	case AU:
		scan_identifier(Ch);
		return(TOKEN_VAR);
#endif
	case CC:
		return(SCAN_ERR);
#ifdef  CHARACTER
	case AP:
		return(scan_character());
#endif
	default:
		return(Ch);
	}
}
示例#2
0
void	plan_init(void *o, t_token *token)
{
  t_plan	*s;

  (void)token;
  s = xmalloc(sizeof(*s));
  bzero(s, sizeof(*s));
  s->scan = ini_scan();
  s->collide = collide_plan;
  s->normal = normal_plan;
  s->translation = translation_plan;
  s->rotation = rotation_plan;
  s->copy = copy_plan;
  *((t_plan**)o) = s;
}