changed subtypes for tags

This commit is contained in:
hugogogo
2026-05-02 10:25:25 +02:00
parent a250a170cb
commit 3977e6a6bb
4 changed files with 104 additions and 79 deletions

View File

@@ -87,41 +87,29 @@ int main(int ac, char **av)
ft_printf("token %2i - type : ", i);
if (tokens[i].type == TOKEN_VARIABLE)
ft_printf("%14s%30s", "TOKEN_VARIABLE", "");
else if (tokens[i].type == TOKEN_NUMBER)
{
ft_printf("%14s", "TOKEN_NUMBER");
if (tokens[i].subtype == TOKEN_NUMBER_INT)
ft_printf("%30s", "TOKEN_NUMBER_INT");
else if (tokens[i].subtype == TOKEN_NUMBER_DOUBLE)
ft_printf("%30s", "TOKEN_NUMBER_DOUBLE");
}
ft_printf("%20s", "TOKEN_VARIABLE");
else if (tokens[i].type == TOKEN_NUMBER_INT)
ft_printf("%20s", "TOKEN_NUMBER_INT");
else if (tokens[i].type == TOKEN_NUMBER_DOUBLE)
ft_printf("%20s", "TOKEN_NUMBER_DOUBLE");
else if (tokens[i].type == TOKEN_POWER)
ft_printf("%14s%30s", "TOKEN_POWER", "");
else if (tokens[i].type == TOKEN_SIGN)
{
ft_printf("%14s", "TOKEN_SIGN");
if (tokens[i].subtype == TOKEN_SIGN_PLUS)
ft_printf("%30s", "TOKEN_SIGN_PLUS");
else if (tokens[i].subtype == TOKEN_SIGN_MINUS)
ft_printf("%30s", "TOKEN_SIGN_MINUS");
}
else if (tokens[i].type == TOKEN_FACTOR)
{
ft_printf("%14s", "TOKEN_FACTOR");
if (tokens[i].subtype == TOKEN_FACTOR_MULTIPLICATION)
ft_printf("%30s", "TOKEN_FACTOR_MULTIPLICATION");
else if (tokens[i].subtype == TOKEN_FACTOR_DIVISION)
ft_printf("%30s", "TOKEN_FACTOR_DIVISION");
}
ft_printf("%20s", "TOKEN_POWER");
else if (tokens[i].type == TOKEN_SIGN_PLUS)
ft_printf("%20s", "TOKEN_SIGN_PLUS");
else if (tokens[i].type == TOKEN_SIGN_MINUS)
ft_printf("%20s", "TOKEN_SIGN_MINUS");
else if (tokens[i].type == TOKEN_FACTOR_MULT)
ft_printf("%20s", "TOKEN_FACTOR_MULT");
else if (tokens[i].type == TOKEN_FACTOR_DIV)
ft_printf("%20s", "TOKEN_FACTOR_DIV");
else if (tokens[i].type == TOKEN_EQUAL)
ft_printf("%14s%30s", "TOKEN_EQUAL", "");
ft_printf("%20s", "TOKEN_EQUAL");
else if (tokens[i].type == TOKEN_END)
ft_printf("%14s%30s", "TOKEN_END", "");
ft_printf("%20s", "TOKEN_END");
ft_putstr(" - value : ");
if (tokens[i].type == TOKEN_NUMBER)
if (tokens[i].tag == TOKEN_NUMBER)
{
printf("%g\n", tokens[i].value_double);
}