feat: restarting the parser with advice of maiboyer
This commit is contained in:
parent
774f374965
commit
1ba78fe873
3 changed files with 34 additions and 23 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/26 17:59:23 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/09/26 18:29:25 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/09/27 11:38:18 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -40,6 +40,4 @@ struct s_token
|
|||
enum e_token type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* TOKEN_H */
|
||||
|
|
|
|||
|
|
@ -6,39 +6,28 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/25 16:27:03 by rparodi #+# #+# */
|
||||
/* Updated: 2024/09/26 17:56:08 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/09/27 13:14:23 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "parser/token.h"
|
||||
#include "me/string/string.h"
|
||||
#include "me/types.h"
|
||||
#include "me/vec/vec_token.h"
|
||||
#include <stdio.h>
|
||||
|
||||
t_error handle_quote(t_string raw, enum e_token actual, int *output)
|
||||
t_error start_analyse(t_const_str raw, enum e_token list, t_vec_token *output)
|
||||
{
|
||||
(void)raw;
|
||||
(void)actual;
|
||||
(void)output;
|
||||
dprintf(2, "\tNOT DONE\n");
|
||||
return (ERROR);
|
||||
|
||||
}
|
||||
|
||||
t_error handle_arithmetic(t_string raw, enum e_token actual, int *output)
|
||||
{
|
||||
(void)raw;
|
||||
(void)actual;
|
||||
(void)output;
|
||||
dprintf(2, "\tNOT DONE\n");
|
||||
return (ERROR);
|
||||
}
|
||||
t_error tokeniser(t_string raw, enum e_token actual, int *output)
|
||||
t_error tokeniser(t_const_str raw, enum e_token list)
|
||||
{
|
||||
t_vec_token output;
|
||||
|
||||
if (!raw.buf || raw.len == 0 || raw.capacity == 0)
|
||||
return (ERROR);
|
||||
if (handle_quote(raw, actual, output))
|
||||
return (ERROR);
|
||||
else if (handle_arithmetic(raw, actual, output))
|
||||
return (ERROR);
|
||||
output = vec_token_new(16, NULL);
|
||||
start_analyse(raw, list, &output);
|
||||
return (NO_ERROR);
|
||||
}
|
||||
|
|
|
|||
24
parser/src/what_is_it.c
Normal file
24
parser/src/what_is_it.c
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* what_is_it.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/27 11:46:45 by rparodi #+# #+# */
|
||||
/* Updated: 2024/09/27 12:48:18 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "me/vec/vec_token.h"
|
||||
#include "parser/token.h"
|
||||
#include "me/string/string.h"
|
||||
#include "me/types.h"
|
||||
#include <stdio.h>
|
||||
|
||||
bool is_quote(char c)
|
||||
{
|
||||
if (c == '"' || c == '\'')
|
||||
return (true);
|
||||
return (false);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue