-
Notifications
You must be signed in to change notification settings - Fork 4
/
keyword.go
115 lines (112 loc) · 2.92 KB
/
keyword.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package helper
var cppKeywords map[string]bool
func KeywordEscape(str string) string {
if _, ok := cppKeywords[str]; ok {
return str + "_"
}
return str
}
// Ref:
//
// https://en.cppreference.com/w/cpp/keyword
func init() {
cppKeywords = map[string]bool{
"alignas": true,
"alignof": true,
"and": true,
"and_eq": true,
"asm": true,
"atomic_cancel": true,
"atomic_commit": true,
"atomic_noexcept": true,
"auto": true,
"bitand": true,
"bitor": true,
"bool": true,
"break": true,
"case": true,
"catch": true,
"char": true,
"char8_t": true,
"char16_t": true,
"char32_t": true,
"class": true,
"compl": true,
"concept": true,
"const": true,
"consteval": true,
"constexpr": true,
"constinit": true,
"const_cast": true,
"continue": true,
"co_await": true,
"co_return": true,
"co_yield": true,
"decltype": true,
"default": true,
"delete": true,
"do": true,
"double": true,
"dynamic_cast": true,
"else": true,
"enum": true,
"explicit": true,
"export": true,
"extern": true,
"false": true,
"float": true,
"for": true,
"friend": true,
"goto": true,
"if": true,
"inline": true,
"int": true,
"long": true,
"mutable": true,
"namespace": true,
"new": true,
"noexcept": true,
"not": true,
"not_eq": true,
"nullptr": true,
"operator": true,
"or": true,
"or_eq": true,
"private": true,
"protected": true,
"public": true,
"register": true,
"reflexpr": true,
"reinterpret_cast": true,
"requires": true,
"return": true,
"short": true,
"signed": true,
"sizeof": true,
"static": true,
"static_assert": true,
"static_cast": true,
"struct": true,
"switch": true,
"synchronized": true,
"template": true,
"this": true,
"thread_local": true,
"throw": true,
"true": true,
"try": true,
"typedef": true,
"typeid": true,
"typename": true,
"union": true,
"unsigned": true,
"using": true,
"virtual": true,
"void": true,
"volatile": true,
"wchar_t": true,
"while": true,
"xor": true,
"xor_eq": true,
}
}