diff options
author | kartofen <mladenovnasko0@gmail.com> | 2024-09-08 18:36:07 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2024-09-08 18:36:07 +0300 |
commit | 4308cd4abe5a75fb8410df929eac687cbd04032b (patch) | |
tree | 4a5871db2168cb96deab29be7aed36262511c0c1 /src/main.c | |
parent | db32849ce314a93db01f877a057a91022fec7c8b (diff) |
update mempool and add implement hash array mapped trie (not integrated)
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -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); |