mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
fix(parsing): report unclosed ( error
This commit is contained in:
parent
527a624765
commit
0c9dcd944e
2 changed files with 21 additions and 3 deletions
|
|
@ -3,10 +3,10 @@
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* cmd_parsing.c :+: :+: :+: */
|
/* cmd_parsing.c :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: jguelen <jguelen@student.42.fr> +#+ +:+ +#+ */
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/31 10:28:28 by jguelen #+# #+# */
|
/* Created: 2025/03/31 10:28:28 by jguelen #+# #+# */
|
||||||
/* Updated: 2025/04/24 16:39:14 by jguelen ### ########.fr */
|
/* Updated: 2025/04/25 13:17:56 by khais ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -65,7 +65,7 @@ t_cmd *minishell_parse(t_minishell *app, char *command_line)
|
||||||
if (!tokens)
|
if (!tokens)
|
||||||
return (expecting_quote_error(app));
|
return (expecting_quote_error(app));
|
||||||
root_cmd = minishell_cmds_parse(app, &tokens);
|
root_cmd = minishell_cmds_parse(app, &tokens);
|
||||||
if (root_cmd == NULL && ft_errno_get() != FT_ESUCCESS)
|
if ((root_cmd == NULL && ft_errno_get() != FT_ESUCCESS) || tokens != NULL)
|
||||||
{
|
{
|
||||||
if (tokens == NULL)
|
if (tokens == NULL)
|
||||||
parse_error_newline(app);
|
parse_error_newline(app);
|
||||||
|
|
|
||||||
18
test.sh
18
test.sh
|
|
@ -1021,4 +1021,22 @@ minishell: cat: Permission denied
|
||||||
126
|
126
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
when_run <<EOF "unclosed ("
|
||||||
|
(echo unclosed paren
|
||||||
|
EOF
|
||||||
|
expecting <<"EOF"
|
||||||
|
minishell: syntax error near unexpected token `newline'
|
||||||
|
EOF
|
||||||
|
|
||||||
|
when_run <<"EOF" "unclosed ( in export"
|
||||||
|
export VAR=bon(jour
|
||||||
|
echo $?
|
||||||
|
echo var=$VAR
|
||||||
|
EOF
|
||||||
|
expecting <<"EOF"
|
||||||
|
minishell: syntax error near unexpected token `('
|
||||||
|
2
|
||||||
|
var=
|
||||||
|
EOF
|
||||||
|
|
||||||
finalize
|
finalize
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue