renamed enum and struct
This commit is contained in:
16
src/parser.c
16
src/parser.c
@@ -13,7 +13,7 @@
|
||||
NT | ! NUMBER | NT | ! SIGN | FACTOR | NT | NT
|
||||
*/
|
||||
|
||||
static term_sign get_sign(token *tokens, int i, int *token_count)
|
||||
static e_term_sign get_sign(s_token *tokens, int i, int *token_count)
|
||||
{
|
||||
// // forbidden tokens
|
||||
// if (tokens[i].type == TOKEN_POWER)
|
||||
@@ -52,7 +52,7 @@ static term_sign get_sign(token *tokens, int i, int *token_count)
|
||||
return tokens[i].type == TOKEN_SIGN_PLUS ? TERM_PLUS : TERM_MINUS;
|
||||
}
|
||||
|
||||
static double get_double_value(token token)
|
||||
static double get_double_value(s_token token)
|
||||
{
|
||||
if (token.tag != TOKEN_NUMBER)
|
||||
{
|
||||
@@ -66,7 +66,7 @@ static double get_double_value(token token)
|
||||
return token.value_int;
|
||||
}
|
||||
|
||||
static double get_coefficient(token *tokens, int i, int *token_count)
|
||||
static double get_coefficient(s_token *tokens, int i, int *token_count)
|
||||
{
|
||||
double coefficient;
|
||||
|
||||
@@ -129,7 +129,7 @@ static double get_coefficient(token *tokens, int i, int *token_count)
|
||||
return coefficient;
|
||||
}
|
||||
|
||||
static int get_exponent(token *tokens, int i, int *token_count)
|
||||
static int get_exponent(s_token *tokens, int i, int *token_count)
|
||||
{
|
||||
// // forbidden tokens
|
||||
// if (tokens[i].type == TOKEN_POWER)
|
||||
@@ -197,7 +197,7 @@ static int get_exponent(token *tokens, int i, int *token_count)
|
||||
return tokens[i].value_int;
|
||||
}
|
||||
|
||||
static void check_variables(token *tokens)
|
||||
static void check_variables(s_token *tokens)
|
||||
{
|
||||
int i;
|
||||
char var;
|
||||
@@ -222,12 +222,12 @@ static void check_variables(token *tokens)
|
||||
}
|
||||
}
|
||||
|
||||
int parse(token *tokens, term *terms, int terms_count_max)
|
||||
int parse(s_token *tokens, s_term *terms, int terms_count_max)
|
||||
{
|
||||
int i;
|
||||
int terms_count;
|
||||
int token_count;
|
||||
term_position term_position;
|
||||
e_term_position term_position;
|
||||
|
||||
check_variables(tokens);
|
||||
|
||||
@@ -251,7 +251,7 @@ int parse(token *tokens, term *terms, int terms_count_max)
|
||||
terms[terms_count].position = term_position;
|
||||
|
||||
// sign
|
||||
term_sign ret_sign = get_sign(tokens, i, &token_count);
|
||||
e_term_sign ret_sign = get_sign(tokens, i, &token_count);
|
||||
terms[terms_count].sign = ret_sign;
|
||||
i += token_count;
|
||||
// ft_printf("term[%i] get_sign: (%i)[%s], token_count: [%d]\n", terms_count, ret_sign, term_sign_to_str(ret_sign), token_count); // debug
|
||||
|
||||
Reference in New Issue
Block a user