fix(parser): moved macro declaration from parser.h to parsing_utils.h

This commit is contained in:
Matteo Flebus 2026-01-16 19:45:15 +01:00
parent 10ce140e37
commit f33498fb13
2 changed files with 22 additions and 18 deletions

View file

@ -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.

View file

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