Adding the files normed (Not possible yet for the from node)

This commit is contained in:
Raphael 2024-08-02 12:55:03 +02:00
parent e7e395ed10
commit 1c840b41fd
8 changed files with 141 additions and 138 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/26 10:55:52 by rparodi #+# #+# */
/* Updated: 2024/08/01 13:48:22 by maiboyer ### ########.fr */
/* Updated: 2024/08/02 12:54:11 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -119,7 +119,7 @@ t_vec_ast *_vec_command(t_ast_command *val, t_usize i)
void _add_negation(t_ast_node *node)
{
if (node == NULL || *node == NULL)
return;
return ;
if ((*node)->kind == AST_PIPELINE)
(*node)->data.pipeline.bang = true;
if ((*node)->kind == AST_COMMAND)
@ -137,7 +137,8 @@ void _append_redirection(t_ast_node node, t_ast_node redirection)
t_vec_ast *vec;
vec = NULL;
if (!(redirection->kind == AST_FILE_REDIRECTION || redirection->kind == AST_HEREDOC_REDIRECTION))
if (!(redirection->kind == AST_FILE_REDIRECTION || \
redirection->kind == AST_HEREDOC_REDIRECTION))
return (ast_free(redirection));
if (node->kind == AST_CASE)
vec = &node->data.case_.suffixes_redirections;

15
flake.lock generated
View file

@ -227,14 +227,17 @@
},
"nixpkgs_5": {
"locked": {
"lastModified": 0,
"narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=",
"path": "/nix/store/qgbn0imyridkb9527v6gnv6z3jzzprb9-source",
"type": "path"
"lastModified": 1722523718,
"narHash": "sha256-QygJr6Nk5Fuc9LNGcdyiqAchIwTzN/9m/3cVJp3qH/4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "849492e6e2fae04a8add2e2fe692503f96ad1587",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_6": {

View file

@ -1,6 +1,7 @@
{
description = "Flake utils demo";
inputs.nixpkgs.url = "github:nixos/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.generic_c.url = "github:Maix0/generic_c";
inputs.c_formatter_42.url = "github:Maix0/c_formatter_42-flake";
@ -40,9 +41,6 @@
c_formatter_42.packages.${system}.default
llvmPackages.bintools
norminette
rust-bin.stable.latest.default
#(tree-sitter.override {webUISupport = true;})
nodejs
];
VALGRIND_INC_OPT = "${pkgs.valgrind.dev}/include";
ASAN_OPTIONS = "strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1";

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/04 18:32:50 by maiboyer #+# #+# */
/* Updated: 2024/05/21 14:55:11 by maiboyer ### ########.fr */
/* Updated: 2024/08/02 12:09:05 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -58,7 +58,7 @@ t_error _build_envp_iterator(t_usize idx, const t_str *key, t_str *val,
(void)(idx);
s = ctx;
if (string_push(&s->buf, *key) || string_push(&s->buf, "=") ||
if (string_push(&s->buf, *key) || string_push(&s->buf, "=") || \
string_push(&s->buf, *val))
return (vec_str_free(s->out), ERROR);
push = str_clone(s->buf.buf);

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/29 11:35:51 by rparodi #+# #+# */
/* Updated: 2024/07/31 17:08:05 by maiboyer ### ########.fr */
/* Updated: 2024/08/02 12:09:53 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */
/* Updated: 2024/07/31 17:07:37 by maiboyer ### ########.fr */
/* Updated: 2024/08/02 12:16:09 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -34,7 +34,11 @@ void ft_exit(t_state *maiboyerlpb, t_u8 exit_status);
// cle avant le =
// data apres le =
t_error split_str_first(t_const_str s, char splitter, t_str *before, t_str *after)
t_language *tree_sitter_sh(void);
void ast_free(t_ast_node node);
t_error split_str_first(t_const_str s, char splitter, \
t_str *before, t_str *after)
{
t_usize i;
@ -79,7 +83,7 @@ void print_node_data(t_node *t, t_usize depth)
idx = 0;
if (t->kind == 7)
return;
return ;
printf("\x1b[%im[%-6s](%lu)\x1b[0m", t->field_str == NULL ? 90 : 32, t->field_str == NULL ? "nil" : t->field_str, t->field);
while (idx++ < depth + 1)
printf("\t");
@ -91,8 +95,6 @@ void print_node_data(t_node *t, t_usize depth)
t_node parse_to_nodes(t_first_parser *parser, t_const_str input)
{
void ast_free(t_ast_node node);
t_first_tree *tree;
t_parse_node node;
t_node ret;
@ -157,8 +159,6 @@ void ft_take_args(t_state *state)
}
}
t_language *tree_sitter_sh(void);
t_parser create_myparser(void)
{
t_language *lang;
@ -175,10 +175,11 @@ void free_myparser(t_parser self)
ts_parser_delete(self.parser);
}
// char truc[] = COLB_YELLOW "42sh" COL_GREEN ">" COL_WHITE "$ " RESET;
t_i32 main(t_i32 argc, t_str argv[], t_str envp[])
{
t_state state;
// char truc[] = COLB_YELLOW "42sh" COL_GREEN ">" COL_WHITE "$ " RESET;
(void)argc;
(void)argv;

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/28 18:36:40 by maiboyer #+# #+# */
/* Updated: 2024/07/02 13:11:18 by maiboyer ### ########.fr */
/* Updated: 2024/08/02 12:17:33 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/02 13:22:14 by maiboyer #+# #+# */
/* Updated: 2024/07/24 16:02:17 by maiboyer ### ########.fr */
/* Updated: 2024/08/02 12:17:50 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */