From f33498fb1345f1e00d81dc5830325dd61717bdae Mon Sep 17 00:00:00 2001 From: Matteo Flebus Date: Fri, 16 Jan 2026 19:45:15 +0100 Subject: [PATCH] fix(parser): moved macro declaration from parser.h to parsing_utils.h --- src/parser/parser.h | 18 ------------------ src/parser/parsing_utils.h | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/parser/parser.h b/src/parser/parser.h index bf88adc..d10cae8 100644 --- a/src/parser/parser.h +++ b/src/parser/parser.h @@ -3,24 +3,6 @@ #include "utils/ast/ast.h" -// === Macros - -#define PEEK_TOKEN() \ - peek_token(); \ - if (token == NULL) \ - { \ - puts("Internal error: cannot get the following token"); \ - return NULL; \ - } - -#define POP_TOKEN() \ - pop_token(); \ - if (token == NULL) \ - { \ - puts("Internal error: cannot get the following token"); \ - return NULL; \ - } - /* @brief Builds the AST representation of the next command to execute. * * @return Returns the AST representation of the next command to execute. diff --git a/src/parser/parsing_utils.h b/src/parser/parsing_utils.h index 6981a13..a133ef0 100644 --- a/src/parser/parsing_utils.h +++ b/src/parser/parsing_utils.h @@ -1,3 +1,23 @@ +#ifndef PARSING_UTILS_H +#define PARSING_UTILS_H + +// === Macros + +#define PEEK_TOKEN() \ + peek_token(); \ + if (token == NULL) \ + { \ + puts("Internal error: cannot get the following token"); \ + return NULL; \ + } + +#define POP_TOKEN() \ + pop_token(); \ + if (token == NULL) \ + { \ + puts("Internal error: cannot get the following token"); \ + return NULL; \ + } /* @brief Parses a simple list of words (command and arguments) * and returns the resulting ast */ @@ -23,3 +43,5 @@ struct ast* parse_and_or(void); /* */ struct ast* parse_else_clause(void); + +#define /* ! PARSING_UTILS_H */