diff options
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); |