aboutsummaryrefslogtreecommitdiff
path: root/cibic.y
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2014-03-25 21:50:31 +0800
committerTeddy <ted.sybil@gmail.com>2014-03-25 21:50:31 +0800
commite9c783cec3496c3b84681ce162f6133bec8a709d (patch)
treefa1063ba1eb69cd3e560c69f0bc9e6368b4a90ce /cibic.y
parentbebc7300ad6987e76db8fca785a83123ba08a927 (diff)
fixed bugs: str and char const recogn; fields wrapping
Diffstat (limited to 'cibic.y')
-rw-r--r--cibic.y5
1 files changed, 3 insertions, 2 deletions
diff --git a/cibic.y b/cibic.y
index 3cfdad9..6f3fc13 100644
--- a/cibic.y
+++ b/cibic.y
@@ -1,5 +1,6 @@
%{
#include <stdio.h>
+#include <stdlib.h>
#include "ast.h"
%}
%union {
@@ -83,10 +84,10 @@ type_specifier
| KW_CHAR { $$ = cnode_add_loc(cnode_create_type_spec(KW_CHAR, 0), @$); }
| KW_INT { $$ = cnode_add_loc(cnode_create_type_spec(KW_INT, 0), @$); }
| struct_or_union identifier '{' struct_fields '}' {
- $$ = cnode_add_loc(cnode_create_type_spec($1, 2, $2, cnode_add_loc($4, @4)), @$);
+ $$ = cnode_add_loc(cnode_create_type_spec($1, 2, $2, cnode_add_loc(cnode_list_wrap(FIELDS, $4), @4)), @$);
}
| struct_or_union '{' struct_fields '}' {
- $$ = cnode_add_loc(cnode_create_type_spec($1, 2, cnode_create_nop(), cnode_add_loc($3, @3)), @$);
+ $$ = cnode_add_loc(cnode_create_type_spec($1, 2, cnode_create_nop(), cnode_add_loc(cnode_list_wrap(FIELDS, $3), @3)), @$);
}
| struct_or_union identifier {
$$ = cnode_add_loc(cnode_create_type_spec($1, 2, $2, cnode_create_nop()), @$);