fix: now compiles and works for simple commands + clang format
This commit is contained in:
parent
6099bbb9e3
commit
352c122549
23 changed files with 168 additions and 150 deletions
|
|
@ -1,9 +1,11 @@
|
|||
#define _POSIX_C_SOURCE 200809L
|
||||
// === Includes
|
||||
#include "parsing_utils.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lexer/lexer.h"
|
||||
#include "utils/ast/ast.h"
|
||||
|
|
@ -58,7 +60,8 @@ struct ast *parse_simple_command(void)
|
|||
while (!isterminator(token))
|
||||
{
|
||||
token = POP_TOKEN();
|
||||
command_elements = list_append(command_elements, token->data);
|
||||
char *word = strdup(token->data);
|
||||
command_elements = list_append(command_elements, word);
|
||||
token = PEEK_TOKEN();
|
||||
}
|
||||
|
||||
|
|
@ -86,6 +89,7 @@ struct ast *parse_list(void)
|
|||
}
|
||||
token = PEEK_TOKEN();
|
||||
}
|
||||
result_list = list_append(result_list, current_node);
|
||||
|
||||
return ast_create_list(result_list);
|
||||
}
|
||||
|
|
@ -163,7 +167,9 @@ struct ast *parse_compound_list(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
command_elements = list_append(command_elements, token->data);
|
||||
char *word = strdup(token->data);
|
||||
|
||||
command_elements = list_append(command_elements, word);
|
||||
token = POP_TOKEN();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue