aboutsummaryrefslogtreecommitdiff
path: root/include/value.h
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-01-20 23:00:39 +0100
committerdec05eba <dec05eba@protonmail.com>2020-01-20 23:00:39 +0100
commit108018e3e7326dabbbef568ab08bc5cebf5d427b (patch)
tree7c9a522276aea7015638492592eba02615b78d43 /include/value.h
parent50c928d224bff0af322f23a7d2b842cd54aa2e68 (diff)
Add arithmetic, implement hash map
Diffstat (limited to 'include/value.h')
-rw-r--r--include/value.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/include/value.h b/include/value.h
new file mode 100644
index 0000000..1d053b7
--- /dev/null
+++ b/include/value.h
@@ -0,0 +1,49 @@
+#ifndef TSL_VALUE_H
+#define TSL_VALUE_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+typedef enum {
+ TSL_TYPE_NULL,
+ TSL_TYPE_NUMBER,
+ TSL_TYPE_STRING,
+ TSL_TYPE_BOOL,
+ TSL_TYPE_LIST,
+ TSL_TYPE_MAP,
+ TSL_TYPE_USERDATA
+} TslType;
+
+typedef enum {
+ TSL_FALSE,
+ TSL_TRUE
+} TslBool;
+
+typedef struct {
+ char *data;
+ size_t size;
+} TslString;
+
+/* TODO: Implement this */
+typedef struct {
+ void *data;
+} TslList;
+
+/* TODO: Implement this */
+typedef struct {
+ void *data;
+} TslMap;
+
+typedef struct {
+ union {
+ double number;
+ TslString *string;
+ TslBool boolean;
+ TslList *list;
+ TslMap *map;
+ void *userdata;
+ } data;
+ uint8_t type;
+} TslValue;
+
+#endif /* TSL_VALUE_H */