CppParser
Loading...
Searching...
No Matches
cppconst.h
Go to the documentation of this file.
1/*
2 The MIT License (MIT)
3
4 Copyright (c) 2018 Satya Das
5
6 Permission is hereby granted, free of charge, to any person obtaining a copy of
7 this software and associated documentation files (the "Software"), to deal in
8 the Software without restriction, including without limitation the rights to
9 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10 the Software, and to permit persons to whom the Software is furnished to do so,
11 subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24#pragma once
25
26#include <cstdint>
27
28enum class TriStateBool : std::int8_t
29{
30 Unknown = -1,
31 False = 0,
32 True = 1
33};
34
35enum class CppObjType : std::uint8_t
36{
37 kUnknown = 0x0000,
39
40 kCPreProcessorTypeStarts, // Any preprocessor type must come after this
41 kHashIf, // #if, #ifdef, #ifndef, #else, #elif.
42 kHashInclude, // #include
43 kHashImport, // #import
44 kHashDefine, // #define
45 kHashUndef, // #undef
46 kHashPragma, // #pragma
49 kUnRecogPrePro, // Any unrecognized pre-processor.
51
53 kVarType, // Just the type of variable.
54 kVar, // A variable declaration.
55 kVarList, // List of variables declared as comma separated identifiers.
61 kEnum,
62 kCompound, // file, namespace, class, struct, union, block.
63 kFwdClsDecl, // Forward declaration of compound type.
65 kLambda,
69 kFunctionPtr, // Function proc declaration using typedef. e.g. typedef void (*fp) (void);
70 kExpression, // A C++ expression
74 kBlob, // Some unparsed/unrecognized part of C++ source code.
75 kLabel,
77
87};
88
89enum /*class*/ CppCompoundType : std::uint8_t
90{
93 kCppFile = 0x01,
94 kNamespace = 0x02,
96 kStruct = 0x08 | kClass,
97 kUnion = 0x10 | kClass,
98 kBlock = 0x20,
100};
101
102enum class CppAccessType : std::uint8_t
103{
104 kUnknown,
105 kPublic,
106 kPrivate,
108};
109
110enum /*class*/ CppOperator : std::uint8_t
111{
113
117 kLogNot, // ! (Logical not)
119 kRefer, // & as in &x;
122
126
128 kPlus, // +
129 kMinus, // -
130 kMul, // *
131 kDiv, // /
136 kBitOr, // |
138 kEqual, // =
139 kLess, // <
162
164 kDot, // .
165 kArrow, // ->
167
171 kArrayElem, // x[5]
179
181};
182
186enum /*class*/ CppIdentifierAttrib : std::uint32_t
187{
188 kFuncParam = 0x000001, // If the identifier is actually function parameter.
189 kConst = 0x000002,
190 kStatic = 0x000004,
191 kExtern = 0x000008,
192 kInline = 0x000010,
193 kVirtual = 0x000020,
194 kPureVirtual = 0x000040 | kVirtual,
195 kOverride = 0x000080 | kVirtual,
196 kExplicit = 0x000100,
197 kFriend = 0x000200,
198 kTypedef = 0x000400, // Function pointer is used in typedef.
199 kConstExpr = 0x001000,
200 kVolatile = 0x002000,
201 kFinal = 0x004000 | kVirtual,
202 kDefault = 0x008000,
203 kDelete = 0x010000,
204 kNoExcept = 0x020000,
205 kExternC = 0x040000,
206 kTrailingRet = 0x080000,
207 kMutable = 0x100000,
208 kNoExceptFalse = 0x200000,
209};
210
214enum class CppRefType : std::uint8_t
215{
216 kNoRef, // No reference.
217 kByRef, // Simple reference, e.g. int& x.
218 kRValRef // R-value reference, e.g. in move constructor.
219};
220
221enum class AssignType
222{
223 kNone,
227};
CppAccessType
Definition: cppconst.h:103
CppRefType
Type of references a variable can have in a C++ program.
Definition: cppconst.h:215
AssignType
Definition: cppconst.h:222
TriStateBool
Definition: cppconst.h:29
CppIdentifierAttrib
State of variable or function.
Definition: cppconst.h:187
@ kTypedef
Definition: cppconst.h:198
@ kStatic
Definition: cppconst.h:190
@ kDelete
Definition: cppconst.h:203
@ kTrailingRet
Definition: cppconst.h:206
@ kConst
Definition: cppconst.h:189
@ kNoExceptFalse
Definition: cppconst.h:208
@ kExtern
Definition: cppconst.h:191
@ kFinal
Definition: cppconst.h:201
@ kVirtual
Definition: cppconst.h:193
@ kDefault
Definition: cppconst.h:202
@ kExplicit
Definition: cppconst.h:196
@ kVolatile
Definition: cppconst.h:200
@ kInline
Definition: cppconst.h:192
@ kNoExcept
Definition: cppconst.h:204
@ kFriend
Definition: cppconst.h:197
@ kFuncParam
Definition: cppconst.h:188
@ kConstExpr
Definition: cppconst.h:199
@ kMutable
Definition: cppconst.h:207
@ kPureVirtual
Definition: cppconst.h:194
@ kExternC
Definition: cppconst.h:205
@ kOverride
Definition: cppconst.h:195
CppObjType
Definition: cppconst.h:36
@ kCppControlStatementStarts
@ kCppStatementObjectTypeEnds
@ kCPreProcessorTypeEnds
@ kUsingNamespaceDecl
@ kCPreProcessorTypeStarts
@ kCppControlStatementEnds
@ kCppStatementObjectTypeStarts
CppCompoundType
Definition: cppconst.h:90
@ kUnknownCompound
Definition: cppconst.h:91
@ kBlock
Definition: cppconst.h:98
@ kNamespace
Definition: cppconst.h:94
@ kUnion
Definition: cppconst.h:97
@ kClass
Definition: cppconst.h:95
@ kCppFile
Definition: cppconst.h:93
@ kNoCompound
Definition: cppconst.h:92
@ kStruct
Definition: cppconst.h:96
@ kExternCBlock
Definition: cppconst.h:99
CppOperator
Definition: cppconst.h:111
@ kGreater
Definition: cppconst.h:140
@ kArrowStar
Definition: cppconst.h:166
@ kBinaryOperatorEnd
Definition: cppconst.h:161
@ kRefer
Definition: cppconst.h:119
@ kDivEqual
Definition: cppconst.h:144
@ kMulEqual
Definition: cppconst.h:143
@ kBitOr
Definition: cppconst.h:136
@ kPostIncrement
Definition: cppconst.h:124
@ kDerefer
Definition: cppconst.h:118
@ kSpecialOperations
Definition: cppconst.h:168
@ kPlusEqual
Definition: cppconst.h:141
@ kLess
Definition: cppconst.h:139
@ kBitAnd
Definition: cppconst.h:135
@ kRightShift
Definition: cppconst.h:151
@ kFunctionCall
Definition: cppconst.h:169
@ kDerefOperatorStart
Definition: cppconst.h:163
@ kUnaryMinus
Definition: cppconst.h:115
@ kAnd
Definition: cppconst.h:133
@ kUnariSufixOperatorStart
Definition: cppconst.h:123
@ kBitToggle
Definition: cppconst.h:116
@ kNotEqual
Definition: cppconst.h:156
@ kPercent
Definition: cppconst.h:132
@ kEqual
Definition: cppconst.h:138
@ kLogNot
Definition: cppconst.h:117
@ kArrayElem
Definition: cppconst.h:171
@ kNone
Definition: cppconst.h:112
@ kPreIncrement
Definition: cppconst.h:120
@ kXorEqual
Definition: cppconst.h:146
@ kBinaryOperatorStart
Definition: cppconst.h:127
@ kUnariPrefixOperatorStart
Definition: cppconst.h:114
@ kAndEqual
Definition: cppconst.h:147
@ kArrow
Definition: cppconst.h:165
@ kConstCast
Definition: cppconst.h:174
@ kOr
Definition: cppconst.h:134
@ kMinus
Definition: cppconst.h:129
@ kXor
Definition: cppconst.h:137
@ kRShiftEqual
Definition: cppconst.h:154
@ kCmpEqual
Definition: cppconst.h:155
@ kPlacementNew
Definition: cppconst.h:178
@ kTertiaryOperator
Definition: cppconst.h:180
@ k3WayCmp
Definition: cppconst.h:159
@ kLessEqual
Definition: cppconst.h:157
@ kFunctionStyleCast
Definition: cppconst.h:173
@ kExtraction
Definition: cppconst.h:152
@ kPostDecrement
Definition: cppconst.h:125
@ kStaticCast
Definition: cppconst.h:175
@ kMul
Definition: cppconst.h:130
@ kGreaterEqual
Definition: cppconst.h:158
@ kPerEqual
Definition: cppconst.h:145
@ kPlus
Definition: cppconst.h:128
@ kReinterpretCast
Definition: cppconst.h:177
@ kDot
Definition: cppconst.h:164
@ kDynamicCast
Definition: cppconst.h:176
@ kComma
Definition: cppconst.h:160
@ kOrEqual
Definition: cppconst.h:148
@ kMinusEqual
Definition: cppconst.h:142
@ kCStyleCast
Definition: cppconst.h:172
@ kDiv
Definition: cppconst.h:131
@ kPreDecrement
Definition: cppconst.h:121
@ kInsertion
Definition: cppconst.h:150
@ kLShiftEqual
Definition: cppconst.h:153
@ kLeftShift
Definition: cppconst.h:149
@ kUniformInitCall
Definition: cppconst.h:170