2 * This file is part of cparser.
3 * Copyright (C) 2007-2009 Matthias Braun <matze@braunis.de>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 #include "string_rep.h"
26 #include "symbol_table.h"
29 typedef enum token_kind_tag_t {
31 #define T(mode,x,str,val) x val,
36 typedef unsigned short token_kind_t;
38 typedef enum pp_token_kind_tag_t {
40 #define T(token) TP_##token,
41 #include "tokens_preprocessor.inc"
44 } pp_token_kind_tag_t;
45 typedef unsigned short pp_token_kind_t;
47 typedef struct position_t position_t;
49 const char *input_name;
52 unsigned is_system_header : 1;
55 extern symbol_t *token_symbols[];
57 /* position used for "builtin" declarations/types */
58 extern const position_t builtin_position;
60 typedef struct token_base_t token_base_t;
61 typedef struct literal_t literal_t;
62 typedef struct macro_parameter_t macro_parameter_t;
63 typedef union token_t token_t;
76 struct macro_parameter_t {
85 macro_parameter_t macro_parameter;
88 char const *get_string_encoding_prefix(string_encoding_t);
90 void init_tokens(void);
91 void exit_tokens(void);
92 void print_token_kind(FILE *out, token_kind_t token_kind);
93 void print_token(FILE *out, const token_t *token);
96 * returns true if pasting 2 preprocessing tokens next to each other
97 * without a space in between would generate (an)other preprocessing token(s)
99 bool tokens_would_paste(token_kind_t token1, token_kind_t token2);