diff --git a/.clangd b/.clangd index 8dd00e53..9e16af3b 100644 --- a/.clangd +++ b/.clangd @@ -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/" diff --git a/parser/include/parser/token.h b/parser/include/parser/token.h index 634bc047..75f57fb9 100644 --- a/parser/include/parser/token.h +++ b/parser/include/parser/token.h @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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); diff --git a/parser/src/quotes.c b/parser/src/quotes.c index 6f9a9353..4da5bd5c 100644 --- a/parser/src/quotes.c +++ b/parser/src/quotes.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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; diff --git a/parser/src/token.c b/parser/src/token.c index 12920b74..f347bdfb 100644 --- a/parser/src/token.c +++ b/parser/src/token.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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);