1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef ADC_CPP_ALL_TOKS_HXX
29 #define ADC_CPP_ALL_TOKS_HXX
30 
31 // USED SERVICES
32 	// BASE CLASSES
33 #include "cpp_tok.hxx"
34 	// COMPONENTS
35 	// PARAMETERS
36 
37 namespace cpp {
38 
39 class Tok_Identifier : public cpp::Token
40 {
41   public:
42 						Tok_Identifier(
43 							const char *		i_sText ) : sText(i_sText) {}
44 	virtual void		Trigger(
45 							TokenInterpreter &	io_rInterpreter ) const;
46 	virtual INT16		TypeId() const;
47 	virtual const char *
48 						Text() const;
49   private:
50 	String  			sText;
51 };
52 const INT16 Tid_Identifier = 1;
53 
54 /** == != <= >=  && || !
55 
56 	new delete sizeof typeid
57 	+ - / %  ^ | << >>
58 	. ->  ?
59 	+= -= *= /= %= &= |= ^= <<= >>=
60 */
61 class Tok_Operator : public cpp::Token
62 {
63   public:
64 						Tok_Operator(
65 							const char *		i_sText ) : sText(i_sText) {}
66 	virtual void		Trigger(
67 							TokenInterpreter &	io_rInterpreter ) const;
68 	virtual INT16		TypeId() const;
69 	virtual const char *
70 						Text() const;
71   private:
72 	String  			sText;
73 };
74 const INT16 Tid_Operator = 2;
75 
76 
77 
78 #define DECL_TOKEN_CLASS(name,tid) \
79 class Tok_##name : public cpp::Token \
80 { public: \
81 	virtual void		Trigger( \
82 							TokenInterpreter &	io_rInterpreter ) const; \
83 	virtual INT16		TypeId() const; \
84 	virtual const char * \
85 						Text() const; \
86 }; \
87 const INT16 Tid_##name = tid
88 
89 DECL_TOKEN_CLASS(operator,3);
90 DECL_TOKEN_CLASS(class,4);
91 DECL_TOKEN_CLASS(struct,5);
92 DECL_TOKEN_CLASS(union,6);
93 DECL_TOKEN_CLASS(enum,7);
94 DECL_TOKEN_CLASS(typedef,8);
95 DECL_TOKEN_CLASS(public,9);
96 DECL_TOKEN_CLASS(protected,10);
97 DECL_TOKEN_CLASS(private,11);
98 DECL_TOKEN_CLASS(template,12);
99 DECL_TOKEN_CLASS(virtual,13);
100 DECL_TOKEN_CLASS(friend,14);
101 DECL_TOKEN_CLASS(Tilde,15);
102 DECL_TOKEN_CLASS(const,16);
103 DECL_TOKEN_CLASS(volatile,17);
104 DECL_TOKEN_CLASS(extern,18);
105 DECL_TOKEN_CLASS(static,19);
106 DECL_TOKEN_CLASS(mutable,20);
107 DECL_TOKEN_CLASS(register,21);
108 DECL_TOKEN_CLASS(inline,22);
109 DECL_TOKEN_CLASS(explicit,23);
110 DECL_TOKEN_CLASS(namespace,24);
111 DECL_TOKEN_CLASS(using,25);
112 DECL_TOKEN_CLASS(throw,26);
113 DECL_TOKEN_CLASS(SwBracket_Left,27);
114 DECL_TOKEN_CLASS(SwBracket_Right,28);
115 DECL_TOKEN_CLASS(ArrayBracket_Left,29);
116 DECL_TOKEN_CLASS(ArrayBracket_Right,30);
117 DECL_TOKEN_CLASS(Bracket_Left,31);
118 DECL_TOKEN_CLASS(Bracket_Right,32);
119 DECL_TOKEN_CLASS(DoubleColon,33);
120 DECL_TOKEN_CLASS(Semicolon,34);
121 DECL_TOKEN_CLASS(Comma,35);
122 DECL_TOKEN_CLASS(Colon,36);
123 DECL_TOKEN_CLASS(Assign,37);
124 DECL_TOKEN_CLASS(Less,38);
125 DECL_TOKEN_CLASS(Greater,39);
126 DECL_TOKEN_CLASS(Asterix,40);
127 DECL_TOKEN_CLASS(AmpersAnd,41);
128 DECL_TOKEN_CLASS(Ellipse,42);
129 DECL_TOKEN_CLASS(typename,43);
130 
131 #undef DECL_TOKEN_CLASS
132 
133 #define DECL_TOKEN_CLASS_WITHTEXT(name,tid) \
134 class Tok_##name : public cpp::Token \
135 { public: \
136 						Tok_##name( \
137 							const char *		i_sText ) : sText(i_sText) {} \
138 	virtual void		Trigger( \
139 							TokenInterpreter &	io_rInterpreter ) const; \
140 	virtual INT16		TypeId() const; \
141 	virtual const char * \
142 						Text() const; \
143   private: \
144 	String  			sText; \
145 }; \
146 const INT16 Tid_##name = tid
147 
148 
149 
150 DECL_TOKEN_CLASS_WITHTEXT(DefineName,44);
151 DECL_TOKEN_CLASS_WITHTEXT(MacroName,45);
152 DECL_TOKEN_CLASS_WITHTEXT(MacroParameter,46);
153 DECL_TOKEN_CLASS_WITHTEXT(PreProDefinition,47);
154 
155 /** char short int long float double wchar_t size_t
156 */
157 DECL_TOKEN_CLASS_WITHTEXT(BuiltInType, 48);
158 
159 /** signed unsigned
160 */
161 DECL_TOKEN_CLASS_WITHTEXT(TypeSpecializer, 49);
162 DECL_TOKEN_CLASS_WITHTEXT(Constant, 50);
163 
164 
165 
166 /** This token does nothing in C++ code. It is added by the
167     internal macro-replacer to mark the position, where a
168     define or macro becomes valid again, which was until then
169     invalid, because the text was a replacement of this macro.
170     ( Avoiding endless recursive macro replacement. )
171 */
172 class Tok_UnblockMacro : public ::TextToken
173 {
174   public:
175 						Tok_UnblockMacro(
176 							const char *		i_sMacroName ) : sMacroName(i_sMacroName) {}
177 	virtual const char*	Text() const;
178 
179 	virtual void		DealOut(
180 							::TokenDealer &		o_rDealer );
181   private:
182 	String              sMacroName;
183 };
184 
185 
186 
187 #if 0 // just for viewing:
188 class Tok_TypeKey : public cpp::Token                  // file-><type-PE>
189 class Tok_Template : public cpp::Token                 // file
190 class Tok_Namespace : public cpp::Token                // file
191 class Tok_Bracket : public cpp::Token                  // ueberall
192 class Tok_Separator : public cpp::Token                // ueberall
193 
194 class Tok_Identifier : public cpp::Token			   // ueberall
195 class Tok_NameSeparator : public cpp::Token            // Type, Name
196 class Tok_BuiltInType : public cpp::Token			   // ueberall
197 class Tok_ConVol : public cpp::Token                   // class-><FuVa>
198 class Tok_StorageClass : public cpp::Token             // file-><type>,<FuVa>
199 class Tok_OperatorFunctionName : public cpp::Token     // class
200 
201 class Tok_Protection : public cpp::Token               // class
202 class Tok_Virtual : public cpp::Token                  // class
203 class Tok_Friend : public cpp::Token                   // class
204 class Tok_Tilde : public cpp::Token                    // class, expression
205 
206 class Tok_Ellipse : public cpp::Token                  // function-ParaList
207 class Tok_Assignment : public cpp::Token               // VariableDeclaraton, Function, Parameter
208 class Tok_Throw : public cpp::Token                    // function
209 class Tok_LessMore : public cpp::Token
210 class Tok_Operator : public cpp::Token                 // expression
211 
212 class Tok_Ignore : public cpp::Token
213 class Tok_ContextChanger : public cpp::Token
214 #endif // 0
215 
216 
217 }   // namespace cpp
218 
219 #endif
220