From 25ca78b5a53c931b0bc388aef099974dbba4b6ff Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sat, 10 Oct 2020 08:11:59 +0200 Subject: Norming debugging function, Enabling them only when MINISHELL_TEST is defined --- src/debug/lexer.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/debug/lexer.c (limited to 'src/debug/lexer.c') diff --git a/src/debug/lexer.c b/src/debug/lexer.c new file mode 100644 index 0000000..4d25662 --- /dev/null +++ b/src/debug/lexer.c @@ -0,0 +1,37 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* lexer.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/10/10 07:51:39 by cacharle #+# #+# */ +/* Updated: 2020/10/10 07:56:44 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "minishell.h" +#include "lexer.h" + +#ifdef MINISHELL_TEST + +int debug_lexer(char *input) +{ + int status; + t_tok_lst *out; + + status = lexer(input, &out); + if (status != 0) + return (status); + while (out != NULL) + { + ft_putnbr(out->tag); + ft_putchar(' '); + ft_putstr(out->content); + ft_putendl(out->tag & TAG_STICK ? " STICK" : ""); + out = out->next; + } + return (status); +} + +#endif -- cgit