diff --git a/includes/app/state.h b/includes/app/state.h index 47ef71cf..ab57830e 100644 --- a/includes/app/state.h +++ b/includes/app/state.h @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/02 15:49:56 by maiboyer #+# #+# */ -/* Updated: 2024/10/06 14:20:09 by maiboyer ### ########.fr */ +/* Updated: 2024/10/12 15:35:52 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,13 +22,12 @@ typedef struct s_state t_state; struct s_state { + t_ast_node ast; t_const_str prompt; - t_str str_input; t_hashmap_env *env; t_hashmap_env *tmp_var; - void *parser; - t_ast_node ast; t_i32 last_exit; + t_str str_input; }; #endif /* STATE_H */ diff --git a/parser/include/parser/passes.h b/parser/include/parser/passes.h index b6966301..49e330fe 100644 --- a/parser/include/parser/passes.h +++ b/parser/include/parser/passes.h @@ -6,37 +6,34 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/02 18:43:41 by maiboyer #+# #+# */ -/* Updated: 2024/10/10 15:27:32 by maiboyer ### ########.fr */ +/* Updated: 2024/10/12 15:38:12 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef PASSES_H -#define PASSES_H +# define PASSES_H -#include "me/types.h" -#include "me/vec/vec_token.h" -#include "parser/token.h" +# include "me/types.h" +# include "me/vec/vec_token.h" +# include "parser/token.h" -typedef t_error (*t_ts_pass)(t_vec_token input, t_vec_token *output); +typedef t_error (*t_ts_pass)(t_vec_token input, t_vec_token *output); struct s_ts_pass_def { t_ts_pass fn; - t_const_str name; + t_const_str name; }; -t_error ts_apply_passes(t_vec_token ts, t_vec_token *out); +t_error ts_apply_passes(t_vec_token ts, t_vec_token *out); // This function is to apply stuff on doublequote meta token // You shouldn't have to use it ! // It *may* disapear/change/whatever -t_error ts_dq_apply_passes(t_vec_token ts, t_vec_token *out); +t_error ts_dq_apply_passes(t_vec_token ts, t_vec_token *out); // list passes function here -// this is a example one, does absolutly nothing lol -t_error ts_do_fuck_all(t_vec_token input, t_vec_token *output); - t_error ts_double_amp(t_vec_token input, t_vec_token *output); t_error ts_double_lcarret(t_vec_token input, t_vec_token *output); t_error ts_double_lparen(t_vec_token input, t_vec_token *output); @@ -51,8 +48,8 @@ t_error ts_fold_whitespace(t_vec_token input, t_vec_token *output); t_error ts_paren_to_noquote(t_vec_token input, t_vec_token *output); t_error ts_split_paren(t_vec_token input, t_vec_token *output); t_error ts_verify_tokens(t_vec_token input, t_vec_token *output); -t_error ts_fold_expension(t_vec_token input, t_vec_token *output); -t_error ts_fold_redir(t_vec_token input, t_vec_token *output); -t_error ts_remove_whitespace(t_vec_token input, t_vec_token *output); +t_error ts_fold_expension(t_vec_token input, t_vec_token *output); +t_error ts_fold_redir(t_vec_token input, t_vec_token *output); +t_error ts_remove_whitespace(t_vec_token input, t_vec_token *output); #endif /* PASSES_H */ diff --git a/parser/include/parser/token.h b/parser/include/parser/token.h index e679fa14..23a9cd23 100644 --- a/parser/include/parser/token.h +++ b/parser/include/parser/token.h @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/26 17:59:23 by maiboyer #+# #+# */ -/* Updated: 2024/10/07 16:45:34 by maiboyer ### ########.fr */ +/* Updated: 2024/10/12 15:37:11 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,32 +18,32 @@ enum e_token { - TOK_AEXP, // a meta token, artih expansion - TOK_AMP, // ampersand == & - TOK_AND, // and == && - TOK_CARRET, // any carret == < > << >> - TOK_CMD, // a meta token, which contains subtokens - TOK_DLCARRET, // double left carret == << - TOK_DLPAREN, // double left parenthesis '((' - TOK_DOLLAR, // dollar == $ - TOK_DQUOTE, // double quote string - TOK_DRCARRET, // double right carret == >> - TOK_DRPAREN, // double right parenthesis '))' - TOK_EXPENSION, // an expension == $; the $ is not in .string - TOK_LCARRET, // left carret == < - TOK_LPAREN, // left parenthesis == ( - TOK_NALPHANUM, // a non alphanumeric character, used in the expansion folding, then folded back into NQUOTE - TOK_NONE, // NO TOKEN TYPE == INVALID / INEXISTANT TOKEN - TOK_NQUOTE, // no quote string - TOK_OR, // or == || - TOK_PIPE, // pipe == | - TOK_RCARRET, // right carret == > - TOK_REDIR, // a meta token, which contains being an [D](L|R)CARRET and the arg being a WORD - TOK_RPAREN, // right parenthesis == ) - TOK_SEMICOLON, // semicolor == ; - TOK_SQUOTE, // single quote string - TOK_WHITESPACE, // whitespace outside of quoted strings - TOK_WORD, // a meta token, which contains subtokens + TOK_AEXP, + TOK_AMP, + TOK_AND, + TOK_CARRET, + TOK_CMD, + TOK_DLCARRET, + TOK_DLPAREN, + TOK_DOLLAR, + TOK_DQUOTE, + TOK_DRCARRET, + TOK_DRPAREN, + TOK_EXPENSION, + TOK_LCARRET, + TOK_LPAREN, + TOK_NALPHANUM, + TOK_NONE, + TOK_NQUOTE, + TOK_OR, + TOK_PIPE, + TOK_RCARRET, + TOK_REDIR, + TOK_RPAREN, + TOK_SEMICOLON, + TOK_SQUOTE, + TOK_WHITESPACE, + TOK_WORD, }; typedef struct s_token