aboutsummaryrefslogtreecommitdiff
path: root/sem3/osc/miniproject/cnasm/ast.c
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-02-15 20:28:59 +0100
committerJulian T <julian@jtle.dk>2020-02-15 20:28:59 +0100
commit8076d839bf69e619f2e504122ec2ceb790a0b978 (patch)
treefa6cb7c649939c3a002676ce142105360d3d2fd6 /sem3/osc/miniproject/cnasm/ast.c
parentf17e8e195bd1ee3f911ae311dce8e8f7df4f8457 (diff)
Changed to a more consistent codestyle
Diffstat (limited to 'sem3/osc/miniproject/cnasm/ast.c')
-rw-r--r--sem3/osc/miniproject/cnasm/ast.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/sem3/osc/miniproject/cnasm/ast.c b/sem3/osc/miniproject/cnasm/ast.c
index 035b75d..badf090 100644
--- a/sem3/osc/miniproject/cnasm/ast.c
+++ b/sem3/osc/miniproject/cnasm/ast.c
@@ -9,7 +9,8 @@ static ast_node_t *create_empty_node() {
memset(n, 0, sizeof(ast_node_t));
}
-ast_node_t *insert_ctrl(enum ntype t, cond_t *c, ast_node_t *iftrue, ast_node_t *iffalse) {
+ast_node_t *insert_ctrl(enum ntype t, cond_t *c, ast_node_t *iftrue, ast_node_t *iffalse)
+{
ast_node_t *n = create_empty_node();
n->t = t;
@@ -20,7 +21,8 @@ ast_node_t *insert_ctrl(enum ntype t, cond_t *c, ast_node_t *iftrue, ast_node_t
return n;
}
-ast_node_t *insert_for(char *pre, cond_t *c, char *inc, ast_node_t *stuff) {
+ast_node_t *insert_for(char *pre, cond_t *c, char *inc, ast_node_t *stuff)
+{
ast_node_t *n = create_empty_node();
n->t = TFOR;
@@ -32,7 +34,8 @@ ast_node_t *insert_for(char *pre, cond_t *c, char *inc, ast_node_t *stuff) {
return n;
}
-ast_node_t *insert_stm(ast_node_t *stm, ast_node_t *stm_list) {
+ast_node_t *insert_stm(ast_node_t *stm, ast_node_t *stm_list)
+{
ast_node_t *n = create_empty_node();
n->t = TSTM_LIST;
@@ -41,7 +44,8 @@ ast_node_t *insert_stm(ast_node_t *stm, ast_node_t *stm_list) {
return n;
}
-ast_node_t *insert_ident(char *ident) {
+ast_node_t *insert_ident(char *ident)
+{
ast_node_t *n = create_empty_node();
n->t = TIDENT;
@@ -50,7 +54,8 @@ ast_node_t *insert_ident(char *ident) {
return n;
}
-cond_t *insert_cond(uint8_t cmp, char *a, char *b) {
+cond_t *insert_cond(uint8_t cmp, char *a, char *b)
+{
cond_t *c = malloc( sizeof(cond_t));
c->cmp = cmp;
@@ -58,12 +63,13 @@ cond_t *insert_cond(uint8_t cmp, char *a, char *b) {
c->b = b;
}
-void node_print(ast_node_t *node) {
- if( !node ){
+void node_print(ast_node_t *node)
+{
+ if ( !node ){
printf("Nil");
return;
}
- switch(node->t) {
+ switch (node->t) {
case TSTM_LIST:
printf("Stm_list(");
node_print(node->list.children[0]);