normed: includes
This commit is contained in:
parent
43d394ba32
commit
7bb95e24a6
3 changed files with 42 additions and 46 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/05/02 15:49:56 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
|
struct s_state
|
||||||
{
|
{
|
||||||
|
t_ast_node ast;
|
||||||
t_const_str prompt;
|
t_const_str prompt;
|
||||||
t_str str_input;
|
|
||||||
t_hashmap_env *env;
|
t_hashmap_env *env;
|
||||||
t_hashmap_env *tmp_var;
|
t_hashmap_env *tmp_var;
|
||||||
void *parser;
|
|
||||||
t_ast_node ast;
|
|
||||||
t_i32 last_exit;
|
t_i32 last_exit;
|
||||||
|
t_str str_input;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* STATE_H */
|
#endif /* STATE_H */
|
||||||
|
|
|
||||||
|
|
@ -6,37 +6,34 @@
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/10/02 18:43:41 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
|
#ifndef PASSES_H
|
||||||
#define PASSES_H
|
# define PASSES_H
|
||||||
|
|
||||||
#include "me/types.h"
|
# include "me/types.h"
|
||||||
#include "me/vec/vec_token.h"
|
# include "me/vec/vec_token.h"
|
||||||
#include "parser/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
|
struct s_ts_pass_def
|
||||||
{
|
{
|
||||||
t_ts_pass fn;
|
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
|
// This function is to apply stuff on doublequote meta token
|
||||||
// You shouldn't have to use it !
|
// You shouldn't have to use it !
|
||||||
// It *may* disapear/change/whatever
|
// 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
|
// 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_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_lcarret(t_vec_token input, t_vec_token *output);
|
||||||
t_error ts_double_lparen(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_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_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_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_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_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_remove_whitespace(t_vec_token input, t_vec_token *output);
|
||||||
|
|
||||||
#endif /* PASSES_H */
|
#endif /* PASSES_H */
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/09/26 17:59:23 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
|
enum e_token
|
||||||
{
|
{
|
||||||
TOK_AEXP, // a meta token, artih expansion
|
TOK_AEXP,
|
||||||
TOK_AMP, // ampersand == &
|
TOK_AMP,
|
||||||
TOK_AND, // and == &&
|
TOK_AND,
|
||||||
TOK_CARRET, // any carret == < > << >>
|
TOK_CARRET,
|
||||||
TOK_CMD, // a meta token, which contains subtokens
|
TOK_CMD,
|
||||||
TOK_DLCARRET, // double left carret == <<
|
TOK_DLCARRET,
|
||||||
TOK_DLPAREN, // double left parenthesis '(('
|
TOK_DLPAREN,
|
||||||
TOK_DOLLAR, // dollar == $
|
TOK_DOLLAR,
|
||||||
TOK_DQUOTE, // double quote string
|
TOK_DQUOTE,
|
||||||
TOK_DRCARRET, // double right carret == >>
|
TOK_DRCARRET,
|
||||||
TOK_DRPAREN, // double right parenthesis '))'
|
TOK_DRPAREN,
|
||||||
TOK_EXPENSION, // an expension == $<no_quote_word>; the $ is not in .string
|
TOK_EXPENSION,
|
||||||
TOK_LCARRET, // left carret == <
|
TOK_LCARRET,
|
||||||
TOK_LPAREN, // left parenthesis == (
|
TOK_LPAREN,
|
||||||
TOK_NALPHANUM, // a non alphanumeric character, used in the expansion folding, then folded back into NQUOTE
|
TOK_NALPHANUM,
|
||||||
TOK_NONE, // NO TOKEN TYPE == INVALID / INEXISTANT TOKEN
|
TOK_NONE,
|
||||||
TOK_NQUOTE, // no quote string
|
TOK_NQUOTE,
|
||||||
TOK_OR, // or == ||
|
TOK_OR,
|
||||||
TOK_PIPE, // pipe == |
|
TOK_PIPE,
|
||||||
TOK_RCARRET, // right carret == >
|
TOK_RCARRET,
|
||||||
TOK_REDIR, // a meta token, which contains <OPERATOR> being an [D](L|R)CARRET and the arg being a WORD
|
TOK_REDIR,
|
||||||
TOK_RPAREN, // right parenthesis == )
|
TOK_RPAREN,
|
||||||
TOK_SEMICOLON, // semicolor == ;
|
TOK_SEMICOLON,
|
||||||
TOK_SQUOTE, // single quote string
|
TOK_SQUOTE,
|
||||||
TOK_WHITESPACE, // whitespace outside of quoted strings
|
TOK_WHITESPACE,
|
||||||
TOK_WORD, // a meta token, which contains subtokens
|
TOK_WORD,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct s_token
|
typedef struct s_token
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue