lexer_comment back onto master
This commit is contained in:
parent
8ae6910122
commit
c56f9dac85
14 changed files with 52 additions and 13 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/06 22:34:37 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/07 12:09:05 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/06 16:22:01 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/07 12:29:39 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -44,6 +44,7 @@ typedef long long t_type;
|
|||
enum e_lexstate
|
||||
{
|
||||
DEFAULT,
|
||||
NEWLINE,
|
||||
DELIM,
|
||||
SEP,
|
||||
WORD,
|
||||
|
|
@ -57,6 +58,7 @@ enum e_lexstate
|
|||
BACKSLASH,
|
||||
VAR,
|
||||
SPECIAL,
|
||||
COMMENT,
|
||||
};
|
||||
|
||||
struct s_token
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/01 12:15:54 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/03 14:01:51 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/07 12:09:20 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/06 15:31:42 by wescande ### ########.fr */
|
||||
/* Updated: 2017/02/07 12:14:31 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/06 16:08:09 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/07 12:11:34 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/13 17:07:10 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/11 18:01:36 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/07 12:07:43 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/10 13:37:11 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/03 15:39:53 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/07 12:29:41 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
int (*g_lexer[])(t_list **alst, char *str) =
|
||||
{
|
||||
&lexer_default,
|
||||
&lexer_newline,
|
||||
&lexer_delim,
|
||||
&lexer_sep,
|
||||
&lexer_word,
|
||||
|
|
@ -28,6 +29,7 @@ int (*g_lexer[])(t_list **alst, char *str) =
|
|||
&lexer_backslash,
|
||||
&lexer_var,
|
||||
&lexer_special,
|
||||
&lexer_comment,
|
||||
};
|
||||
|
||||
int ft_is_delim(char c)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/10 13:45:46 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/11 15:48:13 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/07 12:16:51 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -16,6 +16,8 @@ t_lexstate get_lexer_state(char *str)
|
|||
{
|
||||
if (ft_is_delim(*str))
|
||||
return (DELIM);
|
||||
else if (*str == '#')
|
||||
return (COMMENT);
|
||||
else if (*str == '$')
|
||||
return (VAR);
|
||||
else if (*str == '&' || *str == ';' || *str == '|')
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/28 18:36:58 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/27 15:53:31 by wescande ### ########.fr */
|
||||
/* Updated: 2017/02/07 12:22:23 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
33
42sh/src/lexer/lexer_newline.c
Normal file
33
42sh/src/lexer/lexer_newline.c
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* lexer_newline.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/23 23:19:46 by ariard #+# #+# */
|
||||
/* Updated: 2017/02/07 12:37:17 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "lexer.h"
|
||||
|
||||
int lexer_newline(t_list **alst, char *str)
|
||||
{
|
||||
t_token *token;
|
||||
|
||||
if (*alst)
|
||||
{
|
||||
token = (*alst)->content;
|
||||
if (*token->data)
|
||||
return (lexer_newline(&(*alst)->next, str));
|
||||
}
|
||||
else
|
||||
{
|
||||
token = token_init();
|
||||
*alst = ft_lstnew(token, sizeof(*token));
|
||||
}
|
||||
token = (*alst)->content;
|
||||
token->type = TK_NEWLINE;
|
||||
return (ft_tokenize(&(*alst)->next, str + 1, DEFAULT));
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/10 14:54:57 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/06 14:02:20 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/07 12:16:37 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/03 12:07:11 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/30 13:08:16 by wescande ### ########.fr */
|
||||
/* Updated: 2017/02/07 12:16:33 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/28 14:39:01 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/27 21:57:05 by wescande ### ########.fr */
|
||||
/* Updated: 2017/02/07 12:11:24 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/14 12:49:45 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/02 14:24:53 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/07 12:11:11 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue