correctif escaped dquote inside dquote
This commit is contained in:
parent
5bafc74afe
commit
6d786aed33
1 changed files with 9 additions and 10 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/28 18:36:58 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/27 21:27:35 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/28 15:46:22 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -19,17 +19,16 @@ int lexer_dquote(t_list **alst, t_lexer *lexer)
|
|||
token = (*alst)->content;
|
||||
token->type = token->type ? token->type : TK_WORD;
|
||||
if (lexer->str[lexer->pos] == '"')
|
||||
get_lexer_stack(*lexer) == DQUOTE && (lexer->state = WORD) ?
|
||||
pop(&lexer->stack) : push(&lexer->stack, DQUOTE) && 0;
|
||||
else if (lexer->str[lexer->pos] == '\\')
|
||||
{
|
||||
if (get_lexer_stack(*lexer) == DQUOTE && (lexer->state = WORD))
|
||||
pop(&lexer->stack);
|
||||
else
|
||||
push(&lexer->stack, DQUOTE);
|
||||
}
|
||||
else if (lexer->str[lexer->pos] == '\\' && lexer->str[lexer->pos + 1] == 0)
|
||||
{
|
||||
lexer->pos++;
|
||||
if (lexer->str[lexer->pos] == 0)
|
||||
if (lexer->str[++lexer->pos] == 0)
|
||||
return (push(&lexer->stack, BACKSLASH) ? 0 : 0);
|
||||
else if (lexer->str[lexer->pos] == '"')
|
||||
token_append(token, lexer, 1, 1);
|
||||
else
|
||||
--lexer->pos;
|
||||
}
|
||||
else if (lexer->str[lexer->pos] == '`' && (lexer->state = BQUOTE))
|
||||
return (lexer_lex(alst, lexer));
|
||||
|
|
|
|||
Loading…
Reference in a new issue