update: base of tokenizer

This commit is contained in:
maix0 2024-09-30 20:25:03 +02:00
parent 24d8bf5fc9
commit b5556b9063
10 changed files with 215 additions and 219 deletions

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/26 17:59:23 by maiboyer #+# #+# */
/* Updated: 2024/09/29 13:30:06 by rparodi ### ########.fr */
/* Updated: 2024/09/30 19:47:53 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,25 +18,26 @@
enum e_token
{
AMP, // ampersand == &
AND, // and == &&
CARRET, // any carret == < > << >>
DLCARRET, // double left carret == <<
DOLLAR, // dollar == $
DQUOTE, // double quote string
DRCARRET, // double right carret == >>
EXPENSION, // an expension == $<no_quote_word>
LCARRET, // left carret == <
LPAREN, // left parenthesis == (
NQUOTE, // no quote string
OR, // or == ||
PIPE, // pipe == |
RCARRET, // right carret == >
RPAREN, // right parenthesis == )
SEMICOLON, // semicolor == ;
SQUOTE, // single quote string
WHITESPACE, // whitespace outside of quoted strings
WORD, // a meta token, which contains subtokens
TOK_NONE, // NO TOKEN TYPE == INVALID / INEXISTANT TOKEN
TOK_AMP, // ampersand == &
TOK_AND, // and == &&
TOK_CARRET, // any carret == < > << >>
TOK_DLCARRET, // double left carret == <<
TOK_DOLLAR, // dollar == $
TOK_DQUOTE, // double quote string
TOK_DRCARRET, // double right carret == >>
TOK_EXPENSION, // an expension == $<no_quote_word>
TOK_LCARRET, // left carret == <
TOK_LPAREN, // left parenthesis == (
TOK_NQUOTE, // no quote string
TOK_OR, // or == ||
TOK_PIPE, // pipe == |
TOK_RCARRET, // right carret == >
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
};
typedef struct s_token
@ -51,6 +52,7 @@ typedef struct s_token
t_token token_new_meta(enum e_token type);
// This create a "simple" token consisting of a string
t_token token_new(enum e_token type);
t_token token_new_none(void);
void token_free(t_token tok);
bool token_is_meta(t_token tok);