lexer skips delims before starting to tokenize
This commit is contained in:
parent
f4efbdd313
commit
585d469324
7 changed files with 17 additions and 8 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */
|
/* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/03 13:25:50 by jhalford ### ########.fr */
|
/* Updated: 2017/02/03 15:06:59 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */
|
/* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/03 14:54:04 by jhalford ### ########.fr */
|
/* Updated: 2017/02/03 15:03:52 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/03 13:46:40 by jhalford #+# #+# */
|
/* Created: 2017/02/03 13:46:40 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/03 14:55:44 by jhalford ### ########.fr */
|
/* Updated: 2017/02/03 15:01:18 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/02 15:30:59 by jhalford #+# #+# */
|
/* Created: 2017/02/02 15:30:59 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/02 15:42:24 by jhalford ### ########.fr */
|
/* Updated: 2017/02/03 15:15:13 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,9 +15,18 @@
|
||||||
int ft_lexer(t_list **alst, char **command)
|
int ft_lexer(t_list **alst, char **command)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
char *str;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if (!*command)
|
if (!*command)
|
||||||
|
return (1);
|
||||||
|
str = *command;
|
||||||
|
while (ft_is_delim(*str))
|
||||||
|
str++;
|
||||||
|
str = ft_strdup(str);
|
||||||
|
ft_strdel(command);
|
||||||
|
*command = str;
|
||||||
|
if (!*str)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
else if (ft_tokenize(alst, *command, DEFAULT))
|
else if (ft_tokenize(alst, *command, DEFAULT))
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/10 13:37:11 by jhalford #+# #+# */
|
/* Created: 2016/11/10 13:37:11 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/03 13:26:57 by jhalford ### ########.fr */
|
/* Updated: 2017/02/03 15:06:52 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/03 11:58:44 by jhalford #+# #+# */
|
/* Created: 2016/12/03 11:58:44 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/26 16:30:43 by jhalford ### ########.fr */
|
/* Updated: 2017/02/03 15:15:14 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ int lexer_delim(t_list **alst, char *str)
|
||||||
{
|
{
|
||||||
t_token *token;
|
t_token *token;
|
||||||
|
|
||||||
token = (*alst)->content;
|
token = *alst ? (*alst)->content : NULL;
|
||||||
while (ft_is_delim(*str))
|
while (ft_is_delim(*str))
|
||||||
str++;
|
str++;
|
||||||
if (token->type)
|
if (token->type)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/30 16:29:57 by jhalford #+# #+# */
|
/* Created: 2016/11/30 16:29:57 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/10 14:39:52 by jhalford ### ########.fr */
|
/* Updated: 2017/02/03 15:02:07 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue