simplified error output
This commit is contained in:
12
src/parser.c
12
src/parser.c
@@ -34,7 +34,7 @@ static e_term_sign get_sign(s_token *tokens, int i, int *token_count)
|
||||
}
|
||||
else
|
||||
{
|
||||
stop_errors(ERROR_TOKEN_POSITION, "at begining of term, we should have a token 'sign', not '%s' (token[%i])", token_type_to_str(tokens[i].type), i);
|
||||
stop_errors("at begining of term, we should have a token 'sign', not '%s' (token[%i])", token_type_to_str(tokens[i].type), i);
|
||||
}
|
||||
|
||||
return tokens[i].type == TOKEN_SIGN_PLUS ? TERM_PLUS : TERM_MINUS;
|
||||
@@ -44,7 +44,7 @@ static double get_double_value(s_token token)
|
||||
{
|
||||
if (token.tag != TOKEN_NUMBER)
|
||||
{
|
||||
stop_errors(ERROR_UNKNOWN_TOKEN, "this was suppose to be a number, instead got a %s", token_type_to_str(token.type));
|
||||
stop_errors("this was suppose to be a number, instead got a %s", token_type_to_str(token.type));
|
||||
}
|
||||
if (token.type == TOKEN_NUMBER_DOUBLE)
|
||||
{
|
||||
@@ -131,7 +131,7 @@ static int get_exponent(s_token *tokens, int i, int *token_count)
|
||||
}
|
||||
else
|
||||
{
|
||||
stop_errors(ERROR_TOKEN_POSITION, "at exponent place, after a '*' we should have a 'var', but instead got : '%c' (token number %i)", tokens[i].value_char, i);
|
||||
stop_errors("at exponent place, after a '*' we should have a 'var', but instead got : '%c' (token number %i)", tokens[i].value_char, i);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -160,7 +160,7 @@ static int get_exponent(s_token *tokens, int i, int *token_count)
|
||||
}
|
||||
else
|
||||
{
|
||||
stop_errors(ERROR_TOKEN_POSITION, "at exponent place, we should have an int, but instead got : '%c' (token number %i)", tokens[i].value_char, i);
|
||||
stop_errors("at exponent place, we should have an int, but instead got : '%c' (token number %i)", tokens[i].value_char, i);
|
||||
}
|
||||
|
||||
return tokens[i].value_int;
|
||||
@@ -184,7 +184,7 @@ static void check_variables(s_token *tokens)
|
||||
}
|
||||
else if (var != tokens[i].value_char)
|
||||
{
|
||||
stop_errors(ERROR_VAR_DIFF, "old var : '%c' - new var : '%c' (token number %i)", var, tokens[i].value_char, i);
|
||||
stop_errors("old var : '%c' - new var : '%c' (token number %i)", var, tokens[i].value_char, i);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
@@ -256,7 +256,7 @@ int parse(s_token *tokens, s_term *terms, int terms_count_max)
|
||||
}
|
||||
else
|
||||
{
|
||||
stop_errors(ERROR_PARSING, "terms_count: %i, terms_count_max: %i, tokens[%i].type: %s", terms_count, terms_count_max, i, token_type_to_str(tokens[i].type));
|
||||
stop_errors("terms_count: %i, terms_count_max: %i, tokens[%i].type: %s", terms_count, terms_count_max, i, token_type_to_str(tokens[i].type));
|
||||
}
|
||||
|
||||
return terms_count;
|
||||
|
||||
Reference in New Issue
Block a user