32 lines
1.3 KiB
C
32 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* lexer_backslash.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/12/03 11:56:49 by jhalford #+# #+# */
|
|
/* Updated: 2017/03/27 20:23:24 by jhalford ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "minishell.h"
|
|
|
|
int lexer_backslash(t_list **alst, t_lexer *lexer)
|
|
{
|
|
t_token *token;
|
|
|
|
token = (*alst)->content;
|
|
lexer->state = DEFAULT;
|
|
if (lexer->str[lexer->pos + 1] == 0)
|
|
{
|
|
lexer->str[lexer->pos] = 0;
|
|
push(&lexer->stack, BACKSLASH);
|
|
return (0);
|
|
}
|
|
token->type = token->type ? token->type : TK_WORD;
|
|
lexer->pos++;
|
|
token_append(token, lexer, 1, 1);
|
|
lexer->pos++;
|
|
return (lexer_lex(alst, lexer));
|
|
}
|