fix: changed puts to perror + redirections in parser
This commit is contained in:
parent
96626d9850
commit
d52f603eec
5 changed files with 26 additions and 24 deletions
|
|
@ -66,7 +66,7 @@ static bool init_firsts_map(void)
|
|||
firsts_map = calloc(NUMBER_OF_RULES, sizeof(struct firsts_list));
|
||||
if (firsts_map == NULL)
|
||||
{
|
||||
puts("Internal error: couldn't create the firsts_map (is your memory "
|
||||
perror("Internal error: couldn't create the firsts_map (is your memory "
|
||||
"full ?)");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ struct firsts_list *first(enum rule rule)
|
|||
{
|
||||
if (firsts_map == NULL || firsts_map[rule].tokens == NULL)
|
||||
{
|
||||
puts("Internal error: attempted to get the firsts of a rule without "
|
||||
perror("Internal error: attempted to get the firsts of a rule without "
|
||||
"properly initializing the firsts map");
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -208,7 +208,7 @@ struct ast *parse_input(struct lexer_context *ctx)
|
|||
return ast;
|
||||
}
|
||||
|
||||
puts("Syntax error: expected newline or EOF after list");
|
||||
perror("Syntax error: expected newline or EOF after list");
|
||||
ast_free(&ast);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue