lexer_comment done

This commit is contained in:
Jack Halford 2017-02-07 12:57:46 +01:00
parent c56f9dac85
commit 060800769b
7 changed files with 33 additions and 5 deletions

View file

@ -138,6 +138,7 @@ lexer/ft_post_tokenize.c\
lexer/ft_tokenize.c\ lexer/ft_tokenize.c\
lexer/get_lexer_state.c\ lexer/get_lexer_state.c\
lexer/lexer_backslash.c\ lexer/lexer_backslash.c\
lexer/lexer_comment.c\
lexer/lexer_default.c\ lexer/lexer_default.c\
lexer/lexer_delim.c\ lexer/lexer_delim.c\
lexer/lexer_dquote.c\ lexer/lexer_dquote.c\
@ -145,6 +146,7 @@ lexer/lexer_great.c\
lexer/lexer_greatand.c\ lexer/lexer_greatand.c\
lexer/lexer_less.c\ lexer/lexer_less.c\
lexer/lexer_lessand.c\ lexer/lexer_lessand.c\
lexer/lexer_newline.c\
lexer/lexer_number.c\ lexer/lexer_number.c\
lexer/lexer_quote.c\ lexer/lexer_quote.c\
lexer/lexer_sep.c\ lexer/lexer_sep.c\

View file

@ -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/07 12:29:39 by jhalford ### ########.fr */ /* Updated: 2017/02/07 12:56:46 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -36,6 +36,7 @@ typedef long long t_type;
# define TK_DQ_WORD (1 << 16) # define TK_DQ_WORD (1 << 16)
# define TK_COMMAND (1 << 17) # define TK_COMMAND (1 << 17)
# define TK_SUBSHELL (1 << 18) # define TK_SUBSHELL (1 << 18)
# define TK_NEWLINE (1 << 19)
# define TK_WORD (TK_N_WORD | TK_Q_WORD | TK_DQ_WORD) # define TK_WORD (TK_N_WORD | TK_Q_WORD | TK_DQ_WORD)
# define TK_REDIR (0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20) # define TK_REDIR (0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20)
@ -94,6 +95,7 @@ int ft_is_delim(char c);
t_lexstate get_lexer_state(char *str); t_lexstate get_lexer_state(char *str);
int lexer_default(t_list **alst, char *str); int lexer_default(t_list **alst, char *str);
int lexer_newline(t_list **alst, char *str);
int lexer_delim(t_list **alst, char *str); int lexer_delim(t_list **alst, char *str);
int lexer_sep(t_list **alst, char *str); int lexer_sep(t_list **alst, char *str);
int lexer_word(t_list **alst, char *str); int lexer_word(t_list **alst, char *str);
@ -107,5 +109,6 @@ int lexer_dquote(t_list **alst, char *str);
int lexer_backslash(t_list **alst, char *str); int lexer_backslash(t_list **alst, char *str);
int lexer_var(t_list **alst, char *str); int lexer_var(t_list **alst, char *str);
int lexer_special(t_list **alst, char *str); int lexer_special(t_list **alst, char *str);
int lexer_comment(t_list **alst, char *str);
#endif #endif

View file

@ -0,0 +1,23 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lexer_comment.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/07 12:15:59 by jhalford #+# #+# */
/* Updated: 2017/02/07 12:56:53 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "lexer.h"
int lexer_comment(t_list **alst, char *str)
{
t_token *token;
token = (*alst)->content;
if (*str == '\n')
return (ft_tokenize(&(*alst)->next, str, NEWLINE));
return (lexer_comment(alst, str + 1));
}

View file

@ -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/02/03 15:40:29 by jhalford ### ########.fr */ /* Updated: 2017/02/07 12:48:11 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/03 12:06:35 by jhalford #+# #+# */ /* Created: 2016/12/03 12:06:35 by jhalford #+# #+# */
/* Updated: 2017/02/06 22:29:32 by jhalford ### ########.fr */ /* Updated: 2017/02/07 12:45:28 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */ /* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/23 23:19:46 by ariard #+# #+# */ /* Created: 2017/01/23 23:19:46 by ariard #+# #+# */
/* Updated: 2017/02/07 12:37:17 by jhalford ### ########.fr */ /* Updated: 2017/02/07 12:54:48 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -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/02/03 15:02:07 by jhalford ### ########.fr */ /* Updated: 2017/02/07 12:53:46 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */