diff options
| -rw-r--r-- | include/lexer.h | 9 | ||||
| -rw-r--r-- | src/lexer/lexer.c | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/include/lexer.h b/include/lexer.h index 8d7a81f..fd8972e 100644 --- a/include/lexer.h +++ b/include/lexer.h @@ -6,7 +6,7 @@ /* By: nahaddac <nahaddac@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/06/19 10:51:26 by nahaddac #+# #+# */ -/* Updated: 2020/09/09 17:50:01 by charles ### ########.fr */ +/* Updated: 2020/09/10 06:17:43 by nahaddac ### ########.fr */ /* */ /* ************************************************************************** */ @@ -68,6 +68,13 @@ t_tok_lst *tok_lst_take_sticked(t_tok_lst **tokens); */ t_tok_lst *lexer(char *input); +int check_input(char *input); +int len_until_sep(char *input); +int check_input_out(char *input); +enum e_tok token_check_stick(t_tok_lst *tok); +enum e_tok token_str_or_quote(t_tok_lst *tok); +t_tok_lst *create_token_list(char *input, t_tok_lst **lst); +void push_token_enum(t_tok_lst *tok); void push_token_enum(t_tok_lst *tok); /* diff --git a/src/lexer/lexer.c b/src/lexer/lexer.c index 60e77a3..57aee6b 100644 --- a/src/lexer/lexer.c +++ b/src/lexer/lexer.c @@ -6,7 +6,7 @@ /* By: nahaddac <nahaddac@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/07/16 08:18:25 by nahaddac #+# #+# */ -/* Updated: 2020/09/10 05:06:11 by nahaddac ### ########.fr */ +/* Updated: 2020/09/10 06:40:10 by nahaddac ### ########.fr */ /* */ /* ************************************************************************** */ @@ -26,6 +26,8 @@ int len_until_sep(char *input) if (input[i] == '\\') i += len_until_sep(&input[i]); i += lexer_space(&input[i]); + if (input[i] != lexer_sep(input[i]) || input[i] != 39 || input[i] != '"') + i += len_until_sep(&input[i]); return i; } if (lexer_sep(input[i])) @@ -82,7 +84,8 @@ int check_input(char *input) ; return (i); } - return(len_until_sep(&input[i])); + i = len_until_sep(&input[i]); + return i; } @@ -154,7 +157,7 @@ void push_token_enum(t_tok_lst *tok) tok->tag = tag; } -static t_tok_lst *create_token_list(char *input, t_tok_lst **lst) +t_tok_lst *create_token_list(char *input, t_tok_lst **lst) { t_tok_lst *tok; size_t i; |
