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