summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--eval.c1
-rw-r--r--lexer.c2
-rw-r--r--lexer.h2
-rw-r--r--parser.y1
4 files changed, 5 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 33759cb..68fda6e 100644
--- a/eval.c
+++ b/eval.c
@@ -1139,6 +1139,7 @@ ut_execute_op(struct ut_state *state, struct ut_opcode *op)
case T_DOUBLE:
case T_BOOL:
case T_STRING:
+ case T_NULL:
return json_object_get(op->val);
case T_THIS:
diff --git a/lexer.c b/lexer.c
index ed27c68..26ee3e1 100644
--- a/lexer.c
+++ b/lexer.c
@@ -132,6 +132,7 @@ static const struct token reserved_words[] = {
{ T_BOOL, "true", 4, parse_bool },
{ T_ELSE, "else", 4 },
{ T_THIS, "this", 4 },
+ { T_NULL, "null", 4 },
{ T_NUMBER, "NaN", 3, parse_number },
{ T_FOR, "for", 3 },
{ T_IN, "in", 2 },
@@ -205,6 +206,7 @@ const char *tokennames[__T_MAX] = {
[T_RETURN] = "'return'",
[T_BREAK] = "'break'",
[T_CONTINUE] = "'continue'",
+ [T_NULL] = "'null'",
[T_THIS] = "'this'",
//[T_LSTM] = "'{%'",
//[T_RSTM] = "'%}'"
diff --git a/lexer.h b/lexer.h
index 27039f9..7a5726b 100644
--- a/lexer.h
+++ b/lexer.h
@@ -19,7 +19,7 @@
#include "ast.h"
-#define __T_MAX 70
+#define __T_MAX 71
#define T_EXCEPTION (__T_MAX + 0)
#define T_CFUNC (__T_MAX + 1)
#define T_RESSOURCE (__T_MAX + 2)
diff --git a/parser.y b/parser.y
index 204b091..1f7487b 100644
--- a/parser.y
+++ b/parser.y
@@ -260,6 +260,7 @@ primary_exp(A) ::= T_NUMBER(B). { A = B; }
primary_exp(A) ::= T_DOUBLE(B). { A = B; }
primary_exp(A) ::= T_STRING(B). { A = B; }
primary_exp(A) ::= T_LABEL(B). { A = B; }
+primary_exp(A) ::= T_NULL(B). { A = B; }
primary_exp(A) ::= T_THIS(B). { A = B; }
primary_exp(A) ::= array(B). { A = B; }
primary_exp(A) ::= object(B). { A = B; }