fix(parser): moved macro declaration from parser.h to parsing_utils.h
This commit is contained in:
parent
10ce140e37
commit
f33498fb13
2 changed files with 22 additions and 18 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue