parse working
This commit is contained in:
@@ -15,7 +15,7 @@ static void print_context_tokens()
|
||||
i = 0;
|
||||
while (tokens_g_err[i].type != TOKEN_END)
|
||||
{
|
||||
ft_dprintf(STDERR_FILENO, "token %2i - type : ", i);
|
||||
ft_dprintf(STDERR_FILENO, "token[%2i] - type : ", i);
|
||||
|
||||
if (tokens_g_err[i].type == TOKEN_VARIABLE)
|
||||
ft_dprintf(STDERR_FILENO, "%20s", "TOKEN_VARIABLE");
|
||||
@@ -65,7 +65,7 @@ static void print_context_terms()
|
||||
i = 0;
|
||||
while (terms_g_err[i].position != TERM_END)
|
||||
{
|
||||
ft_dprintf(STDERR_FILENO, "term %2i - ", i);
|
||||
ft_dprintf(STDERR_FILENO, "term[%2i] - ", i);
|
||||
|
||||
// position
|
||||
ft_dprintf(STDERR_FILENO, "%8s : ", "position");
|
||||
@@ -95,6 +95,17 @@ static void print_context_terms()
|
||||
ft_putchar('\n');
|
||||
}
|
||||
|
||||
void print_state()
|
||||
{
|
||||
ft_dprintf(STDERR_FILENO, "\nSTATE :\n");
|
||||
if (input_g_err)
|
||||
print_context_input();
|
||||
if (tokens_g_err)
|
||||
print_context_tokens();
|
||||
if (terms_g_err)
|
||||
print_context_terms();
|
||||
}
|
||||
|
||||
int stop_errors(program_error err, const char *details, ...)
|
||||
{
|
||||
// the base error message
|
||||
@@ -119,12 +130,7 @@ int stop_errors(program_error err, const char *details, ...)
|
||||
}
|
||||
|
||||
// print context
|
||||
if (input_g_err)
|
||||
print_context_input();
|
||||
if (tokens_g_err)
|
||||
print_context_tokens();
|
||||
if (terms_g_err)
|
||||
print_context_terms();
|
||||
print_state();
|
||||
|
||||
// print the base message
|
||||
ft_dprintf(STDERR_FILENO, "error: (%i) %s - details: ", err, msg);
|
||||
|
||||
Reference in New Issue
Block a user