}
else if (accept(p, RECORD))
{
-
-
-// do
-// {
-// int nsyms = 0;
-// Symbol* first = NULL;
-// Symbol* sym = NULL;
-//// Symbol* type = NULL;
-// char* name = NULL;
-// bool export = false;
-//
-// do
+ item->type = calloc(1, sizeof(Type));
+ item->type->form = FORM_RECORD;
+// Symbol **fields = &(item->type->fields);
+// while (peek(p)->type != END)
// {
-// name = expect_text(p, IDENT);
-// export = accept(p, '*');
-// sym = symbol_new(p, name, SYM_VAR, export);
-// first = (nsyms == 0 ? sym : first);
-// sym->global = (p->level <= 1 ? 1 : 0);
-// nsyms++;
-// }
-// while (accept(p, ','));
+// do
+// {
+// char* name = expect_text(p, IDENT);
+// bool export = accept(p, '*');
+// *prev = symbol_new(p, name, SYM_VAR, export);
+// nsyms++;
+// }
+// while (accept(p, ','));
//
-// Item base_type = {0};
-// expect(p, ':');
-// type(p, &base_type);
//
-//// name = expect_text(p, IDENT);
-//// type = symbol_get(p, SYM_TYPE, name);
+//// int nsyms = 0;
+//// Symbol head = {0};
+//// Symbol **prev = &(head.next);
+////
+//// Item base_type = {0};
+//// expect(p, ':');
+//// type(p, &base_type);
//
-// /* apply the type to the newly created symbols */
-// for (int i = 0; i < nsyms; i++)
-// {
-// first->type = base_type.type;
-// codegen_var(p, first);
-// sym = first->next;
+//// /* apply the type to the newly created symbols */
+//// for (int i = 0; i < nsyms; i++)
+//// {
+//// first->type = base_type.type;
+//// codegen_var(p, first);
+//// sym = first->next;
+//// }
// }
-// }
-// while (matches(p, IDENT));
-
- while (peek(p)->type != END)
- {
- int nsyms = 0;
- Symbol head = {0};
- Symbol **prev = &(head.next);
- do
- {
- char* name = expect_text(p, IDENT);
- bool export = accept(p, '*');
- *prev = symbol_new(p, name, SYM_VAR, export);
- nsyms++;
- }
- while (accept(p, ','));
-
- Item base_type = {0};
- expect(p, ':');
- type(p, &base_type);
-
-// /* apply the type to the newly created symbols */
-// for (int i = 0; i < nsyms; i++)
-// {
-// first->type = base_type.type;
-// codegen_var(p, first);
-// sym = first->next;
-// }
- }
expect(p, END);
}