summaryrefslogtreecommitdiffhomepage
path: root/lexer.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-09-11 22:53:53 +0200
committerJo-Philipp Wich <jo@mein.io>2020-09-11 22:55:38 +0200
commit280a7c191bd5bda0d1d885c1c24ec4674d8a880e (patch)
treeb18b6fb7337302edcda77f769c0fe508bea5ba5f /lexer.c
parent974eafbb07578742ac6aa965c73b62792865ebd7 (diff)
syntax: introduce !== and === operators
Also treat "in" as relational operator. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lexer.c')
-rw-r--r--lexer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lexer.c b/lexer.c
index 0ce9643..390a12e 100644
--- a/lexer.c
+++ b/lexer.c
@@ -61,6 +61,8 @@ static const struct token tokens[] = {
{ T_LSTM, "{%+", 3 },
{ T_LSTM, "{%-", 3 },
{ T_RSTM, "-%}", 3 },
+ { T_EQS, "===", 3 },
+ { T_NES, "!==", 3 },
{ T_AND, "&&", 2 },
{ T_ASADD, "+=", 2 },
{ T_ASBAND, "&=", 2 },
@@ -164,6 +166,8 @@ const char *tokennames[__T_MAX] = {
[T_INC] = "'x++'",
[T_EQ] = "'x==y'",
[T_NE] = "'x!=y'",
+ [T_EQS] = "'x===y'",
+ [T_NES] = "'x!==y'",
[T_LE] = "'x<=y'",
[T_GE] = "'x>=y'",
[T_LSHIFT] = "'x<<y'",