diff options
Diffstat (limited to 'src/lexer')
| -rw-r--r-- | src/lexer/lexer.c | 9 | ||||
| -rw-r--r-- | src/lexer/lexer_utils.c | 4 | ||||
| -rw-r--r-- | src/lexer/trim.c | 21 |
3 files changed, 5 insertions, 29 deletions
diff --git a/src/lexer/lexer.c b/src/lexer/lexer.c index 47dedc6..3bf9dc2 100644 --- a/src/lexer/lexer.c +++ b/src/lexer/lexer.c @@ -8,12 +8,7 @@ int len_is_not_sep(char *input) while(input[++i]) { if (lexer_sep(input[i])) - { - //if (input[i + 1] == ' ') - // while(input[++i] == ' ') - // ; return(i); - } if (input[i] == '\'' || input[i] == '"') return(i); if (input[i] == ' ') @@ -31,8 +26,8 @@ int check_input(char *input) int i; i = 0; - /* if (input[i] == '(' || input[i] == ')') */ - /* return (i + 1); */ + if (input[i] == '(' || input[i] == ')') + return (i + 1); if (lexer_sep(input[i])) { while(input[i] == input[i + 1]) diff --git a/src/lexer/lexer_utils.c b/src/lexer/lexer_utils.c index 3ee41ff..a6da3d4 100644 --- a/src/lexer/lexer_utils.c +++ b/src/lexer/lexer_utils.c @@ -14,7 +14,7 @@ enum e_token_tag ret_token(char *input, int i) { if (input[i] == ';') return(TAG_END); - if (input[i] == '&') + if (input[i] == '&' && input[i + 1] == '&') return(TAG_AND); if (input[i] == '|' && input[i + 1] == '|') return(TAG_OR); @@ -66,11 +66,11 @@ static int lex_verif_simple_cote(char *input, int i) i++; while(input[i] != '\0') { - ++i; if(input[i] == '\\') i+=1; if(input[i] == '\'') break; + ++i; } if (input[i + 1] == ' ') while(input[i + 1] == ' ') diff --git a/src/lexer/trim.c b/src/lexer/trim.c index f47aa6d..6c435d5 100644 --- a/src/lexer/trim.c +++ b/src/lexer/trim.c @@ -1,25 +1,6 @@ #include "lexer.h" -t_ftlst *stick_parent(t_ftlst *lst) -{ - t_ftlst *first; - t_token *tk; - - first = lst; - while (lst != NULL) - { - tk = lst->data; - if (tk->tag & TAG_PARENT_OPEN || tk->tag & TAG_PARENT_CLOSE) - { - if (ft_strlen(tk->content) >= 2) - tk->tag = tk->tag | TAG_STICK; - } - lst = lst->next; - } - return (first); -} - char *del_space(t_token *tk) { int i; @@ -83,5 +64,5 @@ t_ftlst *lexe_trim_out(t_ftlst *lst) } lst = lst->next; } - return (stick_parent(first)); + return (first); } |
