diff options
author | kartofen <mladenovnasko0@gmail.com> | 2024-08-25 15:46:56 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2024-08-25 15:46:56 +0300 |
commit | c740ece288c3fb6f858a911222fd63caf95c4eea (patch) | |
tree | 860b3e15260b9f1cf6abc3c1f26d586c4ffdcd85 /src/lexer.c | |
parent | 54f071ac7d47ef515a3f6a4db9e83f2f9aca3c8c (diff) |
lambda work, closures work, everything works
Diffstat (limited to 'src/lexer.c')
-rw-r--r-- | src/lexer.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lexer.c b/src/lexer.c index b8897da..77407a9 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -6,10 +6,12 @@ #include "lexer.h" #define CH(lexer) (lexer)->str[(lexer)->str_idx] -#define TOKEN_SEPARATOR_TABLE(X, l) \ - X(('(' == CH(l)), on_separator(l, TOKEN_LP)) \ - X((')' == CH(l)), on_separator(l, TOKEN_RP)) \ - X(isspace(CH(l)), on_separator(l, TOKEN_NONE)) \ +#define TOKEN_SEPARATOR_TABLE(X, l) \ + X(('(' == CH(l)), on_separator(l, TOKEN_LP)) \ + X((')' == CH(l)), on_separator(l, TOKEN_RP)) \ + X(('\''== CH(l)), on_separator(l, TOKEN_QUOTE)) \ + X((',' == CH(l)), on_separator(l, TOKEN_UNQUOTE)) \ + X(isspace(CH(l)), on_separator(l, TOKEN_NONE)) \ X(TABLE_ELSE, acc_add_char(l, CH(l))) #define SET_TYPE(lexer, ttype) (lexer)->token.type = (ttype) @@ -25,8 +27,6 @@ #define TOKEN_SPECIALS_TABLE(X) \ X(TOKEN_DOT, ".") \ - X(TOKEN_QUOTE, "'") \ - X(TOKEN_UNQUOTE, ",") \ X(TOKEN_LAMBDA, "lambda") \ X(TOKEN_DEFINE, "define") \ X(TOKEN_QUOTE_FORM, "quote") @@ -34,6 +34,8 @@ #define TOKEN_VALUE_STRING_TABLE(X, tvalue) \ X(TOKEN_LP, "(") \ X(TOKEN_RP, ")") \ + X(TOKEN_QUOTE, "'") \ + X(TOKEN_UNQUOTE, ",") \ X(TOKEN_ID, "%s", tvalue.id) \ X(TOKEN_STR, "%s", tvalue.str) \ X(TOKEN_INT, "%d", tvalue.num) \ |