aboutsummaryrefslogtreecommitdiff
path: root/include/value.h
blob: 1d053b7fe82a0f0264946e16daacbaf08699c303 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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 */