feat(parser): redirections

This commit is contained in:
Matteo Flebus 2026-01-27 19:56:33 +01:00
parent 04ff7376eb
commit 8a5c589742
17 changed files with 78 additions and 108 deletions

View file

@ -1,13 +1,14 @@
#include <stdbool.h>
#define _POSIX_C_SOURCE 200809L
#include "grammar_basic.h"
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "../utils/lists/lists.h"
#include "grammar.h"
#include "grammar_advanced.h"
#include "grammar_basic.h"
// === Static functions
@ -210,7 +211,7 @@ struct ast *parse_simple_command(struct lexer_context *ctx)
else
{
perror("Internal error: unexpected return value from parse_element "
"in parse_simple_command");
"in parse_simple_command");
list_deep_destroy(command_elements);
return NULL;
}
@ -260,7 +261,7 @@ struct ast *parse_if_rule(struct lexer_context *ctx)
if (token->type != TOKEN_IF)
{
perror("Internal error: expected a if rule but token has different "
"type");
"type");
return NULL;
}
@ -398,7 +399,8 @@ struct ast *parse_else_clause(struct lexer_context *ctx)
token = POP_TOKEN();
if (token->type != TOKEN_THEN)
{
perror("Expected the 'then' keyword but got a different token type");
perror(
"Expected the 'then' keyword but got a different token type");
return NULL;
}