projects
/
cparser
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
type: Add missing space for printing complex types.
[cparser]
/
token.c
diff --git
a/token.c
b/token.c
index
7d2104c
..
3d69874
100644
(file)
--- a/
token.c
+++ b/
token.c
@@
-24,6
+24,7
@@
#include <assert.h>
#include <stdio.h>
#include <assert.h>
#include <stdio.h>
+#include <stdbool.h>
#include "symbol.h"
#include "lang_features.h"
#include "symbol.h"
#include "lang_features.h"
@@
-33,7
+34,7
@@
symbol_t *token_symbols[T_LAST_TOKEN];
symbol_t *token_symbols[T_LAST_TOKEN];
-const
source_position_t builtin_source
_position = { "<built-in>", 0, 0, true };
+const
position_t builtin
_position = { "<built-in>", 0, 0, true };
static token_kind_t last_id;
static token_kind_t last_id;
@@
-67,6
+68,11
@@
static void register_pp_token(pp_token_kind_t const id, char const *const string
void init_tokens(void)
{
void init_tokens(void)
{
+ static bool tokens_initialized = false;
+ if (tokens_initialized)
+ return;
+ tokens_initialized = true;
+
memset(token_symbols, 0, T_LAST_TOKEN * sizeof(token_symbols[0]));
#define T(mode,x,str,val) register_token(mode, x, str);
memset(token_symbols, 0, T_LAST_TOKEN * sizeof(token_symbols[0]));
#define T(mode,x,str,val) register_token(mode, x, str);
@@
-95,8
+101,11
@@
void print_token_kind(FILE *f, token_kind_t token_kind)
char const *get_string_encoding_prefix(string_encoding_t const enc)
{
switch (enc) {
char const *get_string_encoding_prefix(string_encoding_t const enc)
{
switch (enc) {
- case STRING_ENCODING_CHAR: return "";
- case STRING_ENCODING_WIDE: return "L";
+ case STRING_ENCODING_CHAR: return "";
+ case STRING_ENCODING_CHAR16: return "u";
+ case STRING_ENCODING_CHAR32: return "U";
+ case STRING_ENCODING_UTF8: return "u8";
+ case STRING_ENCODING_WIDE: return "L";
}
panic("invalid string encoding");
}
}
panic("invalid string encoding");
}