bquotes inside dquotes lexing

This commit is contained in:
Jack Halford 2017-03-23 15:19:41 +01:00
parent 7b690e7e4c
commit 8b5c742002
4 changed files with 27 additions and 3 deletions

View file

@ -214,6 +214,7 @@ job_control/sigttin_handler.c\
job_control/sigttou_handler.c\
lexer/do_lexer_routine.c\
lexer/get_lexer_stack.c\
lexer/get_lexer_stack2.c\
lexer/get_reserved_words.c\
lexer/get_state_global.c\
lexer/get_state_redir.c\

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */
/* Updated: 2017/03/22 22:07:49 by wescande ### ########.fr */
/* Updated: 2017/03/23 15:18:36 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -85,6 +85,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_lexer_stack2(t_lexer lexer);
int get_reserved_words(t_list *temp);
int isrw_delim(t_type type);
int keep_last_type(t_type *type, t_list *token);

View file

@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_lexer_stack2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/23 15:15:46 by jhalford #+# #+# */
/* Updated: 2017/03/23 15:19:00 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int get_lexer_stack2(t_lexer lexer)
{
if (!(lexer.stack && lexer.stack->next))
return (0);
return (*(int*)lexer.stack->next->content);
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/09 22:03:48 by jhalford #+# #+# */
/* Updated: 2017/03/23 03:41:34 by wescande ### ########.fr */
/* Updated: 2017/03/23 15:17:27 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -36,7 +36,8 @@ int lexer_bquote(t_list **alst, t_lexer *lexer)
if (lexer->str[lexer->pos] == 0)
return (push(&lexer->stack, BACKSLASH) ? 0 : 0);
}
token_append(token, lexer, back || token->type == TK_ASSIGNMENT_WORD, back);
token_append(token, lexer, back || token->type == TK_ASSIGNMENT_WORD
|| get_lexer_stack2(*lexer) == DQUOTE, back);
lexer->pos++;
return (lexer_lex(alst, lexer));
}