4 files changed, +19, -53
d1e2907refactor: merge error with parser
author
mogi <git@mogiya.dev> on 02-07-2026 17:46 UTC+1
committer
mogi <git@mogiya.dev> on 02-07-2026 17:46 UTC+1
parent8b04e8e
Makefile
+1, -2
+1, -2
    @@ -8,8 +8,7 @@ CC			:= cc
 8 8 CFLAGS		:= -Wall -Werror -Wextra -pthread
 9 9 CPPFLAGS	:= -I$(INC_DIR) -MMD -MP
1010 
11  -SRCS		+= $(addprefix parser/, parser.c)
12  -SRCS		+= $(addprefix error/, error.c)
  11+SRCS		+= $(addprefix parser/, parser.c error.c)
1312 SRCS		+= $(addprefix timer/, timer.c)
1413 SRCS		+= $(NAME).c
1514 
+0, -35
    @@ -1,35 +0,0 @@
 1  -/* ************************************************************************** */
 2  -/*                                                                            */
 3  -/*                                                        :::      ::::::::   */
 4  -/*   error.h                                            :+:      :+:    :+:   */
 5  -/*                                                    +:+ +:+         +:+     */
 6  -/*   By: mleitao <marvin@42.fr>                     +#+  +:+       +#+        */
 7  -/*                                                +#+#+#+#+#+   +#+           */
 8  -/*   Created: 2026/06/30 02:24:37 by mleitao           #+#    #+#             */
 9  -/*   Updated: 2026/07/01 04:00:23 by mleitao          ###   ########.fr       */
10  -/*                                                                            */
11  -/* ************************************************************************** */
12  -
13  -#ifndef ERROR_H
14  -# define ERROR_H
15  -
16  -enum	e_err
17  -{
18  -	ERR_USAGE = -5,
19  -	ERR_NOT_DIGIT,
20  -	ERR_OVERFLOW,
21  -	ERR_ZERO,
22  -	ERR_SCHED,
23  -	OK,
24  -};
25  -
26  -typedef struct s_err
27  -{
28  -	enum e_err	code;
29  -	const char	*value;
30  -	int			index;
31  -}	t_err;
32  -
33  -void	report_error(t_err e);
34  -
35  -#endif
+16, -14
    @@ -6,31 +6,33 @@
 6 6 /*   By: mleitao <marvin@42.fr>                     +#+  +:+       +#+        */
 7 7 /*                                                +#+#+#+#+#+   +#+           */
 8 8 /*   Created: 2026/06/30 01:30:52 by mleitao           #+#    #+#             */
 9  -/*   Updated: 2026/07/01 03:10:37 by mleitao          ###   ########.fr       */
   9+/*   Updated: 2026/07/02 17:43:19 by mleitao          ###   ########.fr       */
1010 /*                                                                            */
1111 /* ************************************************************************** */
1212 
1313 #ifndef PARSER_H
1414 # define PARSER_H
1515 
16  -# include "error.h"
  16+# include "codexion.h"
1717 
18  -enum e_arg
  18+enum	e_err
1919 {
20  -	ARG_CODERS,
21  -	ARG_BURNOUT,
22  -	ARG_COMPILE,
23  -	ARG_DEBUG,
24  -	ARG_REFACTOR,
25  -	ARG_COMPILES_REQUIRED,
26  -	ARG_COOLDOWN
  20+	ERR_USAGE = -5,
  21+	ERR_NOT_DIGIT,
  22+	ERR_OVERFLOW,
  23+	ERR_ZERO,
  24+	ERR_SCHED,
  25+	OK,
2726 };
2827 
29  -typedef struct s_args
  28+typedef struct s_err
3029 {
31  -	unsigned int	v[7];
32  -	char			scheduler;
33  -}					t_args;
  30+	enum e_err	code;
  31+	const char	*value;
  32+	int			index;
  33+}	t_err;
  34+
  35+void	report_error(t_err e);
3436 
3537 t_err	parse_args(int argc, char **argv, t_args *args);
3638 
    @@ -6,11 +6,11 @@
 6 6 /*   By: mleitao <marvin@42.fr>                     +#+  +:+       +#+        */
 7 7 /*                                                +#+#+#+#+#+   +#+           */
 8 8 /*   Created: 2026/07/01 04:04:14 by mleitao           #+#    #+#             */
 9  -/*   Updated: 2026/07/01 17:27:45 by mleitao          ###   ########.fr       */
   9+/*   Updated: 2026/07/02 17:44:49 by mleitao          ###   ########.fr       */
1010 /*                                                                            */
1111 /* ************************************************************************** */
1212 
13  -#include "error.h"
  13+#include "parser.h"
1414 #include <stdio.h>
1515 
1616 static const char	*arg_name(int i)