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