comments with #
This commit is contained in:
parent
e645db2f0f
commit
b998f45e49
8 changed files with 23 additions and 38 deletions
|
|
@ -178,7 +178,6 @@ lexer/insert_newline.c\
|
|||
lexer/lexer_assignement_word.c\
|
||||
lexer/lexer_backslash.c\
|
||||
lexer/lexer_bquote.c\
|
||||
lexer/lexer_comment.c\
|
||||
lexer/lexer_curly_braces.c\
|
||||
lexer/lexer_default.c\
|
||||
lexer/lexer_delim.c\
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/05 16:28:17 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/05 17:29:09 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -42,7 +42,6 @@ enum e_lexstate
|
|||
BACKSLASH,
|
||||
CURLY_BRACKETS,
|
||||
ASSIGNEMENT_WORD,
|
||||
COMMENT,
|
||||
END,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/09 20:39:06 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/05 16:28:14 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/05 17:29:24 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -20,8 +20,6 @@ t_lexstate get_state_global(t_lexer *lexer)
|
|||
DG("check, c=%c", lexer->str[lexer->pos]);
|
||||
if (ft_is_delim(c))
|
||||
return (DELIM);
|
||||
else if (c == '#')
|
||||
return (COMMENT);
|
||||
else if (c == '&' || c == ';' || c == '|')
|
||||
return (SEP);
|
||||
else if (c == '\\')
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* lexer_comment.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/07 12:15:59 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/05 15:31:17 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "lexer.h"
|
||||
|
||||
int lexer_comment(t_list **alst, t_lexer *lexer)
|
||||
{
|
||||
// t_token *token;
|
||||
|
||||
// token = (*alst)->content;
|
||||
if (lexer->str[lexer->pos] == '\n')
|
||||
return (lexer_lex(&(*alst)->next, lexer));
|
||||
return (lexer_comment(alst, lexer));
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/28 18:36:58 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/20 20:52:24 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/05 17:09:20 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,23 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* lexer_end.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/05 16:58:24 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/05 17:29:17 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "lexer.h"
|
||||
|
||||
int lexer_end(t_list **alst, t_lexer *lexer)
|
||||
{
|
||||
t_token *token;
|
||||
|
||||
if ((*alst && (lexer->state == QUOTE
|
||||
|| lexer->state == DQUOTE
|
||||
|| lexer->state == BQUOTE))
|
||||
|| get_lexer_stack(*lexer) == DLESS)
|
||||
if ((*alst && (lexer->state == QUOTE || lexer->state == DQUOTE
|
||||
|| lexer->state == BQUOTE)) || get_lexer_stack(*lexer) == DLESS)
|
||||
{
|
||||
ft_strappend(&lexer->str, (char[]){'\n', 0});
|
||||
lexer->pos++;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/09 17:08:51 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/05 16:28:15 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/05 17:30:17 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -33,7 +33,6 @@ int (*g_lexer[])(t_list **alst, t_lexer *lexer) =
|
|||
&lexer_backslash,
|
||||
&lexer_curly_braces,
|
||||
&lexer_assignement_word,
|
||||
&lexer_comment,
|
||||
&lexer_end,
|
||||
};
|
||||
|
||||
|
|
@ -51,7 +50,10 @@ int lexer_lex(t_list **alst, t_lexer *lexer)
|
|||
{
|
||||
t_token *token;
|
||||
|
||||
if (lexer->str[lexer->pos] == 0)
|
||||
if (lexer->str[lexer->pos] == 0
|
||||
|| (lexer->str[lexer->pos] == '#'
|
||||
&& lexer->state != QUOTE
|
||||
&& lexer->state != DQUOTE))
|
||||
return (lexer_end(alst, lexer));
|
||||
if (!*alst)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/11 14:04:48 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/05 16:28:38 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/05 17:09:22 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue