feat(lexer + grammar): inch les redirections ca marche
This commit is contained in:
parent
28749a2992
commit
25079bfebf
6 changed files with 77 additions and 46 deletions
|
|
@ -7,6 +7,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "grammar_basic.h"
|
||||
#include "grammar.h"
|
||||
|
||||
static enum ast_redir_type redir_tok_to_ast_type(enum token_type tok_type)
|
||||
{
|
||||
|
|
@ -66,10 +67,10 @@ struct ast *parse_redirection(struct lexer_context *ctx)
|
|||
|
||||
struct ast *parse_prefix(struct lexer_context *ctx)
|
||||
{
|
||||
struct token *token = TOKEN_PEEK();
|
||||
struct token *token = PEEK_TOKEN();
|
||||
if (token->type == TOKEN_ASSIGNMENT_WORD)
|
||||
{
|
||||
token = TOKEN_POP();
|
||||
token = POP_TOKEN();
|
||||
return ast_create_assignment_word(token->data);
|
||||
}
|
||||
else if (is_first(*token, RULE_REDIRECTION))
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ struct ast *parse_simple_command(struct lexer_context *ctx)
|
|||
}
|
||||
if (prefix->type == AST_ASSIGNEMENT)
|
||||
{
|
||||
assignments = list_append(assignments, prefix)
|
||||
assignments = list_append(assignments, prefix);
|
||||
}
|
||||
else if (prefix->type == AST_REDIR)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue