aboutsummaryrefslogtreecommitdiff
path: root/interpreter/parse.c
diff options
context:
space:
mode:
authorCamil Staps2016-08-26 00:46:55 +0200
committerCamil Staps2016-08-26 00:46:55 +0200
commit00e2c70b01f28c9b00ec3d5096895a387676774d (patch)
tree8ee65ec944e5cdd79d517c723e6b506fa7ee43a1 /interpreter/parse.c
parentAdded tup example (diff)
Linking C functions
Diffstat (limited to 'interpreter/parse.c')
-rw-r--r--interpreter/parse.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/interpreter/parse.c b/interpreter/parse.c
index a9fc345..4c5ba99 100644
--- a/interpreter/parse.c
+++ b/interpreter/parse.c
@@ -2,6 +2,7 @@
#include <string.h>
+#include "code.h"
#include "log.h"
#include "mem.h"
@@ -30,6 +31,19 @@ token_list* parse_simple_expression(expression* expr, token_list* list) {
list = parse_name((char**) &expr->var1, list);
return list;
+ case TOKEN_CODE:
+ if (list->rest && list->rest->elem.kind == TOKEN_NAME) {
+ char* name;
+ expr->kind = EXPR_CODE;
+ list = parse_name(&name, list->rest);
+ expr->var2 = my_calloc(1, sizeof(unsigned char));
+ *((unsigned char*) expr->var2) = code_find(name, &expr->var1);
+ my_free(name);
+ return list;
+ } else {
+ return NULL;
+ }
+
case TOKEN_OPEN_P:
list = parse_simple_expression(expr, list->rest);
if (!list)