aboutsummaryrefslogtreecommitdiff
path: root/test.c
blob: 3a8051002c6bda92d763f0eedb5e398c6cbcb5cf (plain) (blame)
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
#include <stdlib.h>
#include "semantics.h"
#define PV(str) cscope_push_var(scope, newvar(str))
#define PT(str) cscope_push_type(scope, newtype(str))

CVar_t newvar(const char *name) {
    return cvar_create(name, NULL);
}

CType_t newtype(const char *name) {
    return ctype_create(name, 0);
}

int main() {
    CScope_t scope = cscope_create();
    PV("a");
    PV("b");
    PV("asdf");
    PV("fdsa");
    PV("hello");
    cscope_debug_print(scope);
    cscope_enter(scope);
    PV("a");
    PV("hello");
    PT("CType");
    cscope_debug_print(scope);
    cscope_enter(scope);
    PV("a");
    PV("yay");
    PV("world");
    PT("CType");
    cscope_debug_print(scope);
    cscope_exit(scope);
    cscope_debug_print(scope);
    cscope_exit(scope);
    cscope_debug_print(scope);
    return 0;
}