fix: small bugs to make it compile

This commit is contained in:
Matteo Flebus 2026-01-27 18:00:59 +01:00
parent c48d86c8de
commit 13018e0a03
10 changed files with 33 additions and 4 deletions

View file

@ -186,7 +186,10 @@ struct ast *parse_input(struct lexer_context *ctx)
struct token *token = PEEK_TOKEN();
if (token->type == TOKEN_EOF)
return ast_create_list(NULL);
{
POP_TOKEN();
return ast_create_end();
}
if (token->type == TOKEN_NEWLINE)
{

View file

@ -22,6 +22,9 @@ static enum ast_redir_type redir_tok_to_ast_type(enum token_type tok_type)
struct ast *parse_redirection(struct lexer_context *ctx)
{
(void)ctx;
return NULL;
/*
struct token *token = PEEK_TOKEN();
int io_number = -1;
if (token->type == TOKEN_IONUMBER)
@ -53,6 +56,7 @@ struct ast *parse_redirection(struct lexer_context *ctx)
POP_TOKEN();
return ast_create_redir(io_number, redir_type, target);
*/
}
struct ast *parse_prefix(struct lexer_context *ctx)

View file

@ -25,6 +25,16 @@ bool parser_init(void)
return true;
}
void parser_close(void)
{
if (state != PARSER_STATE_READY)
{
perror("trying to close parser which was not opened");
}
state = PARSER_STATE_CLOSED;
// TODO close grammar
}
struct ast *get_ast(struct lexer_context *ctx)
{
if (ctx == NULL)