-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathast.h
More file actions
46 lines (27 loc) · 708 Bytes
/
Copy pathast.h
File metadata and controls
46 lines (27 loc) · 708 Bytes
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
#pragma once
#ifndef STRUCT_AST
#define STRUCT_AST
struct rule;
typedef struct ast {
struct ast *parent;
struct ast *child;
struct ast *next;
struct ast *prev;
int n_childs;
int ruleid;
char *name;
char *content;
void (*callback)(struct ast *self);
} ast;
#endif
ast *ast_new(char *content, char* name);
ast *ast_add_child(ast *parent, ast *child);
ast *ast_add_sibling(ast *parent, ast *sibling);
ast *ast_pop(ast *node);
ast *ast_get_root(ast *node);
void ast_free(ast **np);
char* ast_to_string(ast *node);
void ast_print(ast *node);
void ast_simplify(ast *node, struct rule* rule);
void ast_wipe(ast *node, struct rule* rule);
void ast_collapse(ast *node, struct rule* rule);