2 * This file is part of cparser.
3 * Copyright (C) 2012 Matthias Braun <matze@braunis.de>
9 #include "string_rep.h"
11 #include "symbol_table.h"
14 typedef enum token_kind_tag_t {
16 #define T(mode,x,str,val) x val,
21 typedef unsigned short token_kind_t;
23 typedef enum pp_token_kind_tag_t {
25 #define T(token) TP_##token,
26 #include "tokens_preprocessor.inc"
29 } pp_token_kind_tag_t;
30 typedef unsigned short pp_token_kind_t;
32 typedef struct position_t position_t;
34 const char *input_name;
37 unsigned is_system_header : 1;
40 extern symbol_t *token_symbols[];
42 /* position used for "builtin" declarations/types */
43 extern const position_t builtin_position;
45 typedef struct token_base_t token_base_t;
46 typedef struct literal_t literal_t;
47 typedef struct macro_parameter_t macro_parameter_t;
48 typedef union token_t token_t;
61 struct macro_parameter_t {
70 macro_parameter_t macro_parameter;
73 char const *get_string_encoding_prefix(string_encoding_t);
75 void init_tokens(void);
76 void exit_tokens(void);
77 void print_token_kind(FILE *out, token_kind_t token_kind);
78 void print_token(FILE *out, const token_t *token);
81 * returns true if pasting 2 preprocessing tokens next to each other
82 * without a space in between would generate (an)other preprocessing token(s)
84 bool tokens_would_paste(token_kind_t token1, token_kind_t token2);