fix: memory issues, parser errors and get_ast_if returning always NULL
This commit is contained in:
parent
3fa7b97282
commit
f8b91d4da3
4 changed files with 5 additions and 2 deletions
|
|
@ -140,6 +140,7 @@ bool grammar_init(void)
|
|||
|
||||
// Element
|
||||
add_first(RULE_ELEMENT, TOKEN_WORD);
|
||||
add_first(RULE_ELEMENT, TOKEN_ASSIGNMENT_WORD);
|
||||
add_firsts(RULE_ELEMENT, first(RULE_REDIRECTION));
|
||||
|
||||
// Prefix
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ struct ast *parse_simple_command(struct lexer_context *ctx)
|
|||
struct ast *parse_element(struct lexer_context *ctx)
|
||||
{
|
||||
struct token *token = PEEK_TOKEN();
|
||||
if (token->type == TOKEN_WORD)
|
||||
if (token->type == TOKEN_WORD || token->type == TOKEN_ASSIGNMENT_WORD)
|
||||
{
|
||||
token = POP_TOKEN();
|
||||
return ast_create_word(token->data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue