Merge branch 'lexer' into dev
This commit is contained in:
commit
f20a02ddab
2 changed files with 11 additions and 6 deletions
|
|
@ -85,7 +85,11 @@ ssize_t stream_read(char **stream)
|
|||
if (nread == -1)
|
||||
{
|
||||
state = IOB_STATE_FINISHED;
|
||||
return 0;
|
||||
// MAGNIFICO
|
||||
// malloc(1);
|
||||
*stream_buf = EOF;
|
||||
*stream = stream_buf;
|
||||
return 1;
|
||||
}
|
||||
else if (nread < 0)
|
||||
state = IOB_STATE_ERROR;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
// === Static functions
|
||||
|
||||
/* Returns true if c is a command terminator, false otherwise
|
||||
*/
|
||||
static bool isterminator(struct token *token)
|
||||
{
|
||||
if (token == NULL)
|
||||
|
|
@ -31,6 +30,8 @@ static bool isterminator(struct token *token)
|
|||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/* @brief: returns true if token is an end of list indicator.
|
||||
* @warning: not used
|
||||
*/
|
||||
|
|
@ -77,8 +78,8 @@ struct ast *parse_list(struct lexer_context *ctx)
|
|||
while (token->type == TOKEN_SEMICOLON)
|
||||
{
|
||||
token = POP_TOKEN();
|
||||
if (!isterminator(token)) // Follow(list)
|
||||
{
|
||||
// if (!isterminator(token)) // Follow(list)
|
||||
// {
|
||||
current_node = parse_and_or(ctx);
|
||||
if (current_node == NULL)
|
||||
{
|
||||
|
|
@ -87,9 +88,9 @@ struct ast *parse_list(struct lexer_context *ctx)
|
|||
return NULL;
|
||||
}
|
||||
result_list = list_append(result_list, current_node);
|
||||
// }
|
||||
token = PEEK_TOKEN();
|
||||
}
|
||||
}
|
||||
// result_list = list_append(result_list, current_node);
|
||||
|
||||
return ast_create_list(result_list);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue