feat: starting the analyse

This commit is contained in:
Raphael 2024-09-29 13:10:35 +02:00
parent df8c6fc091
commit 8bc92d6ac9
4 changed files with 14 additions and 7 deletions

View file

@ -3,7 +3,9 @@ CompileFlags: # Tweak the parse settings
Add:
- "-xc"
- "-I/nix/store/fwh4fxd747m0py3ib3s5abamia9nrf90-glibc-2.39-52-dev/include/"
- "-I/nix/store/wxxgsgjxbnkkyczgf8lkbfrsqiywm8bi-clang-17.0.6-lib/lib/clang/17/include"
- "-I/nix/store/wxxgsgjxbnkkyczgf8lkbfrsqiywm8bi-clang-17.0.6-lib/lib/clang/17/include/"
- "-I/nix/store/3mmvgb08qy8n6n37mnprf77fnp4rssi9-glibc-2.38-27-dev/include/"
- "-I/nix/store/3jlclvmii9b6qmpqw9w09cp3zdnngvhk-clang-18.1.8/bin/clanglib/clang/17/include/"
- "-I/usr/include/"
- "-I/home/maiboyer/Documents/ring-2/shcat/vendor/"
- "-I/home/maiboyer/Documents/ring-2/shcat/stdme/include/"

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/26 17:59:23 by maiboyer #+# #+# */
/* Updated: 2024/09/28 14:52:09 by maiboyer ### ########.fr */
/* Updated: 2024/09/29 13:08:58 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -58,7 +58,7 @@ bool token_is_meta(t_token tok);
bool is_dollar(char c);
bool is_quote(char c);
bool is_space(char c);
t_error find_end_string(t_str raw, t_usize *start, t_token *output);
t_error find_end_string(t_const_str raw, t_usize *start, t_token *output);
t_error start_analyse(t_const_str raw, enum e_token list, t_vec_token *output);
t_error tokeniser(t_const_str raw, enum e_token list);

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/27 11:46:45 by rparodi #+# #+# */
/* Updated: 2024/09/28 14:49:11 by rparodi ### ########.fr */
/* Updated: 2024/09/29 13:08:27 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -37,7 +37,7 @@ bool is_quote(char c)
* @param output the token of the string
* @return Check if there is an error on this function
*/
t_error find_end_string(t_str raw, t_usize *start, t_token *output)
t_error find_end_string(t_const_str raw, t_usize *start, t_token *output)
{
char tmp;

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/25 16:27:03 by rparodi #+# #+# */
/* Updated: 2024/09/28 15:27:28 by rparodi ### ########.fr */
/* Updated: 2024/09/29 13:10:20 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -41,8 +41,13 @@ t_error start_analyse(t_const_str raw, enum e_token list, t_vec_token *output)
i = 0;
while (raw[i] != '\0')
{
if (is_space(raw[i]))
if (me_isspace(raw[i]))
token = token_new(WHITESPACE);
if (is_quote(raw[i]))
find_end_string(raw, &i, &token);
if (is_dollar(raw[i]))
token = token_new(DOLLAR);
vec_token_push(output, token);
i++;
}
return (NO_ERROR);