summaryrefslogtreecommitdiff
path: root/include/cescal/token.h
blob: e215371f36109d6827ffcebb8032d41bdd3e53f1 (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
/*
 * Copyright (c) 2026, Chloe M.
 * Provided under the BSD-3 clause
 */

#ifndef CESCAL_TOKEN_H
#define CESCAL_TOKEN_H 1

/*
 * Represents valid source file token types
 */
typedef enum {
    TT_NONE,        /* [none] */
    TT_IDENT,       /* [identifier] */
    TT_COMMENT,     /* [comment : ignored] */
    TT_INTLIT,      /* [0-9]+ */
    TT_LPAREN,      /* '(' */
    TT_RPAREN,      /* '( */
    TT_COMMA,       /* ',' */
    TT_ARROW,       /* '->' */
    TT_RETURN,      /* 'return' */
    TT_PUB,         /* 'pub' */
    TT_PROC,        /* 'proc' */
    TT_BEGIN,       /* 'begin' */
    TT_END,         /* 'end' */
} tt_t;

/*
 * Represents a source file token
 *
 * @type: Token type
 */
struct token {
    tt_t type;
    union {
        char c;
        char *s;
    };
};

#endif  /* !CESCAL_TOKEN_H */