-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.h
More file actions
55 lines (47 loc) · 1.17 KB
/
Copy pathutils.h
File metadata and controls
55 lines (47 loc) · 1.17 KB
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
/*
* @Copyright: minic
* @Author: David.Huangjunlang
* @Description: 工具集的头文件,定义函数
* @LastEditors: David.Huangjunlang
* @LastEditTime: 2020-04-30 10:12:08
* @FilePath: /minic/utils.h
*/
#ifndef UTILS_H
#define UTILS_H
#include "main.h"
#include <string>
/**
* @description: 新建一个 statement 类型的 node 并返回
* @param {StmtKind}
* @return: node*
*/
node *newStmtNode(StmtKind kind);
/**
* @description: 新建一个 expression 类型的 node 并返回
* @param {ExpKind}
* @return: node*
* @author: David.Huangjunlang
*/
node *newExpNode(ExpKind kind);
/**
* @description: 在 nodeList 链表的末尾添加一个 statement 类型的 node
* @param {node*, node*}
* @return: void
* @author: David.Huangjunlang
*/
void addNode(node *list, node *stmt);
/**
* @description: 从程序根节点遍历语法树,并打印到文件中
* @param {void}
* @return: void
* @author: David.Huangjunlang
*/
void printTree();
/**
* @description: 打印节点信息到文件中, level 参数用于设定输出缩进格式
* @param {node*, int}
* @return: void
* @author: David.Huangjunlang
*/
void printNode(node *, int);
#endif