no enviornment passing around anymore in lexer, more work on lexer, import expression...
[cparser] / token_t.h
1 #ifndef TOKEN_T_H
2 #define TOKEN_T_H
3
4 #include <stdio.h>
5 #include "symbol.h"
6 #include "symbol_table.h"
7
8 typedef enum {
9 #define T(x,str,val) T_##x val,
10 #define TS(x,str,val) T_##x val,
11 #include "tokens.inc"
12 #undef TS
13 #undef T
14
15         T_EOF   = -1,
16         T_ERROR = -2
17 } token_type_t;
18
19 typedef enum {
20 #define T(x,str,val) TP_##x val,
21 #define TS(x,str,val) TP_##x val,
22 #include "tokens_preprocessor.inc"
23 #undef TS
24 #undef T
25 } preprocessor_token_type_t;
26
27 typedef struct {
28         int type;
29         union {
30                 symbol_t   *symbol;
31                 int         intvalue;
32                 const char *string;
33         } v;
34 } token_t;
35
36 void init_tokens(void);
37 void exit_tokens(void);
38 void print_token_type(FILE *out, token_type_t token_type);
39 void print_token(FILE *out, const token_t *token);
40
41 #endif