diff options
Diffstat (limited to 'src/ast.c')
-rw-r--r-- | src/ast.c | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -604,3 +604,47 @@ bool type_lists_match(struct type *al, struct type *bl) } return true; } + +const char *ast_str(enum ast_kind k) +{ +#define CASE(x) case x: return #x; + switch (k) { + CASE(AST_CLOSURE); + CASE(AST_IF); + CASE(AST_LET); + CASE(AST_INIT); + CASE(AST_CALL); + CASE(AST_PROC_DEF); + CASE(AST_VAR_DEF); + CASE(AST_DOT); + CASE(AST_BLOCK); + CASE(AST_ID); + CASE(AST_EMPTY); + CASE(AST_ADD); + CASE(AST_SUB); + CASE(AST_MUL); + CASE(AST_DIV); + CASE(AST_REM); + CASE(AST_LAND); + CASE(AST_LOR); + CASE(AST_LSHIFT); + CASE(AST_RSHIFT); + CASE(AST_LT); + CASE(AST_GT); + CASE(AST_LE); + CASE(AST_GE); + CASE(AST_NE); + CASE(AST_EQ); + CASE(AST_NEG); + CASE(AST_LNOT); + CASE(AST_NOT); + CASE(AST_CONST_INT); + CASE(AST_CONST_CHAR); + CASE(AST_CONST_BOOL); + CASE(AST_CONST_FLOAT); + CASE(AST_CONST_STR); + } +#undef CASE + + return "UNKNOWN"; +} |