diff options
| author | _ov4 <ov4@ov4.org> | 2026-09-05 14:45:12 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-09-05 14:45:12 +0000 |
| commit | 16a3288af9d214d11feb0c1c3bdb7ecaca2bfdd0 (patch) | |
| tree | bb854811bae8b91b268d250f26b60535c95144f1 /include/parser/ast.h | |
| parent | 873d06fb044687cd0707c9c24defe4d2d4fcd5c6 (diff) | |
refactor very simple tokenizer
Diffstat (limited to 'include/parser/ast.h')
| -rw-r--r-- | include/parser/ast.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/include/parser/ast.h b/include/parser/ast.h new file mode 100644 index 0000000..151afb0 --- /dev/null +++ b/include/parser/ast.h @@ -0,0 +1,56 @@ +#pragma once + +#include <string> + +#include "parser/enum_type.h" +#include "parser/shared.h" + +using namespace std; // remove this + +namespace ov4 +{ + +class T_ast +{ +public: + T_ast() = default; + + enum_token_type token_type; + string command_text; + size_t left; + size_t right; +}; + +size_t alloc_ast() +{ + ast.emplace_back(); + return ast_index++; +} + +int get_pivot_order(enum_token_type x) +{ + switch(x) + { + case ASYNC: + case SEMICOLON: + return 1000; + + case LOGIC_AND: + case LOGIC_OR: + return 500; + + case PIPE: + return 100; + + default: + return 0; + } + return 0; +} + +void parse(size_t cmd_begin, size_t cmd_end, size_t ast_vec) +{ + ; +} + +} |
