summaryrefslogtreecommitdiffhomepage
path: root/lexer.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-08-25 20:17:03 +0200
committerJo-Philipp Wich <jo@mein.io>2020-08-25 20:38:15 +0200
commitd63d8b6f0c0a43a14de9493f1683a209a0166889 (patch)
treea025491b84e629194b0b6b1b854606578f4d0079 /lexer.c
parent93902cd86f8244b2036a0e5bd910099da13b6885 (diff)
treewide: introduce this keyword
Support a new keyword `this` which allows functions to access the context they're called upon. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lexer.c')
-rw-r--r--lexer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lexer.c b/lexer.c
index 67d390a..ed27c68 100644
--- a/lexer.c
+++ b/lexer.c
@@ -131,6 +131,7 @@ static const struct token reserved_words[] = {
{ T_BOOL, "false", 5, parse_bool },
{ T_BOOL, "true", 4, parse_bool },
{ T_ELSE, "else", 4 },
+ { T_THIS, "this", 4 },
{ T_NUMBER, "NaN", 3, parse_number },
{ T_FOR, "for", 3 },
{ T_IN, "in", 2 },
@@ -204,6 +205,7 @@ const char *tokennames[__T_MAX] = {
[T_RETURN] = "'return'",
[T_BREAK] = "'break'",
[T_CONTINUE] = "'continue'",
+ [T_THIS] = "'this'",
//[T_LSTM] = "'{%'",
//[T_RSTM] = "'%}'"
};