recognizre preprocessor hashs
[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 struct {
20         int type;
21         union {
22                 symbol_t   *symbol;
23                 int         intvalue;
24                 const char *string;
25         } v;
26 } token_t;
27
28 void init_tokens(void);
29 void exit_tokens(void);
30 void print_token_type(FILE *out, token_type_t token_type);
31 void print_token(FILE *out, const token_t *token);
32
33 #endif