multiple heredocs on one line word OK
This commit is contained in:
parent
c764027070
commit
3f984ad498
7 changed files with 6 additions and 13 deletions
|
|
@ -30,11 +30,9 @@ int process_redirect(t_process *p)
|
|||
int i;
|
||||
|
||||
redirs = p->redirs;
|
||||
DG("process redirect");
|
||||
while (redirs)
|
||||
{
|
||||
redir = redirs->content;
|
||||
DG("process redirect 2, type=[%i]", redir->type);
|
||||
if (redir->n > 9)
|
||||
return (bad_fd(redir->n));
|
||||
i = 0;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ int job_wait(int id)
|
|||
pid_t pid;
|
||||
int status;
|
||||
|
||||
DG("gonna wait [%i]", id);
|
||||
if (job_is_stopped(id))
|
||||
return (0);
|
||||
job_update_status();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ int lexer_end(t_list **alst, t_lexer *lexer)
|
|||
{
|
||||
t_token *token;
|
||||
|
||||
DG("check");
|
||||
if ((*alst && (lexer->state == QUOTE
|
||||
|| lexer->state == DQUOTE
|
||||
|| lexer->state == BQUOTE))
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ int lexer_lex(t_list **alst, t_lexer *lexer)
|
|||
{
|
||||
t_token *token;
|
||||
|
||||
DG("check 01, state=[%i]", lexer->state);
|
||||
if (lexer->str[lexer->pos] == 0)
|
||||
return (lexer_end(alst, lexer));
|
||||
if (!*alst)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ int lexer_sep(t_list **alst, t_lexer *lexer)
|
|||
char c;
|
||||
char cn;
|
||||
|
||||
lexer->state = DEFAULT;
|
||||
if (*alst)
|
||||
{
|
||||
token = (*alst)->content;
|
||||
|
|
|
|||
|
|
@ -28,9 +28,11 @@ int lexer_dless(t_list **alst, t_lexer *lexer)
|
|||
{
|
||||
pop(&lexer->stack);
|
||||
pop(&lexer->heredoc_stack);
|
||||
return (0);
|
||||
while (lexer->str[++lexer->pos])
|
||||
;
|
||||
}
|
||||
while (lexer->str[lexer->pos])
|
||||
token_append_char(heredoc_tok, lexer->str[lexer->pos++], 0, 0);
|
||||
else
|
||||
while (lexer->str[lexer->pos])
|
||||
token_append_char(heredoc_tok, lexer->str[lexer->pos++], 0, 0);
|
||||
return (lexer_end(alst, lexer));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,25 +54,20 @@ int interactive_shell()
|
|||
ast = NULL;
|
||||
do {
|
||||
ft_strappend(&lexer.str, readline(stack_to_prompt(lexer.stack)));
|
||||
DG("check 0");
|
||||
if (get_lexer_stack(lexer) == BACKSLASH)
|
||||
pop(&lexer.stack);
|
||||
else if (get_lexer_stack(lexer) == DLESS)
|
||||
lexer.state = DLESS;
|
||||
DG("check 1");
|
||||
ltoken = ft_lstlast(token);
|
||||
if (lexer_lex((token ? <oken : &token), &lexer))
|
||||
return (1);
|
||||
DG("check 2");
|
||||
DG("[{mag}%s{eoc}] stack=[%i] state=[%i]", lexer.str, lexer.stack ? *(int*)lexer.stack->content : 0, lexer.state);
|
||||
DG("check 3");
|
||||
token_print(token);
|
||||
} while (get_lexer_stack(lexer));
|
||||
if (bquotes_expand(&token))
|
||||
return (1);
|
||||
if (!token)
|
||||
return (0);
|
||||
token_print(token);
|
||||
if (ft_parse(&ast, &token))
|
||||
return (1);
|
||||
btree_print(STDBUG, ast, &ft_putast);
|
||||
|
|
|
|||
Loading…
Reference in a new issue