feat: toujours les mêmes qui font les pipes. Plus de assert dans ASTs (pour des raisons évidentes de stabilité du code) et nouveaux types (AST_PIPE et AST_NEG), + modifs random dans le parser
This commit is contained in:
parent
07e7d83c60
commit
96626d9850
27 changed files with 238 additions and 86 deletions
|
|
@ -1,6 +1,5 @@
|
|||
#include "ast_if.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
@ -20,15 +19,14 @@ struct ast *ast_create_if(struct ast *condition, struct ast *then_clause,
|
|||
|
||||
struct ast_if *ast_get_if(struct ast *node)
|
||||
{
|
||||
assert(node != NULL);
|
||||
assert(node->type == AST_IF);
|
||||
return (struct ast_if *)node->data;
|
||||
if (node == NULL || node->type == AST_IF)
|
||||
return NULL;
|
||||
return node->data;
|
||||
}
|
||||
|
||||
bool ast_is_if(struct ast *node)
|
||||
{
|
||||
assert(node != NULL);
|
||||
return node->type == AST_IF;
|
||||
return node != NULL && node->type == AST_IF;
|
||||
}
|
||||
|
||||
void ast_free_if(struct ast_if *if_data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue