1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ADC_CPP_ALL_TOKS_HXX
25 #define ADC_CPP_ALL_TOKS_HXX
26 
27 // USED SERVICES
28 	// BASE CLASSES
29 #include "cpp_tok.hxx"
30 	// COMPONENTS
31 	// PARAMETERS
32 
33 namespace cpp {
34 
35 class Tok_Identifier : public cpp::Token
36 {
37   public:
Tok_Identifier(const char * i_sText)38 						Tok_Identifier(
39 							const char *		i_sText ) : sText(i_sText) {}
40 	virtual void		Trigger(
41 							TokenInterpreter &	io_rInterpreter ) const;
42 	virtual INT16		TypeId() const;
43 	virtual const char *
44 						Text() const;
45   private:
46 	String  			sText;
47 };
48 const INT16 Tid_Identifier = 1;
49 
50 /** == != <= >=  && || !
51 
52 	new delete sizeof typeid
53 	+ - / %  ^ | << >>
54 	. ->  ?
55 	+= -= *= /= %= &= |= ^= <<= >>=
56 */
57 class Tok_Operator : public cpp::Token
58 {
59   public:
Tok_Operator(const char * i_sText)60 						Tok_Operator(
61 							const char *		i_sText ) : sText(i_sText) {}
62 	virtual void		Trigger(
63 							TokenInterpreter &	io_rInterpreter ) const;
64 	virtual INT16		TypeId() const;
65 	virtual const char *
66 						Text() const;
67   private:
68 	String  			sText;
69 };
70 const INT16 Tid_Operator = 2;
71 
72 
73 
74 #define DECL_TOKEN_CLASS(name,tid) \
75 class Tok_##name : public cpp::Token \
76 { public: \
77 	virtual void		Trigger( \
78 							TokenInterpreter &	io_rInterpreter ) const; \
79 	virtual INT16		TypeId() const; \
80 	virtual const char * \
81 						Text() const; \
82 }; \
83 const INT16 Tid_##name = tid
84 
85 DECL_TOKEN_CLASS(operator,3);
86 DECL_TOKEN_CLASS(class,4);
87 DECL_TOKEN_CLASS(struct,5);
88 DECL_TOKEN_CLASS(union,6);
89 DECL_TOKEN_CLASS(enum,7);
90 DECL_TOKEN_CLASS(typedef,8);
91 DECL_TOKEN_CLASS(public,9);
92 DECL_TOKEN_CLASS(protected,10);
93 DECL_TOKEN_CLASS(private,11);
94 DECL_TOKEN_CLASS(template,12);
95 DECL_TOKEN_CLASS(virtual,13);
96 DECL_TOKEN_CLASS(friend,14);
97 DECL_TOKEN_CLASS(Tilde,15);
98 DECL_TOKEN_CLASS(const,16);
99 DECL_TOKEN_CLASS(volatile,17);
100 DECL_TOKEN_CLASS(extern,18);
101 DECL_TOKEN_CLASS(static,19);
102 DECL_TOKEN_CLASS(mutable,20);
103 DECL_TOKEN_CLASS(register,21);
104 DECL_TOKEN_CLASS(inline,22);
105 DECL_TOKEN_CLASS(explicit,23);
106 DECL_TOKEN_CLASS(namespace,24);
107 DECL_TOKEN_CLASS(using,25);
108 DECL_TOKEN_CLASS(throw,26);
109 DECL_TOKEN_CLASS(SwBracket_Left,27);
110 DECL_TOKEN_CLASS(SwBracket_Right,28);
111 DECL_TOKEN_CLASS(ArrayBracket_Left,29);
112 DECL_TOKEN_CLASS(ArrayBracket_Right,30);
113 DECL_TOKEN_CLASS(Bracket_Left,31);
114 DECL_TOKEN_CLASS(Bracket_Right,32);
115 DECL_TOKEN_CLASS(DoubleColon,33);
116 DECL_TOKEN_CLASS(Semicolon,34);
117 DECL_TOKEN_CLASS(Comma,35);
118 DECL_TOKEN_CLASS(Colon,36);
119 DECL_TOKEN_CLASS(Assign,37);
120 DECL_TOKEN_CLASS(Less,38);
121 DECL_TOKEN_CLASS(Greater,39);
122 DECL_TOKEN_CLASS(Asterix,40);
123 DECL_TOKEN_CLASS(AmpersAnd,41);
124 DECL_TOKEN_CLASS(Ellipse,42);
125 DECL_TOKEN_CLASS(typename,43);
126 
127 #undef DECL_TOKEN_CLASS
128 
129 #define DECL_TOKEN_CLASS_WITHTEXT(name,tid) \
130 class Tok_##name : public cpp::Token \
131 { public: \
132 						Tok_##name( \
133 							const char *		i_sText ) : sText(i_sText) {} \
134 	virtual void		Trigger( \
135 							TokenInterpreter &	io_rInterpreter ) const; \
136 	virtual INT16		TypeId() const; \
137 	virtual const char * \
138 						Text() const; \
139   private: \
140 	String  			sText; \
141 }; \
142 const INT16 Tid_##name = tid
143 
144 
145 
146 DECL_TOKEN_CLASS_WITHTEXT(DefineName,44);
147 DECL_TOKEN_CLASS_WITHTEXT(MacroName,45);
148 DECL_TOKEN_CLASS_WITHTEXT(MacroParameter,46);
149 DECL_TOKEN_CLASS_WITHTEXT(PreProDefinition,47);
150 
151 /** char short int long float double wchar_t size_t
152 */
153 DECL_TOKEN_CLASS_WITHTEXT(BuiltInType, 48);
154 
155 /** signed unsigned
156 */
157 DECL_TOKEN_CLASS_WITHTEXT(TypeSpecializer, 49);
158 DECL_TOKEN_CLASS_WITHTEXT(Constant, 50);
159 
160 
161 
162 /** This token does nothing in C++ code. It is added by the
163     internal macro-replacer to mark the position, where a
164     define or macro becomes valid again, which was until then
165     invalid, because the text was a replacement of this macro.
166     ( Avoiding endless recursive macro replacement. )
167 */
168 class Tok_UnblockMacro : public ::TextToken
169 {
170   public:
Tok_UnblockMacro(const char * i_sMacroName)171 						Tok_UnblockMacro(
172 							const char *		i_sMacroName ) : sMacroName(i_sMacroName) {}
173 	virtual const char*	Text() const;
174 
175 	virtual void		DealOut(
176 							::TokenDealer &		o_rDealer );
177   private:
178 	String              sMacroName;
179 };
180 
181 
182 
183 #if 0 // just for viewing:
184 class Tok_TypeKey : public cpp::Token                  // file-><type-PE>
185 class Tok_Template : public cpp::Token                 // file
186 class Tok_Namespace : public cpp::Token                // file
187 class Tok_Bracket : public cpp::Token                  // ueberall
188 class Tok_Separator : public cpp::Token                // ueberall
189 
190 class Tok_Identifier : public cpp::Token			   // ueberall
191 class Tok_NameSeparator : public cpp::Token            // Type, Name
192 class Tok_BuiltInType : public cpp::Token			   // ueberall
193 class Tok_ConVol : public cpp::Token                   // class-><FuVa>
194 class Tok_StorageClass : public cpp::Token             // file-><type>,<FuVa>
195 class Tok_OperatorFunctionName : public cpp::Token     // class
196 
197 class Tok_Protection : public cpp::Token               // class
198 class Tok_Virtual : public cpp::Token                  // class
199 class Tok_Friend : public cpp::Token                   // class
200 class Tok_Tilde : public cpp::Token                    // class, expression
201 
202 class Tok_Ellipse : public cpp::Token                  // function-ParaList
203 class Tok_Assignment : public cpp::Token               // VariableDeclaraton, Function, Parameter
204 class Tok_Throw : public cpp::Token                    // function
205 class Tok_LessMore : public cpp::Token
206 class Tok_Operator : public cpp::Token                 // expression
207 
208 class Tok_Ignore : public cpp::Token
209 class Tok_ContextChanger : public cpp::Token
210 #endif // 0
211 
212 
213 }   // namespace cpp
214 
215 #endif
216