forked from XinShuoWang/FilterTree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathast.h
42 lines (37 loc) · 718 Bytes
/
ast.h
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
#ifndef AST_H
#define AST_H
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
enum ValueType
{
AND,
OR,
/*compare*/
LESS,
LESS_OR_EQUAL,
EQUAL,
NOT_EQUAL,
GREATER,
GREATER_OR_EQUAL,
/*function*/
TO_YEAR,
/*parameter*/
STR_PARAM,
INT_PARAM,
FLOAT_PARAM
};
struct Value
{
enum ValueType type_;
void* data_;
int child_num_;
struct Value **child_;
};
struct Value *new_value(enum ValueType type);
struct Value *new_int_value(int val);
struct Value *new_float_value(float val);
struct Value *new_string_value(char *str, int len);
void delete_value(struct Value *val);
void append_child(struct Value *val, struct Value *child);
#endif