fix(parser): made it compile
This commit is contained in:
parent
ed42f0b93d
commit
ce60a95471
2 changed files with 10 additions and 6 deletions
|
|
@ -18,12 +18,12 @@
|
|||
struct ast *get_ast()
|
||||
{
|
||||
struct token *token = PEEK_TOKEN();
|
||||
struct ast *res;
|
||||
|
||||
if (token->type == TOKEN_EOF)
|
||||
{
|
||||
token = pop_token();
|
||||
// TODO
|
||||
// return ast END.
|
||||
return ast_create_end();
|
||||
}
|
||||
else if (token->type == TOKEN_NEWLINE)
|
||||
{
|
||||
|
|
@ -32,7 +32,7 @@ struct ast *get_ast()
|
|||
}
|
||||
else // TOKEN WORD
|
||||
{
|
||||
current_node = parse_list();
|
||||
res = parse_list();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -44,8 +44,7 @@ struct ast *get_ast()
|
|||
}
|
||||
*/
|
||||
|
||||
struct ast *result = ast_create_list(result_list);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@
|
|||
puts("Internal error: cannot get the following token"); \
|
||||
return NULL; \
|
||||
}
|
||||
|
||||
/* @brief: parses a list of [and_or] rules, separated by semicolons.
|
||||
*/
|
||||
struct ast *parse_list(void);
|
||||
|
||||
/* @brief Parses a simple list of words (command and arguments)
|
||||
* and returns the resulting ast
|
||||
*/
|
||||
|
|
@ -44,4 +49,4 @@ struct ast* parse_and_or(void);
|
|||
*/
|
||||
struct ast* parse_else_clause(void);
|
||||
|
||||
#define /* ! PARSING_UTILS_H */
|
||||
#endif /* ! PARSING_UTILS_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue