From 4308cd4abe5a75fb8410df929eac687cbd04032b Mon Sep 17 00:00:00 2001 From: kartofen Date: Sun, 8 Sep 2024 18:36:07 +0300 Subject: update mempool and add implement hash array mapped trie (not integrated) --- src/main.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 8c4bfec..8baaa94 100644 --- a/src/main.c +++ b/src/main.c @@ -811,7 +811,10 @@ static int toklist_expr(struct tctx *tctx, struct toklist **toklist) if(TOKEN(tctx)->type == TOKEN_LP) depth++; else if(TOKEN(tctx)->type == TOKEN_RP) depth--; - + + // printf("%zu\n", depth); + // print_token(TOKEN(tctx)); + if(toklist) token_clone(&tokens[tokens_len++], TOKEN(tctx)); @@ -823,10 +826,6 @@ static int toklist_expr(struct tctx *tctx, struct toklist **toklist) } return 0; - -// fail: - // for(size_t i = 0; i < tokens_len; i++) token_dealloc(&tokens[i]); - // return 1; } #define SET_TOKEN_TYPE(t, ttype) (t)->type = (ttype) @@ -842,6 +841,15 @@ static struct toklist *value_to_toklist(value_t value) if(strcmp(value->value.atom, "lambda") == 0) { SET_TOKEN_TYPE(&token, TOKEN_LAMBDA); break; + } else if(strcmp(value->value.atom, "if") == 0) { + SET_TOKEN_TYPE(&token, TOKEN_IF); + break; + } else if(strcmp(value->value.atom, "quote") == 0) { + SET_TOKEN_TYPE(&token, TOKEN_QUOTE_FORM); + break; + } else if(strcmp(value->value.atom, "'") == 0) { + SET_TOKEN_TYPE(&token, TOKEN_QUOTE); + break; } SET_TOKEN_TYPE(&token, TOKEN_ID); -- cgit v1.2.3