fix: random fixes

This commit is contained in:
Gu://em_ 2026-01-24 16:48:21 +01:00
parent 3ee4a0b9ca
commit 787b1aed35
3 changed files with 35 additions and 8 deletions

View file

@ -48,7 +48,11 @@ struct ast *parse_list(struct lexer_context *ctx)
{
current_node = parse_and_or(ctx);
if (current_node == NULL)
{
struct ast *tmp = ast_create_list(result_list);
ast_free(&tmp);
return NULL;
}
result_list = list_append(result_list, current_node);
token = PEEK_TOKEN();
}
@ -60,9 +64,11 @@ struct ast *parse_list(struct lexer_context *ctx)
struct ast *parse_and_or(struct lexer_context *ctx)
{
struct ast *result = parse_pipeline(ctx);
if (result == NULL)
return NULL;
struct token *token = PEEK_TOKEN();
if (token->type == TOKEN_AND || token->type == TOKEN_OR)
while (token->type == TOKEN_AND || token->type == TOKEN_OR)
{
// Set left part
@ -117,7 +123,8 @@ struct ast *parse_command(struct lexer_context *ctx)
}
else
{
return ast_create_void(); // TODO not sure what to do
puts("Syntax error: expected command");
return NULL;
}
}