Use the new error code conversion code.

This commit is contained in:
Danila Fedorin 2018-02-10 16:02:22 -08:00
parent b46dccb70d
commit 065f2fa4b9

View File

@ -1,4 +1,5 @@
#include "lexer.h" #include "lexer.h"
#include "libabacus_util.h"
libab_result lexer_init(lexer* lexer) { libab_result lexer_init(lexer* lexer) {
size_t i; size_t i;
@ -39,14 +40,12 @@ libab_result lexer_init(lexer* lexer) {
eval_config_init(&lexer->config); eval_config_init(&lexer->config);
for(i = 0; i < count && result == LIBAB_SUCCESS; i++) { for(i = 0; i < count && result == LIBAB_SUCCESS; i++) {
result = result = convert_lex_result(
(eval_config_add(&lexer->config, words[i], tokens[i]) == LIBLEX_SUCCESS) eval_config_add(&lexer->config, words[i], tokens[i]));
? LIBAB_SUCCESS : LIBAB_MALLOC;
} }
return result; return result;
} }
libab_result lexer_free(lexer* lexer) { libab_result lexer_free(lexer* lexer) {
return (eval_config_free(&lexer->config) == LIBLEX_SUCCESS) ? return convert_lex_result(eval_config_free(&lexer->config));
LIBAB_SUCCESS : LIBAB_MALLOC;
} }