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 */