handle superscript powers
This commit is contained in:
@@ -18,25 +18,27 @@ static void print_context_tokens()
|
||||
ft_dprintf(STDERR_FILENO, "token[%2i] - type : ", i);
|
||||
|
||||
if (tokens_g_err[i].type == TOKEN_VARIABLE)
|
||||
ft_dprintf(STDERR_FILENO, "%20s", "TOKEN_VARIABLE");
|
||||
ft_dprintf(STDERR_FILENO, "%22s", "TOKEN_VARIABLE");
|
||||
else if (tokens_g_err[i].type == TOKEN_NUMBER_INT)
|
||||
ft_dprintf(STDERR_FILENO, "%20s", "TOKEN_NUMBER_INT");
|
||||
ft_dprintf(STDERR_FILENO, "%22s", "TOKEN_NUMBER_INT");
|
||||
else if (tokens_g_err[i].type == TOKEN_NUMBER_INT_SUPER)
|
||||
ft_dprintf(STDERR_FILENO, "%22s", "TOKEN_NUMBER_INT_SUPER");
|
||||
else if (tokens_g_err[i].type == TOKEN_NUMBER_DOUBLE)
|
||||
ft_dprintf(STDERR_FILENO, "%20s", "TOKEN_NUMBER_DOUBLE");
|
||||
ft_dprintf(STDERR_FILENO, "%22s", "TOKEN_NUMBER_DOUBLE");
|
||||
else if (tokens_g_err[i].type == TOKEN_POWER)
|
||||
ft_dprintf(STDERR_FILENO, "%20s", "TOKEN_POWER");
|
||||
ft_dprintf(STDERR_FILENO, "%22s", "TOKEN_POWER");
|
||||
else if (tokens_g_err[i].type == TOKEN_SIGN_PLUS)
|
||||
ft_dprintf(STDERR_FILENO, "%20s", "TOKEN_SIGN_PLUS");
|
||||
ft_dprintf(STDERR_FILENO, "%22s", "TOKEN_SIGN_PLUS");
|
||||
else if (tokens_g_err[i].type == TOKEN_SIGN_MINUS)
|
||||
ft_dprintf(STDERR_FILENO, "%20s", "TOKEN_SIGN_MINUS");
|
||||
ft_dprintf(STDERR_FILENO, "%22s", "TOKEN_SIGN_MINUS");
|
||||
else if (tokens_g_err[i].type == TOKEN_FACTOR_MULT)
|
||||
ft_dprintf(STDERR_FILENO, "%20s", "TOKEN_FACTOR_MULT");
|
||||
ft_dprintf(STDERR_FILENO, "%22s", "TOKEN_FACTOR_MULT");
|
||||
else if (tokens_g_err[i].type == TOKEN_FACTOR_DIV)
|
||||
ft_dprintf(STDERR_FILENO, "%20s", "TOKEN_FACTOR_DIV");
|
||||
ft_dprintf(STDERR_FILENO, "%22s", "TOKEN_FACTOR_DIV");
|
||||
else if (tokens_g_err[i].type == TOKEN_EQUAL)
|
||||
ft_dprintf(STDERR_FILENO, "%20s", "TOKEN_EQUAL");
|
||||
ft_dprintf(STDERR_FILENO, "%22s", "TOKEN_EQUAL");
|
||||
else if (tokens_g_err[i].type == TOKEN_END)
|
||||
ft_dprintf(STDERR_FILENO, "%20s", "TOKEN_END");
|
||||
ft_dprintf(STDERR_FILENO, "%22s", "TOKEN_END");
|
||||
|
||||
ft_putstr(" - value : ");
|
||||
|
||||
@@ -44,6 +46,10 @@ static void print_context_tokens()
|
||||
{
|
||||
ft_dprintf(STDERR_FILENO, "%i\n", tokens_g_err[i].value_int);
|
||||
}
|
||||
else if (tokens_g_err[i].type == TOKEN_NUMBER_INT_SUPER)
|
||||
{
|
||||
ft_dprintf(STDERR_FILENO, "%i\n", tokens_g_err[i].value_int);
|
||||
}
|
||||
else if (tokens_g_err[i].type == TOKEN_NUMBER_DOUBLE)
|
||||
{
|
||||
dprintf(STDERR_FILENO, "%g\n", tokens_g_err[i].value_double);
|
||||
|
||||
16
src/utils/printer.c
Normal file
16
src/utils/printer.c
Normal file
@@ -0,0 +1,16 @@
|
||||
/* printer.c */
|
||||
|
||||
#include "computorv1.h"
|
||||
|
||||
void print_debug(const char *description, ...)
|
||||
{
|
||||
if (!flag_debug_mode)
|
||||
return;
|
||||
|
||||
// print the formatted description
|
||||
va_list args;
|
||||
va_start(args, description);
|
||||
// ft_vdprintf(STDOUT_FILENO, description, args);
|
||||
vdprintf(STDOUT_FILENO, description, args);
|
||||
va_end(args);
|
||||
}
|
||||
Reference in New Issue
Block a user