add test for equal
This commit is contained in:
@@ -220,7 +220,9 @@ void lexerize(const char *input, s_token *tokens)
|
||||
int tokens_count;
|
||||
int input_pos;
|
||||
int token_size;
|
||||
bool has_equal;
|
||||
|
||||
has_equal = false;
|
||||
tokens_count = 0;
|
||||
input_pos = 0;
|
||||
while (input[input_pos])
|
||||
@@ -288,6 +290,7 @@ void lexerize(const char *input, s_token *tokens)
|
||||
}
|
||||
else if (token_is_equal(input, input_pos, &token_size))
|
||||
{
|
||||
has_equal = true;
|
||||
tokens[tokens_count].type = TOKEN_EQUAL;
|
||||
tokens[tokens_count].tag = TOKEN_NO_TAG;
|
||||
tokens[tokens_count].value_char = '=';
|
||||
@@ -305,6 +308,9 @@ void lexerize(const char *input, s_token *tokens)
|
||||
input_pos += token_size;
|
||||
}
|
||||
|
||||
if (!has_equal)
|
||||
stop_errors("the input polynomial does not contains an equal sign, it's an expression not an equation.\n");
|
||||
|
||||
tokens[tokens_count].type = TOKEN_END;
|
||||
tokens[tokens_count].tag = TOKEN_NO_TAG;
|
||||
tokens[tokens_count].value_char = '\0';
|
||||
|
||||
Reference in New Issue
Block a user