Make variable assignment possible in subshell
authorLukáš Jiřiště <jiriste@icpf.cas.cz>
Wed, 28 Aug 2024 08:34:29 +0000 (10:34 +0200)
committerLukáš Jiřiště <jiriste@icpf.cas.cz>
Wed, 28 Aug 2024 08:41:29 +0000 (10:41 +0200)
Because of ASSIGNMENT_WORD filtering, subshell needs a special rule (the
same as AND_IF, OR_IF) to permit variable assignment to be recognized
imediatelly after subshell starts.

src/tokenization.c

index d41179d046f39c3acd26ffd547ad3179c1983731..5f5114a879ab7ed64b616ac0b9aaca78b6608c38 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/06/21 16:34:43 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/08/27 13:36:27 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/08/28 10:32:02 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -211,7 +211,8 @@ void        filter_assignment_word(t_vec *tokens)
                prev_token = ft_vec_caccess(tokens, i - 1);
                if (prev_token->type == g_tokens[ASSIGNMENT_WORD]
                                || prev_token->type == g_tokens[AND_IF]
-                               || prev_token->type == g_tokens[OR_IF])
+                               || prev_token->type == g_tokens[OR_IF]
+                               || prev_token->type == g_tokens[LPARA])
                {
                        ++i;
                        continue ;