aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------minishell_test0
-rw-r--r--src/lexer/lexer.c4
-rw-r--r--src/parse/parse_error.c132
3 files changed, 67 insertions, 69 deletions
diff --git a/minishell_test b/minishell_test
-Subproject 8a97914ac822703362c22bb6228905f3fbe13d9
+Subproject df5bd1352d817d12061f4af5bdaf1bf19211ebc
diff --git a/src/lexer/lexer.c b/src/lexer/lexer.c
index ca4c933..0551648 100644
--- a/src/lexer/lexer.c
+++ b/src/lexer/lexer.c
@@ -6,7 +6,7 @@
/* By: nahaddac <nahaddac@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/16 08:18:25 by nahaddac #+# #+# */
-/* Updated: 2020/07/17 10:18:24 by nahaddac ### ########.fr */
+/* Updated: 2020/07/17 12:45:41 by nahaddac ### ########.fr */
/* */
/* ************************************************************************** */
@@ -47,9 +47,7 @@ int check_input(char *input)
i = 0;
op = 1;
if (input[i] == '\\' && lexer_sep(input[i + 1]))
- {
i += 2;
- }
if (input[i] == '(' || input[i] == ')')
return (i + 1);
if (lexer_sep(input[i]))
diff --git a/src/parse/parse_error.c b/src/parse/parse_error.c
index 6df86e2..42d46ea 100644
--- a/src/parse/parse_error.c
+++ b/src/parse/parse_error.c
@@ -6,7 +6,7 @@
/* By: nahaddac <nahaddac@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/06/18 15:09:48 by nahaddac #+# #+# */
-/* Updated: 2020/07/15 18:31:51 by charles ### ########.fr */
+/* Updated: 2020/07/17 11:24:23 by nahaddac ### ########.fr */
/* */
/* ************************************************************************** */
@@ -28,68 +28,68 @@
// return first;
// }
-int out_error_first(t_token *tk)
-{
- int i;
-
- i = 0;
- if(tk->tag & TAG_IS_SEP)
- return(1);
- if (tk->tag & TAG_IS_REDIR)
- {
- while(tk->content[i])
- i++;
- if (tk->tag & TAG_REDIR_APPEND && i <= 2)
- return (0);
- else
- return(1);
- }
- return(0);
-}
-
-t_token *error_syntax_simple(t_ftlst *in)
-{
- t_token *tk;
- size_t i;
- /* t_ftlst *first; */
-
- tk = in->data;
- /* first = in; */
- if(tk->tag & TAG_IS_SEP || (tk->tag & TAG_IS_REDIR))
- {
- if (out_error_first(tk))
- {
- i = ft_strlen(tk->content);
- if (i >= 2)
- tk->content[2] = '\0';
- tk->content =
- ft_strjoin3("minishell: syntax error near unexpected token `",
- tk->content, "'");
- return(tk);
- }
- }
- while(in != NULL)
- {
- i = 0;
- tk = in->data;
- if(tk->tag & TAG_IS_SEP || (tk->tag & TAG_IS_REDIR))
- {
- if (((t_token *)in->next->data)->tag &
- ((t_token*)in->next->data)->tag & TAG_IS_SEP ||
- (((t_token*)in->next->data)->tag & TAG_IS_REDIR))
- {
- tk = in->next->data;
- i = ft_strlen(tk->content);
- if (i >= 3)
- tk->content[2] = '\0';
- tk->content =
- ft_strjoin3("minishell: syntax error near unexpected token `",
- tk->content, "'");
- printf("%s\n",tk->content );
- return(tk);
- }
- }
- in = in->next;
- }
- return 0;
-}
+// int out_error_first(t_token *tk)
+// {
+// int i;
+//
+// i = 0;
+// if(tk->tag & TAG_IS_SEP)
+// return(1);
+// if (tk->tag & TAG_IS_REDIR)
+// {
+// while(tk->content[i])
+// i++;
+// if (tk->tag & TAG_REDIR_APPEND && i <= 2)
+// return (0);
+// else
+// return(1);
+// }
+// return(0);
+// }
+//
+// t_token *error_syntax_simple(t_ftlst *in)
+// {
+// t_token *tk;
+// size_t i;
+// /* t_ftlst *first; */
+//
+// tk = in->data;
+// /* first = in; */
+// if(tk->tag & TAG_IS_SEP || (tk->tag & TAG_IS_REDIR))
+// {
+// if (out_error_first(tk))
+// {
+// i = ft_strlen(tk->content);
+// if (i >= 2)
+// tk->content[2] = '\0';
+// tk->content =
+// ft_strjoin3("minishell: syntax error near unexpected token `",
+// tk->content, "'");
+// return(tk);
+// }
+// }
+// while(in != NULL)
+// {
+// i = 0;
+// tk = in->data;
+// if(tk->tag & TAG_IS_SEP || (tk->tag & TAG_IS_REDIR))
+// {
+// if (((t_token *)in->next->data)->tag &
+// ((t_token*)in->next->data)->tag & TAG_IS_SEP ||
+// (((t_token*)in->next->data)->tag & TAG_IS_REDIR))
+// {
+// tk = in->next->data;
+// i = ft_strlen(tk->content);
+// if (i >= 3)
+// tk->content[2] = '\0';
+// tk->content =
+// ft_strjoin3("minishell: syntax error near unexpected token `",
+// tk->content, "'");
+// printf("%s\n",tk->content );
+// return(tk);
+// }
+// }
+// in = in->next;
+// }
+// return 0;
+// }