diff options
author | Teddy <ted.sybil@gmail.com> | 2014-03-25 06:57:44 +0800 |
---|---|---|
committer | Teddy <ted.sybil@gmail.com> | 2014-03-25 06:57:44 +0800 |
commit | 79b8219a7b8a786740a6c57b2d819953bcf261de (patch) | |
tree | a0e81987d32f5748ff99de2c67dd543abd42417f /ast.c | |
parent | 04ee9c8bef572f4351090b768413e5b6a3ac4a77 (diff) |
verbose error reporting
Diffstat (limited to 'ast.c')
-rw-r--r-- | ast.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -81,12 +81,12 @@ CNode *cnode_create_int_const(int val) { return exp; } -CNode *cnode_create_char_const(int val) { +CNode *cnode_create_char_const(char *val) { /* TODO: overflow checking */ CNode *exp = NEW_CNODE; exp->type = CHAR; exp->chd = exp->next = NULL; - exp->rec.intval = val; + exp->rec.strval = val; return exp; } @@ -375,13 +375,13 @@ char *cnode_debug_type_repr(CNode *ast) { } void cnode_debug_print_plain(CNode *ast) { - printf("(%s", cnode_debug_type_repr(ast)); + fprintf(stderr, "(%s", cnode_debug_type_repr(ast)); for (ast = ast->chd; ast; ast = ast->next) { - printf(" "); + fprintf(stderr, " "); cnode_debug_print_plain(ast); } - printf(")"); + fprintf(stderr, ")"); } void cnode_debug_print_fancy(CNode *ast, int lvl) { @@ -389,10 +389,10 @@ void cnode_debug_print_fancy(CNode *ast, int lvl) { int i; show[lvl] = 1; for (i = 0; i < lvl - 1; i++) - printf("%c ", show[i] ? '|' : ' '); + fprintf(stderr, "%c ", show[i] ? '|' : ' '); if (lvl) - printf("|____"); - printf("[%s]\n", cnode_debug_type_repr(ast)); + fprintf(stderr, "|____"); + fprintf(stderr, "[%s]\n", cnode_debug_type_repr(ast)); for (ast = ast->chd; ast; ast = ast->next) { if (!ast->next) show[lvl] = 0; |