First version for string_to_number, just one test, is working fine, i'm considering swithching to handling only integers for in the future to manage in special struct that manages doubles as fractions, obviously this will mean changing nodes for general numbers to integers/fractions and shit

This commit is contained in:
2026-03-09 09:06:06 -06:00
parent 194f1dd80f
commit 771069455d
5 changed files with 95 additions and 2 deletions

View File

@@ -34,6 +34,7 @@ typedef enum {
LEXER_EMPTY_INPUT,
LEXER_NULL_ARG,
LEXER_WRONG_SYNTAX,
LEXER_BUF_OVERFLOW,
} LexerErr;
// Can be thought as tokens, they will be used by the parser.
@@ -68,6 +69,7 @@ size_t ASTNodeArray_len(ASTNodeArray *arr);
// Lexer funtions as well as few functionality
LexerErr tokenize(const char* input, ASTNodeArray *out);
LexerErr tokenize_number(const char* input, size_t *offset, ASTNode *out);
LexerErr string_to_number(const char* str, double *number);
LexerErr string_to_number(const char* input, size_t *offset, double *number);
void reverser_string(char* input);
#endif // !LEXER_H