refactor: evaluator incomplete.
SO, i forgot to implement nud and led correctly and the parser cant tell apart from - as unary and - as binary (+ as well), i need to correct that, move Node * to TreeResult so to use NodeResult with nud and led
This commit is contained in:
@@ -27,6 +27,7 @@ TokenizeResult tokenize(const char *input) {
|
||||
TokenResult result = tokenize_number(input, &offset);
|
||||
|
||||
if (!result.is_valid) {
|
||||
arraylist_destroy(&arr);
|
||||
return (TokenizeResult) {.is_valid = false, .err = result.err};
|
||||
}
|
||||
|
||||
@@ -41,6 +42,7 @@ TokenizeResult tokenize(const char *input) {
|
||||
} else if (isspace(input[offset])) {
|
||||
// Nothing...
|
||||
} else {
|
||||
arraylist_destroy(&arr);
|
||||
return (TokenizeResult) {
|
||||
.is_valid = false,
|
||||
.err = LEXER_NOT_RECOGNIZED_SYMBOL};
|
||||
@@ -50,6 +52,7 @@ TokenizeResult tokenize(const char *input) {
|
||||
}
|
||||
|
||||
if (arraylist_size(arr) < 1) {
|
||||
arraylist_destroy(&arr);
|
||||
return (TokenizeResult) {.is_valid = false, .err = LEXER_EMPTY_INPUT};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user