fix(parser): make it compile
This commit is contained in:
parent
80e4b6c2fd
commit
1116eef083
2 changed files with 5 additions and 3 deletions
|
|
@ -2,7 +2,7 @@ lib_LIBRARIES = libparser.a
|
||||||
|
|
||||||
libparser_a_SOURCES = \
|
libparser_a_SOURCES = \
|
||||||
parser.c \
|
parser.c \
|
||||||
parser.h
|
parsing_utils.c
|
||||||
|
|
||||||
libparser_a_CPPFLAGS = -I$(top_srcdir)/src
|
libparser_a_CPPFLAGS = -I$(top_srcdir)/src
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "lexer/lexer.h"
|
#include "lexer/lexer.h"
|
||||||
#include "utils/lists/lists.h"
|
#include "utils/lists/lists.h"
|
||||||
|
#include "parser/parsing_utils.h"
|
||||||
|
|
||||||
// === Static functions
|
// === Static functions
|
||||||
// ...
|
// ...
|
||||||
|
|
@ -26,8 +27,8 @@ struct ast *get_ast()
|
||||||
switch (token->type)
|
switch (token->type)
|
||||||
{
|
{
|
||||||
case TOKEN_WORD:
|
case TOKEN_WORD:
|
||||||
struct ast *cmd = parse_simple_command();
|
current_node = parse_simple_command();
|
||||||
result_list = list_append(result_list, cmd);
|
result_list = list_append(result_list, current_node);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Forward
|
// Forward
|
||||||
|
|
@ -39,6 +40,7 @@ struct ast *get_ast()
|
||||||
if (token == NULL)
|
if (token == NULL)
|
||||||
{
|
{
|
||||||
puts("Internal error: cannot get the following token");
|
puts("Internal error: cannot get the following token");
|
||||||
|
puts("Hint: EOF might be missing");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue