aboutsummaryrefslogtreecommitdiff
path: root/interpreter/print.c
diff options
context:
space:
mode:
authorCamil Staps2016-08-26 14:00:29 +0200
committerCamil Staps2016-08-26 14:00:29 +0200
commit5fa8a5684cfb2456b536765b608f0883b1b90029 (patch)
tree5a85bd4c0089e7f87cabe8614ef356557cd15a63 /interpreter/print.c
parentAdded eval_main (diff)
Added strictness annotations
Diffstat (limited to 'interpreter/print.c')
-rw-r--r--interpreter/print.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/interpreter/print.c b/interpreter/print.c
index c60c190..3f17475 100644
--- a/interpreter/print.c
+++ b/interpreter/print.c
@@ -15,6 +15,7 @@ void print_token(token* tk) {
case TOKEN_CLOSE_SQ: c = ']'; break;
case TOKEN_EQUALS: c = '='; break;
case TOKEN_COMMA: c = ','; break;
+ case TOKEN_STRICT: c = '!'; break;
case TOKEN_CODE:
printf("code ");
return;
@@ -37,6 +38,12 @@ void print_token_list(token_list* list) {
}
void print_expression(expression* expr) {
+ if (!expr)
+ return;
+
+ if (expr->is_strict)
+ printf("!");
+
switch (expr->kind) {
case EXPR_INT:
printf("%d", *((int*) expr->var1));