ca compile deso deso

This commit is contained in:
Jack Halford 2017-03-17 19:46:11 +01:00
parent f7d0f0408a
commit 9bda99e139
7 changed files with 19 additions and 20 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */
/* Updated: 2017/03/17 00:07:51 by ariard ### ########.fr */
/* Updated: 2017/03/17 19:34:31 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -92,7 +92,7 @@ char *stack_to_prompt(t_list *stack);
t_lexstate get_state_global(t_lexer *lexer);
t_lexstate get_state_redir(t_lexer *lexer);
int get_lexer_stack(t_lexer lexer);
int get_reserved_words(t_list **alst);
int get_reserved_words(t_list *temp);
int insert_newline(t_list **alst);
void lexer_init(t_lexer *lexer);

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/26 00:07:05 by ariard #+# #+# */
/* Updated: 2017/03/17 19:27:08 by jhalford ### ########.fr */
/* Updated: 2017/03/17 19:33:51 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -38,7 +38,7 @@ static int recognization_rvwords(t_token *pv_tk, t_token *at_tk)
|| pv_tk->type == TK_FI || pv_tk->type == TK_THEN
|| pv_tk->type == TK_ELIF || pv_tk->type == TK_ELSE
|| pv_tk->type == TK_DSEMI) || (pv_tk->type == TK_PAREN_CLOSE
&& at_tk->type == TK_PAREN_OPEN))
&& at_tk->type == TK_PAREN_OPEN));
}
static int match_words(t_token *token)

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/24 20:28:13 by ariard #+# #+# */
/* Updated: 2017/03/14 00:50:34 by ariard ### ########.fr */
/* Updated: 2017/03/17 19:33:12 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,12 +18,12 @@ int lexer_assignement_word(t_list **alst, t_lexer *lexer)
char c;
token = (*alst)->content;
if (token->type != TK_WORD && token->type != TK_ASSIGNMENT_WORD)
{
token_append(token, lexer, 0, 0);
lexer->pos++;
return (lexer_lex(alst, lexer));
}
/* if (token->type != TK_WORD && token->type != TK_ASSIGNMENT_WORD) */
/* { */
/* token_append(token, lexer, 0, 0); */
/* lexer->pos++; */
/* return (lexer_lex(alst, lexer)); */
/* } */
token->type = TK_ASSIGNMENT_WORD;
token_append(token, lexer, 0, 0);
lexer->pos++;

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/28 18:36:21 by jhalford #+# #+# */
/* Updated: 2017/03/16 21:42:47 by jhalford ### ########.fr */
/* Updated: 2017/03/17 19:28:09 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,13 +19,9 @@ int lexer_default(t_list **alst, t_lexer *lexer)
c = lexer->str[lexer->pos];
if ((lexer->state = get_state_global(lexer)))
{
DG("got state %i",lexer->state);
return (lexer_lex(alst, lexer));
}
if ((lexer->state = get_state_redir(lexer)))
return (lexer_lex(alst, lexer));
DG("no special state, %c",lexer->str[lexer->pos]);
lexer->state = ft_isdigit(c) ? NUMBER : WORD;
token = (*alst)->content;
token->type = TK_WORD;

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/28 18:36:58 by jhalford #+# #+# */
/* Updated: 2017/03/16 22:59:52 by jhalford ### ########.fr */
/* Updated: 2017/03/17 19:27:42 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -28,7 +28,7 @@ int lexer_dquote(t_list **alst, t_lexer *lexer)
else if (lexer->str[lexer->pos] == '\\')
{
if (lexer->str[lexer->pos + 1] == 0)
return(lexer_backslash(alst, lexer));
return (lexer_backslash(alst, lexer));
token_append(token, lexer, 1, 1);
}
else if (lexer->str[lexer->pos] == '`' && (lexer->state = BQUOTE))

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/03 12:07:11 by jhalford #+# #+# */
/* Updated: 2017/03/16 14:44:46 by jhalford ### ########.fr */
/* Updated: 2017/03/17 19:33:42 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -31,7 +31,10 @@ int lexer_word(t_list **alst, t_lexer *lexer)
lexer->state = ASSIGNEMENT_WORD;
return (lexer_lex(alst, lexer));
}
else
{
token_append(token, lexer, 0, 0);
lexer->pos++;
}
return (lexer_lex(alst, lexer));
}

View file

@ -56,7 +56,7 @@ static int do_parser_routine(void)
t_data *data;
data = data_singleton();
if (get_reserved_words(&data->token))
if (get_reserved_words(data->token))
return (1);
if (insert_newline(&data->token))
return (1);