Ejemplo n.º 1
0
Archivo: lexer.c Proyecto: girards/42sh
int	lexer(char *cmd, t_token **token, t_42sh *shell)
{
  char	*error;
  t_lex	*lexi;

  lexi = xmalloc(sizeof(*lexi));
  cmd = check_carac(cmd);
  lexi->cmd = epur_str(strdup(cmd));
  if (!(lexi->cmd[0]))
    return (0);
  lex(lexi->cmd, token);
  if ((error = check_token(token, lexi)) != NULL)
    {
      printf("42sh : Syntax error near unexpected token `%s`\n", error);
      return (0);
    }
  else
    return (parser(token, shell));
  return (0);
}
Ejemplo n.º 2
0
t_list	*set_tetrimino(t_list *list)
{
  t_elem	*tmp;

  tmp = list->head;
  while (tmp != NULL)
    {
      if (tmp->status == 0)
	{
	  if (malloc_tetrimino(tmp) == 0)
	    {
	      if (recup_tetrimino(tmp, 0, 0, -1) == -1)
		tmp->status = 1;
	      if (check_carac(tmp->map) == -1)
		tmp->status = 1;
	      if (check_is_good_carac_w(tmp) == -1 || check_is_good_carac_h(tmp) == -1)
		tmp->status = 1;
	    }
	}
      tmp = tmp->next;
    }
  return (list);
}