summaryrefslogtreecommitdiff
path: root/token.h
blob: c00c87021d677a292b06d447f1b6007a7a00a024 (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
#ifndef HENCE_TOKEN_H
#define HENCE_TOKEN_H

#define MAX_IDENT_LENGTH 128

enum TOKEN_TYPE {
	/* Keywords */
	TOK_MODULE,
	TOK_INPUT,
	TOK_EXPR,
	TOK_COLON,
	TOK_EOL,
	TOK_OR,
	TOK_AND,
	TOK_XOR,
	TOK_NOT,
	TOK_NAND,
	TOK_NOR,

	/* Etc */
	TOK_IDENT
};

struct location {
	size_t line;
	size_t column;
	size_t leading_whitespace_len;
};

struct token {
	enum TOKEN_TYPE type;
	struct location loc;
	char value[MAX_IDENT_LENGTH];
	size_t span;
	struct token *next;
};

#endif