Fix tokenization bug introduced in aac1d76
authorLukáš Jiřiště <jiriste@icpf.cas.cz>
Mon, 26 Aug 2024 10:08:16 +0000 (12:08 +0200)
committerLukáš Jiřiště <jiriste@icpf.cas.cz>
Mon, 26 Aug 2024 11:25:06 +0000 (13:25 +0200)
In commit aac1d76 the tokenization was changed to set ASSIGNMENT_WORDs
to WORDs when the ASSIGNMENT_WORD is not in a proper place.
The filter however didn't check whether current token is ASSIGNMENT_WORD
hence other tokens could be changed to WORD also.

src/tokenization.c

index 2c3839238cc8a68afd57a598a48cbd3bb9916ad9..679dbd5d284da02218dc75eda1dcc9a012ecd358 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/06/21 16:34:43 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/08/23 18:43:53 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/08/26 12:07:29 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -235,7 +235,7 @@ void        filter_assignment_word(t_vec *tokens)
        while (i < tokens->size)
        {
                token = ft_vec_access(tokens, i);
-               if (i == 0)
+               if (i == 0 || token->type != g_tokens[ASSIGNMENT_WORD])
                {
                        ++i;
                        continue ;