aboutsummaryrefslogtreecommitdiff
path: root/test_mini/lexer_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'test_mini/lexer_utils.c')
-rw-r--r--test_mini/lexer_utils.c88
1 files changed, 0 insertions, 88 deletions
diff --git a/test_mini/lexer_utils.c b/test_mini/lexer_utils.c
deleted file mode 100644
index d7fe8f4..0000000
--- a/test_mini/lexer_utils.c
+++ /dev/null
@@ -1,88 +0,0 @@
-
-#include "lexer.h"
-
-
-enum e_token_tag ret_token_sep_redir_append(char *input, int i)
-{
- if (input[i + 1] == '>')
- return(LTAG_REDIR_APPEND);
- return (LTAG_REDIR_OUT);
-
-}
-
-enum e_token_tag ret_token_sep(char *input, int i)
-{
- if (input[i] == ';')
- return(LTAG_AND);
- if (input[i] == '&')
- return(LTAG_END);
- if (input[i] == '|' && input[i + 1] == '|')
- return(LTAG_OR);
- if(input[i] == '|')
- return(LTAG_PIPE);
- if (input[i] == '>')
- return(ret_token_sep_redir_append(input,i));
- if (input[i] == '<')
- return(LTAG_REDIR_IN);
-
- return(0);
-
-}
-
-
-int lexer_sep(char input)
-{
- char *sep;
- int i;
-
- i = 0;
- sep = ";&|><()";
- while(sep[i] != '\0')
- {
- if(sep[i] == input)
- return(1);
- i++;
- }
- return (0);
-}
-
-int lexe_space(char *input)
-{
- int i;
-
- i=0;
- while(input[i] == ' ')
- i++;
- return(i);
-}
-
-static int lex_verif_simple_cote(char *input, int i)
-{
- i++;
- while(input[i] != '\0')
- {
- ++i;
- if(input[i] == '\'')
- break;
- }
- if (input[i + 1] == ' ')
- while(input[i] == ' ')
- i++;
- return(i + 1);
-}
-int lexer_verif_entre_cote(char *input, int i)
-{
- if(input[i] == '\'')
- return(lex_verif_simple_cote(input, i));
- i++;
- while(input[i] != '"' && (input[i] != '\0'))
- {
- ++i;
- if (input[i] == '\'')
- break;
- }
- if (input[i + 1] == ' ')
- while(input[i] == ' ')
- i++;
- return(i + 1);
-}