added parsing error when words follow a subshell
This commit is contained in:
parent
1649b6a294
commit
a919dc53b9
6 changed files with 13 additions and 10 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/11 16:11:11 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/03 15:46:19 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/06 14:33:34 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/11 16:13:31 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/02 15:19:02 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/06 14:36:54 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/10 14:57:53 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/06 14:05:25 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/06 14:32:16 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/06 13:26:34 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/06 14:38:45 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/30 17:14:58 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/03 13:43:00 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/06 14:38:56 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -41,10 +41,7 @@ int ft_parse(t_btree **ast, t_list **start)
|
|||
while (g_parser[i].type)
|
||||
{
|
||||
if ((lst = ft_lst_find(*start, &g_parser[i].type, &token_cmp_type)))
|
||||
{
|
||||
if (g_parser[i].f)
|
||||
return ((*g_parser[i].f)(ast, start, &lst));
|
||||
}
|
||||
return ((*g_parser[i].f)(ast, start, &lst));
|
||||
i++;
|
||||
}
|
||||
return (0);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/11 16:52:44 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/02 14:11:09 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/06 14:42:08 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -19,6 +19,12 @@ int parse_subshell(t_btree **ast, t_list **start, t_list **lst)
|
|||
|
||||
(void)start;
|
||||
token = (*lst)->content;
|
||||
DG("parsing subshell");
|
||||
if ((*lst)->next && ((t_token*)(*lst)->next->content)->type & TK_WORD)
|
||||
{
|
||||
ft_dprintf(2, "{red}%s: parse error near ')'{eoc}\n", SHELL_NAME);
|
||||
return (-1);
|
||||
}
|
||||
node = (*ast)->item;
|
||||
node->type = TK_SUBSHELL;
|
||||
node->data.sstr = malloc(4 * sizeof(char *));
|
||||
|
|
|
|||
Loading…
Reference in a new issue