aboutsummaryrefslogtreecommitdiff
path: root/src/debug/lexer.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-10-10 08:11:59 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-10-10 08:11:59 +0200
commit25ca78b5a53c931b0bc388aef099974dbba4b6ff (patch)
tree64a78d39acd408cc3dc0acaaf4c304ed2e1227c6 /src/debug/lexer.c
parenta55e414f6709c6b22ff9805cd32a40fae9da2538 (diff)
downloadminishell-25ca78b5a53c931b0bc388aef099974dbba4b6ff.tar.gz
minishell-25ca78b5a53c931b0bc388aef099974dbba4b6ff.tar.bz2
minishell-25ca78b5a53c931b0bc388aef099974dbba4b6ff.zip
Norming debugging function, Enabling them only when MINISHELL_TEST is defined
Diffstat (limited to 'src/debug/lexer.c')
-rw-r--r--src/debug/lexer.c37
1 files changed, 37 insertions, 0 deletions
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 <me@cacharle.xyz> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* 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