aboutsummaryrefslogtreecommitdiff
path: root/src/lexer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lexer.c')
-rw-r--r--src/lexer.c14
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) \