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 /include/lexer/lexer_class.h | |
| parent | 88274ecae045df69903c4efddc9b24a87ffe31e2 (diff) | |
add class for recurrent lexer
Diffstat (limited to 'include/lexer/lexer_class.h')
| -rw-r--r-- | include/lexer/lexer_class.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/include/lexer/lexer_class.h b/include/lexer/lexer_class.h new file mode 100644 index 0000000..881ef47 --- /dev/null +++ b/include/lexer/lexer_class.h @@ -0,0 +1,41 @@ +#pragma once + +#include <string> +#include <unordered_map> + +#include "lexer/enum_type.h" + +using namespace std; + +namespace ov4 +{ + +class T_lexer +{ +public: + + // token.h + class T_token; + string trim(const string &s, const string &trim_target = " \t"); + bool is_single_symbol(char c); + void bracket_depth_changer(char c, int &bracket_depth); + bool token_continue(const string &s, char next); + void token_push(const string &push_s, int bracket_depth, bool force_text = false); + int tokenizer(const string &s); + + // ast.h + class T_ast; + string final_trim(size_t _begin, size_t _end); + size_t alloc_ast(); + int get_pivot_order(enum_token_type x); + bool is_operator(enum_token_type x); + void parse(size_t cmd_begin, size_t cmd_end, size_t ast_vec); + + // shared + std::vector<T_ast> ast; + std::vector<T_token> token; + size_t ast_index = 0; + +}; + +} |
