Print true, false, and lists.

This commit is contained in:
Simon Forman 2023-02-01 20:33:04 -08:00
parent b09055f299
commit 5d47512bf5
1 changed files with 15 additions and 0 deletions

View File

@ -161,6 +161,10 @@ text_to_expression(char *text)
return result;
}
/* Pre-declare so we can use it in print_node(). */
void
print_list(struct list_node* el);
void
print_node(struct JoyType j)
@ -172,6 +176,17 @@ print_node(struct JoyType j)
case joySymbol:
printf("%s", j.value.symbol);
break;
case joyTrue:
printf("true");
break;
case joyFalse:
printf("false");
break;
case joyList:
printf("[");
print_list(j.value.el);
printf("]");
break;
default:
printf("wtf");
}