syntax analysis with simplified shell grammar

+ TODO : bug to fix in lexer.c
This commit is contained in:
LuckyLaszlo
2021-10-24 19:58:19 +02:00
parent 906074d2cb
commit 815cedb8ca
11 changed files with 400 additions and 18 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/19 08:38:55 by lperrey #+# #+# */
/* Updated: 2021/10/19 20:11:31 by lperrey ### ########.fr */
/* Updated: 2021/10/24 19:53:40 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -43,6 +43,8 @@ t_token *input_to_tokens(char *input)
return (t_head);
}
// TODO : Fix final space saved after a pipe like in "cmd | "
// "cmd | " should behave like "cmd |"
static int tokenize_input(t_token *t, char *input, size_t input_len)
{
int i;
@@ -63,8 +65,10 @@ static int tokenize_input(t_token *t, char *input, size_t input_len)
t_i = 0;
}
}
if (!t->id)
if (!t->id && t_i) // Fix parser syntax, but last elem must still be free
t->id = T_WORD;
/* if (!t->id)
t->id = T_WORD; */
return (1);
}