aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2014-03-25 00:45:52 +0800
committerTeddy <ted.sybil@gmail.com>2014-03-25 00:45:52 +0800
commitda3bf74ba8946f88b892907361f86f567301be83 (patch)
tree989bcae1844e8e10ce03ea3d1f355938b8b404a8
parent6172cc802ea408e9050ec6e3b3f5b6959b07c87d (diff)
...
-rw-r--r--ast.c12
-rw-r--r--cibic.y2
2 files changed, 10 insertions, 4 deletions
diff --git a/ast.c b/ast.c
index 599b67d..f3ad3ba 100644
--- a/ast.c
+++ b/ast.c
@@ -234,7 +234,6 @@ char *cnode_debug_type_repr(CNode *ast) {
case DECLS: type = "prg_decls"; break;
case FUNCS: type = "prg_funcs"; break;
case DECL: type = "decl"; break;
- case DECLR: type = "declr"; break;
case INIT_DECLR: type = "init_declr"; break;
case PLAIN_DECL: type = "p_decl"; break;
case TYPE_NAME: type = "type_name"; break;
@@ -260,12 +259,13 @@ char *cnode_debug_type_repr(CNode *ast) {
type = "str";
aptr += sprintf(abuff, "\"%s\"", ast->rec.strval);
break;
+ case FIELD: type = "field"; break;
case NOP: type = "nop"; break;
case EXP:
case INITR:
case TYPE_SPEC:
- case FIELD:
case STMT:
+ case DECLR:
type = NULL; break;
}
if (ast->type == EXP)
@@ -334,6 +334,7 @@ char *cnode_debug_type_repr(CNode *ast) {
{
case DECLR_FUNC: type = "func"; break;
case DECLR_ARR: type = "arr"; break;
+ case '*': type = "*"; break;
default: assert(0);
}
}
@@ -361,7 +362,12 @@ char *cnode_debug_type_repr(CNode *ast) {
default: assert(0);
}
}
- else assert(type);
+ else
+ {
+ if (type == NULL)
+ puts("");
+ assert(type);
+ }
if (aptr == abuff)
sprintf(buffer, "%s", type);
else
diff --git a/cibic.y b/cibic.y
index a4f7eb2..0a98097 100644
--- a/cibic.y
+++ b/cibic.y
@@ -303,7 +303,7 @@ postfix
$$ = cnode_create_exp(POSTFIX_CALL, 1, cnode_list_wrap(ARGS, $2));
}
| '(' ')' {
- $$ = cnode_create_exp(POSTFIX_CALL, 1, cnode_list_wrap(cnode_create_nop()));
+ $$ = cnode_create_exp(POSTFIX_CALL, 1, cnode_list_wrap(ARGS, cnode_create_nop()));
}
| '.' identifier { $$ = cnode_create_exp(POSTFIX_DOT, 1, $2); }
| OPT_PTR identifier { $$ = cnode_create_exp(POSTFIX_PTR, 1, $2); }