handle superscript powers

This commit is contained in:
hugogogo
2026-05-06 20:01:41 +02:00
parent 4b6ad34720
commit 16c57c9bea
8 changed files with 130 additions and 44 deletions

View File

@@ -1,4 +1,4 @@
/* computorv1.c */
/* launcher.c */
#include "computorv1.h"
@@ -110,8 +110,8 @@ void launch_computorv1(char *input)
remove_spaces(input);
// lexerize
arg_len = ft_strlen(input) + 1; // +1 for last END token
// ft_printf("-> tokens[%i]\n", arg_len); // debug
arg_len = ft_strlen(input) + 1; // +1 for last END token
print_debug("\n-> tokens[%i]\n", arg_len); // debug
s_token tokens[arg_len];
tokens_g_err = tokens;
tokens_fill_null(tokens, arg_len);
@@ -123,7 +123,7 @@ void launch_computorv1(char *input)
// parse
terms_count_prediction = count_any_of(input, "-+=") + 2; // +1 for first term that can have no leading '+', +1 for last term == NULL
// ft_printf("-> terms[%i]\n", terms_count_prediction); // debug
print_debug("-> terms[%i]\n\n", terms_count_prediction); // debug
s_term terms[terms_count_prediction];
terms_g_err = terms;
terms_fill_null(terms, terms_count_prediction);
@@ -141,6 +141,8 @@ void launch_computorv1(char *input)
polynom_fill_null(polynom, max_exponent);
reduce(terms, polynom);
// solve
// debug
print_state();
}