aboutsummaryrefslogtreecommitdiff
path: root/include/parser/ast.h
blob: 151afb0358ed615c0d5deb9057360b3ef78d30da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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)
{
    ;
}

}