update: made some changes
This commit is contained in:
parent
32afaabbbc
commit
3ee9c00d5a
6 changed files with 100 additions and 25 deletions
|
|
@ -6,29 +6,37 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/26 17:59:23 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/09/28 11:45:54 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/09/28 14:52:09 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TOKEN_H
|
||||
#define TOKEN_H
|
||||
# define TOKEN_H
|
||||
|
||||
#include "me/string/string.h"
|
||||
#include "me/vec/vec_token.h"
|
||||
# include "me/string/string.h"
|
||||
# include "me/vec/vec_token.h"
|
||||
|
||||
enum e_token
|
||||
{
|
||||
AMP,
|
||||
CARRET,
|
||||
DOLLAR,
|
||||
DQUOTE,
|
||||
LPAREN,
|
||||
NQUOTE,
|
||||
PIPE,
|
||||
RPAREN,
|
||||
SEMICOLON,
|
||||
SQUOTE,
|
||||
WHITESPACE
|
||||
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
|
||||
};
|
||||
|
||||
typedef struct s_token
|
||||
|
|
@ -38,6 +46,15 @@ typedef struct s_token
|
|||
enum e_token type;
|
||||
} t_token;
|
||||
|
||||
/* LIFETIME */
|
||||
// This create a "meta" token consisting of multiple tokens
|
||||
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);
|
||||
void token_free(t_token tok);
|
||||
bool token_is_meta(t_token tok);
|
||||
|
||||
/* PARSING */
|
||||
bool is_dollar(char c);
|
||||
bool is_quote(char c);
|
||||
bool is_space(char c);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue