Move g_empty_token and g_eof_token definition
authorLukas Jiriste <ljiriste@student.42prague.com>
Thu, 28 Nov 2024 11:09:14 +0000 (12:09 +0100)
committerLukas Jiriste <ljiriste@student.42prague.com>
Thu, 28 Nov 2024 16:00:36 +0000 (17:00 +0100)
This is done so that the actions.c file does not need its own
definition.

ft_parse/actions.c
ft_parse/ft_parse_inner.h
ft_parse/parsing_table_constructor/conversion_helpers.c
ft_parse/parsing_table_constructor/pt_constructor.h

index 25d02036248bb5381c4278d1d7fac631737ebcda..1138708f49b93c882a8951e7e234016c1b09e10f 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/06/21 15:34:14 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/11/26 11:49:20 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/11/28 12:07:58 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -15,8 +15,6 @@
 #include "libft.h"
 #include <stdlib.h>
 
-static const t_token   g_empty_token = {.type = "''", .str = NULL};
-
 int    push_state(t_stack *stack, size_t state_num, t_token token)
 {
        t_parser_stack_element  element;
index 7ec51e8c31bbce67f882102554d2ec1bf67f1c42..a9914c8cc7a34ab9d35b616d92b6c0c5a171d752 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/06/20 13:23:20 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/11/28 11:54:35 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/11/28 12:08:46 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -15,6 +15,9 @@
 
 # include "libft.h"
 
+static const t_token   g_eof_token = {.type = "$", .str = NULL};
+static const t_token   g_empty_token = {.type = "''", .str = NULL};
+
 void                   ft_free_token(void *v_token);
 void                   ft_free_rule(void *v_rule);
 void                   ft_free_state(void *v_state);
index 22a4a5592828d4811bf70f9720dee388e3bd9407..fb23f3ee6efe408f5c1d9507a5cfa704b41a8619 100644 (file)
@@ -6,11 +6,12 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/11/26 16:35:11 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/11/27 11:12:16 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/11/28 15:26:22 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #include "pt_constructor.h"
+#include "../ft_parse_inner.h"
 #include "libft.h"
 
 static void    add_shift(t_parser_action *action, const ssize_t *goto_state)
index 3205910d9a78b12e0a32570b98f40b5d6836841a..9f99a34a3e7703db4f7065e74565c3cfb35eb9e7 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/11/26 16:57:15 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/11/28 11:19:11 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/11/28 12:07:50 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -36,9 +36,6 @@ typedef struct s_generator_state
        size_t  state_number;
 }                      t_generator_state;
 
-static const t_token   g_eof_token = {.type = "$", .str = NULL};
-static const t_token   g_empty_token = {.type = "''", .str = NULL};
-
 int                            cmp_token_type(const t_token *token1, const t_token *token2);
 int                            void_cmp_token_type(const void *v_token1, const void *v_token2);
 int                            cmp_rules(