From: Lukas Jiriste Date: Thu, 28 Nov 2024 11:09:14 +0000 (+0100) Subject: Move g_empty_token and g_eof_token definition X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=8bc4e916a725c269a563395ba50d3a200577bb19;p=Libft.git Move g_empty_token and g_eof_token definition This is done so that the actions.c file does not need its own definition. --- diff --git a/ft_parse/actions.c b/ft_parse/actions.c index 25d0203..1138708 100644 --- a/ft_parse/actions.c +++ b/ft_parse/actions.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 -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; diff --git a/ft_parse/ft_parse_inner.h b/ft_parse/ft_parse_inner.h index 7ec51e8..a9914c8 100644 --- a/ft_parse/ft_parse_inner.h +++ b/ft_parse/ft_parse_inner.h @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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); diff --git a/ft_parse/parsing_table_constructor/conversion_helpers.c b/ft_parse/parsing_table_constructor/conversion_helpers.c index 22a4a55..fb23f3e 100644 --- a/ft_parse/parsing_table_constructor/conversion_helpers.c +++ b/ft_parse/parsing_table_constructor/conversion_helpers.c @@ -6,11 +6,12 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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) diff --git a/ft_parse/parsing_table_constructor/pt_constructor.h b/ft_parse/parsing_table_constructor/pt_constructor.h index 3205910..9f99a34 100644 --- a/ft_parse/parsing_table_constructor/pt_constructor.h +++ b/ft_parse/parsing_table_constructor/pt_constructor.h @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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(