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