aboutsummaryrefslogtreecommitdiff
path: root/src/c8asm/lexer.h
blob: 46692a8fa4a01830d5b76ed993bf935a15bfa659 (plain) (blame)
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
#ifndef AHOY_C8ASM_LEXER_H
#define AHOY_C8ASM_LEXER_H

#include <mbstring.h>

typedef enum [[clang::flag_enum]] {
	T_COLON = 1 << 0,
	T_EOL = 1 << 1,
	T_IDENT = 1 << 2,
	T_NUMBER = 1 << 3,
	T_STRING = 1 << 4,
} tokkind;

struct token {
	tokkind kind;
	struct u8view sv;
	int base; /* For number literals */
};

struct tokens {
	struct token *buf;
	size_t len, cap;
};

const char *tokrepr(tokkind);
struct tokens lexfile();

#endif /* !AHOY_C8ASM_LEXER_H */