Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/tokenizer/is_quote_closed.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: ttsubo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/15 13:59:15 by ttsubo #+# #+# */
/* Updated: 2025/04/27 15:16:12 by ttsubo ### ########.fr */
/* Updated: 2025/04/29 14:57:34 by ttsubo ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -33,9 +33,5 @@ int is_quote_closed(char *str)
in_dquote = !in_dquote;
str++;
}
if (in_squote)
show_tokenizer_error(ERR_SQ_UNCLOSED);
if (in_dquote)
show_tokenizer_error(ERR_DQ_UNCLOSED);
return (!(in_squote || in_dquote));
}
6 changes: 4 additions & 2 deletions src/tokenizer/read_token.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: ttsubo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/15 16:33:33 by ttsubo #+# #+# */
/* Updated: 2025/04/25 22:20:42 by ttsubo ### ########.fr */
/* Updated: 2025/04/29 15:20:11 by ttsubo ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -21,7 +21,8 @@ static char *_read_quoted_token(t_tokenizer *tkn)
start = tkn->pos++;
while (tkn->input[tkn->pos] && tkn->input[tkn->pos] != quote)
tkn->pos++;
tkn->pos++;
if (tkn->input[tkn->pos] == quote)
tkn->pos++;
return (ft_substr(tkn->input, start, tkn->pos - start));
}

Expand All @@ -44,6 +45,7 @@ static char *_read_word_token(t_tokenizer *tkn)
start = tkn->pos;
while (tkn->input[tkn->pos]
&& !ft_isspace(tkn->input[tkn->pos])
&& !(tkn->input[tkn->pos] == '\'' || tkn->input[tkn->pos] == '"')
&& tkn->input[tkn->pos] != '|'
&& tkn->input[tkn->pos] != '>'
&& tkn->input[tkn->pos] != '<')
Expand Down
4 changes: 1 addition & 3 deletions src/tokenizer/tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: ttsubo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/15 12:35:38 by ttsubo #+# #+# */
/* Updated: 2025/04/27 15:05:30 by ttsubo ### ########.fr */
/* Updated: 2025/04/29 14:58:23 by ttsubo ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -31,8 +31,6 @@ char **tokenizer(char *str)
t_tokenizer tkn;

tkn = (t_tokenizer){.input = str, .pos = 0, .in_squote = 0, .in_dquote = 0};
if (!is_quote_closed(str))
return (NULL);
if (!is_redirect_validate(str))
return (NULL);
tokens = ft_calloc(get_token_capa(str) + 1, sizeof(char *));
Expand Down