file move
[neatcc/cc.git] / tok.h
blob16c335349fb20b672ff3bdd7b36a54b62a713a2a
1 /* neatcc tokenizer interface */
2 #define TOK2(a) ((a)[0] << 16 | (a)[1] << 8)
3 #define TOK3(a) ((a)[0] << 16 | (a)[1] << 8 | (a)[2])
5 enum tok {
6 TOK_EOF,
7 TOK_NAME = 256,
8 TOK_NUM,
9 TOK_VOID,
10 TOK_STATIC,
11 TOK_EXTERN,
12 TOK_RETURN,
13 TOK_UNSIGNED,
14 TOK_SIGNED,
15 TOK_SHORT,
16 TOK_LONG,
17 TOK_INT,
18 TOK_CHAR,
19 TOK_STRUCT,
20 TOK_UNION,
21 TOK_ENUM,
22 TOK_TYPEDEF,
23 TOK_IF,
24 TOK_ELSE,
25 TOK_FOR,
26 TOK_WHILE,
27 TOK_DO,
28 TOK_SWITCH,
29 TOK_CASE,
30 TOK_SIZEOF,
31 TOK_STR,
32 TOK_BREAK,
33 TOK_CONTINUE,
34 TOK_DEFAULT,
35 TOK_GOTO,
38 void tok_init(char *path);
39 int tok_see(void);
40 int tok_get(void);
41 char *tok_id(void);
42 int tok_num(long *n);
43 void tok_str(char **buf, int *len);
44 long tok_addr(void);
45 void tok_jump(long addr);
47 int cpp_init(char *path);
48 void cpp_addpath(char *s);
49 void cpp_define(char *name, char *def);
50 char *cpp_loc(long addr);
51 int cpp_read(char **buf, int *len);
53 void die(char *msg, ...);
54 void err(char *fmt, ...);