diff options
author | Julian T <julian@jtle.dk> | 2020-10-12 16:26:42 +0200 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2020-10-12 16:54:48 +0200 |
commit | 4e05a55e373bd315e721d534a1711fec4c0054c5 (patch) | |
tree | 4fc0141760c2730ed79aaa4c7aa60ea45cc66cc0 /sem3/osc/miniproject/cnasm/ast.h | |
parent | b7f9cf43c8a9ab3400cbb30d5e1cadb0c6c2cf23 (diff) |
Moved to linux kernel inspired clang-format
Diffstat (limited to 'sem3/osc/miniproject/cnasm/ast.h')
-rw-r--r-- | sem3/osc/miniproject/cnasm/ast.h | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/sem3/osc/miniproject/cnasm/ast.h b/sem3/osc/miniproject/cnasm/ast.h index 61a8f4f..4f37553 100644 --- a/sem3/osc/miniproject/cnasm/ast.h +++ b/sem3/osc/miniproject/cnasm/ast.h @@ -11,37 +11,38 @@ #define CLEQ CGT ^ 0x80 #define CGEQ CLT ^ 0x80 -enum ntype { TSTM_LIST, TIF, TFOR, TIDENT, TWHILE}; +enum ntype { TSTM_LIST, TIF, TFOR, TIDENT, TWHILE }; typedef struct cond { - uint8_t cmp; - char *a; - char *b; + uint8_t cmp; + char *a; + char *b; } cond_t; typedef struct ast_node { - enum ntype t; - // Dependent on type - union { - struct { - cond_t *condition; - struct ast_node *iftrue; - struct ast_node *iffalse; - } flowctrl; - struct { - cond_t *condition; - char *pre; - char *inc; - struct ast_node *stuff; - } forloop; - char *ident; - struct { - struct ast_node *children[2]; - } list; - }; + enum ntype t; + // Dependent on type + union { + struct { + cond_t *condition; + struct ast_node *iftrue; + struct ast_node *iffalse; + } flowctrl; + struct { + cond_t *condition; + char *pre; + char *inc; + struct ast_node *stuff; + } forloop; + char *ident; + struct { + struct ast_node *children[2]; + } list; + }; } 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 *insert_stm(ast_node_t *stm, ast_node_t *stm_list); ast_node_t *insert_ident(char *ident); ast_node_t *insert_for(char *pre, cond_t *c, char *inc, ast_node_t *stuff); @@ -50,4 +51,4 @@ cond_t *insert_cond(uint8_t cmp, char *a, char *b); void node_print(ast_node_t *node); -#endif +#endif |