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 #include <precomp.h> 23 #include <all_toks.hxx> 24 25 26 // NOT FULLY DEFINED SERVICES 27 #include <cpp/ctokdeal.hxx> 28 #include "c_dealer.hxx" 29 #include "tokintpr.hxx" 30 31 32 33 namespace cpp { 34 35 36 void 37 Token::DealOut( ::TokenDealer & o_rDealer ) 38 { 39 // KORR_FUTURE HACK (casting to derivation cpp::TokenDealer) 40 o_rDealer.AsDistributor()->Deal_CppCode(*this); 41 } 42 43 44 #define DEF_TOKEN_CLASS(name) \ 45 void \ 46 Tok_##name::Trigger( TokenInterpreter & io_rInterpreter ) const \ 47 { io_rInterpreter.Hdl_##name(*this); } \ 48 INT16 \ 49 Tok_##name::TypeId() const { return Tid_##name; } \ 50 const char * \ 51 Tok_##name::Text() const { return #name; } 52 53 #define DEF_TOKEN_CLASS_WITHTEXT(name, text ) \ 54 void \ 55 Tok_##name::Trigger( TokenInterpreter & io_rInterpreter ) const \ 56 { io_rInterpreter.Hdl_##name(*this); } \ 57 INT16 \ 58 Tok_##name::TypeId() const { return Tid_##name; } \ 59 const char * \ 60 Tok_##name::Text() const { return text; } 61 62 63 DEF_TOKEN_CLASS_WITHTEXT(Identifier,sText) 64 DEF_TOKEN_CLASS_WITHTEXT(Operator,sText) 65 66 DEF_TOKEN_CLASS(operator) 67 DEF_TOKEN_CLASS(class) 68 DEF_TOKEN_CLASS(struct) 69 DEF_TOKEN_CLASS(union) 70 DEF_TOKEN_CLASS(enum) 71 DEF_TOKEN_CLASS(typedef) 72 DEF_TOKEN_CLASS(public) 73 DEF_TOKEN_CLASS(protected) 74 DEF_TOKEN_CLASS(private) 75 DEF_TOKEN_CLASS(template) 76 DEF_TOKEN_CLASS(virtual) 77 DEF_TOKEN_CLASS(friend) 78 DEF_TOKEN_CLASS_WITHTEXT(Tilde,"~") 79 DEF_TOKEN_CLASS(const) 80 DEF_TOKEN_CLASS(volatile) 81 DEF_TOKEN_CLASS(extern) 82 DEF_TOKEN_CLASS(static) 83 DEF_TOKEN_CLASS(mutable) 84 DEF_TOKEN_CLASS(register) 85 DEF_TOKEN_CLASS(inline) 86 DEF_TOKEN_CLASS(explicit) 87 DEF_TOKEN_CLASS(namespace) 88 DEF_TOKEN_CLASS(using) 89 DEF_TOKEN_CLASS(throw) 90 DEF_TOKEN_CLASS_WITHTEXT(SwBracket_Left,"{") 91 DEF_TOKEN_CLASS_WITHTEXT(SwBracket_Right,"}") 92 DEF_TOKEN_CLASS_WITHTEXT(ArrayBracket_Left,"[") 93 DEF_TOKEN_CLASS_WITHTEXT(ArrayBracket_Right,"]") 94 DEF_TOKEN_CLASS_WITHTEXT(Bracket_Left,"(") 95 DEF_TOKEN_CLASS_WITHTEXT(Bracket_Right,")") 96 DEF_TOKEN_CLASS_WITHTEXT(DoubleColon,"::") 97 DEF_TOKEN_CLASS_WITHTEXT(Semicolon,";") 98 DEF_TOKEN_CLASS_WITHTEXT(Comma,",") 99 DEF_TOKEN_CLASS_WITHTEXT(Colon,":") 100 DEF_TOKEN_CLASS_WITHTEXT(Assign,"=") 101 DEF_TOKEN_CLASS_WITHTEXT(Less,"<") 102 DEF_TOKEN_CLASS_WITHTEXT(Greater,">") 103 DEF_TOKEN_CLASS_WITHTEXT(Asterix,"*") 104 DEF_TOKEN_CLASS_WITHTEXT(AmpersAnd,"&") 105 DEF_TOKEN_CLASS_WITHTEXT(Ellipse,"...") 106 DEF_TOKEN_CLASS(typename) 107 108 DEF_TOKEN_CLASS_WITHTEXT(DefineName,sText) 109 DEF_TOKEN_CLASS_WITHTEXT(MacroName,sText) 110 DEF_TOKEN_CLASS_WITHTEXT(MacroParameter,sText) 111 // DEF_TOKEN_CLASS_WITHTEXT(PreProDefinition,sText) 112 113 void 114 Tok_PreProDefinition::Trigger( TokenInterpreter & io_rInterpreter ) const 115 { io_rInterpreter.Hdl_PreProDefinition(*this); } 116 117 INT16 118 Tok_PreProDefinition::TypeId() const { return Tid_PreProDefinition; } 119 120 const char * 121 Tok_PreProDefinition::Text() const 122 { 123 return sText; 124 } 125 126 127 128 DEF_TOKEN_CLASS_WITHTEXT(BuiltInType,sText) 129 DEF_TOKEN_CLASS_WITHTEXT(TypeSpecializer,sText) 130 DEF_TOKEN_CLASS_WITHTEXT(Constant,sText) 131 132 const char * 133 Tok_UnblockMacro::Text() const 134 { 135 return sMacroName; 136 } 137 138 void 139 Tok_UnblockMacro::DealOut( ::TokenDealer & o_rDealer ) 140 { 141 // KORR_FUTURE HACK (casting to derivation cpp::TokenDealer) 142 o_rDealer.AsDistributor()->Deal_Cpp_UnblockMacro(*this); 143 } 144 145 } // namespace cpp 146