diff options
| author | _ov4 <ov4@ov4.org> | 2026-09-09 10:23:05 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-09-09 10:23:05 +0000 |
| commit | cc75c9bfec08007a483c9a5b3a733d4adc4d5c30 (patch) | |
| tree | 4b28e1fa3d897811a403f4402c74fc8c255e4542 /module-test/lexer_test.cc | |
| parent | 88274ecae045df69903c4efddc9b24a87ffe31e2 (diff) | |
add class for recurrent lexer
Diffstat (limited to 'module-test/lexer_test.cc')
| -rw-r--r-- | module-test/lexer_test.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/module-test/lexer_test.cc b/module-test/lexer_test.cc index e99213c..ffdf7b2 100644 --- a/module-test/lexer_test.cc +++ b/module-test/lexer_test.cc @@ -11,7 +11,6 @@ #include "magic_enum/magic_enum.hpp" -#include "lexer/shared.h" #include "lexer/ast.h" #include "lexer/enum_type.h" #include "lexer/token.h" @@ -100,10 +99,11 @@ int main() } + T_lexer lexer_instance; - tokenizer(s); + lexer_instance.tokenizer(s); cout << "---------- tokenizer ----------" << endl; - for (auto c : token) + for (auto c : lexer_instance.token) { if (c.token_type == LOGIC_AND) println("{} LOGIC_AND", c.bracket_depth); @@ -123,14 +123,14 @@ int main() cout << "---------- parse ----------" << endl; - parse(0, token.size(), alloc_ast()); + lexer_instance.parse(0, lexer_instance.token.size(), lexer_instance.alloc_ast()); cout << "---------- AST ----------" << endl; - for (size_t i = 0; i < ast.size(); i++) + for (size_t i = 0; i < lexer_instance.ast.size(); i++) { - print("{}: type: {} left: {} right: {}", i, magic_enum::enum_name(ast[i].token_type), ast[i].left, ast[i].right); - if (ast[i].token_type == TEXT) - print(" command: {}", ast[i].command_text); + print("{}: type: {} left: {} right: {}", i, magic_enum::enum_name(lexer_instance.ast[i].token_type), lexer_instance.ast[i].left, lexer_instance.ast[i].right); + if (lexer_instance.ast[i].token_type == TEXT) + print(" command: {}", lexer_instance.ast[i].command_text); println(); } return 0; |
