update: added debug print of ts after every pass
This commit is contained in:
parent
7cb3582b1a
commit
71d9a201b5
9 changed files with 172 additions and 39 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/02 18:43:41 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/10/05 18:03:54 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/10/05 18:42:17 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -37,14 +37,16 @@ t_error ts_dq_apply_passes(t_vec_token ts, t_vec_token *out);
|
|||
// this is a example one, does absolutly nothing lol
|
||||
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);
|
||||
t_error ts_double_pipe(t_vec_token input, t_vec_token *output);
|
||||
t_error ts_double_rcarret(t_vec_token input, t_vec_token *output);
|
||||
t_error ts_double_rparen(t_vec_token input, t_vec_token *output);
|
||||
t_error ts_double_string_pass(t_vec_token input, t_vec_token *output);
|
||||
t_error ts_fold_no_quote(t_vec_token input, t_vec_token *output);
|
||||
t_error ts_fold_whitespace(t_vec_token input, t_vec_token *output);
|
||||
t_error ts_do_fuck_all(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_expension(t_vec_token input, t_vec_token *output);
|
||||
t_error ts_fold_redir(t_vec_token input, t_vec_token *output);
|
||||
|
||||
|
||||
#endif /* PASSES_H */
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/26 17:59:23 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/10/05 18:02:03 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/10/05 18:54:13 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -18,28 +18,31 @@
|
|||
|
||||
enum e_token
|
||||
{
|
||||
TOK_NONE, // NO TOKEN TYPE == INVALID / INEXISTANT TOKEN
|
||||
TOK_AEXP, // a meta token, artih expansion
|
||||
TOK_AMP, // ampersand == &
|
||||
TOK_AND, // and == &&
|
||||
TOK_CARRET, // any carret == < > << >>
|
||||
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 == $<no_quote_word>; 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 <OPERATOR> 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_NALPHANUM, // a non alphanumeric character, used in the expansion folding, then folded back into NQUOTE
|
||||
TOK_WORD, // a meta token, which contains subtokens
|
||||
TOK_REDIR, // a meta token, which contains <OPERATOR> being an [D](L|R)CARRET and the arg being a WORD
|
||||
};
|
||||
|
||||
typedef struct s_token
|
||||
|
|
@ -61,6 +64,7 @@ void token_free(t_token tok);
|
|||
bool token_is_meta(t_token tok);
|
||||
bool token_is_noquote(enum e_token tok);
|
||||
|
||||
void ts_print(t_vec_token *ts);
|
||||
/* PARSING */
|
||||
t_error tokenize(t_const_str s, t_vec_token *out);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue