00001 /* 00002 * PUBLIC DOMAIN PCCTS-BASED C++ GRAMMAR (cplusplus.g, stat.g, expr.g) 00003 * 00004 * Authors: Sumana Srinivasan, NeXT Inc.; sumana_srinivasan@next.com 00005 * Terence Parr, Parr Research Corporation; parrt@parr-research.com 00006 * Russell Quong, Purdue University; quong@ecn.purdue.edu 00007 * 00008 * SOFTWARE RIGHTS 00009 * 00010 * This file is a part of the ANTLR-based C++ grammar and is free 00011 * software. We do not reserve any LEGAL rights to its use or 00012 * distribution, but you may NOT claim ownership or authorship of this 00013 * grammar or support code. An individual or company may otherwise do 00014 * whatever they wish with the grammar distributed herewith including the 00015 * incorporation of the grammar or the output generated by ANTLR into 00016 * commerical software. You may redistribute in source or binary form 00017 * without payment of royalties to us as long as this header remains 00018 * in all source distributions. 00019 * 00020 * We encourage users to develop parsers/tools using this grammar. 00021 * In return, we ask that credit is given to us for developing this 00022 * grammar. By "credit", we mean that if you incorporate our grammar or 00023 * the generated code into one of your programs (commercial product, 00024 * research project, or otherwise) that you acknowledge this fact in the 00025 * documentation, research report, etc.... In addition, you should say nice 00026 * things about us at every opportunity. 00027 * 00028 * As long as these guidelines are kept, we expect to continue enhancing 00029 * this grammar. Feel free to send us enhancements, fixes, bug reports, 00030 * suggestions, or general words of encouragement at parrt@parr-research.com. 00031 * 00032 * NeXT Computer Inc. 00033 * 900 Chesapeake Dr. 00034 * Redwood City, CA 94555 00035 * 12/02/1994 00036 * 00037 * Restructured for public consumption by Terence Parr late February, 1995. 00038 * 00039 * Requires PCCTS 1.32b4 or higher to get past ANTLR. 00040 * 00041 * DISCLAIMER: we make no guarantees that this grammar works, makes sense, 00042 * or can be used to do anything useful. 00043 */ 00044 /* 1999-2004 Version 3.0 July 2004 00045 * Modified by David Wigg at London South Bank University for CPP_parser.g 00046 * 00047 * See MyReadMe.txt for further information 00048 * 00049 * This file is best viewed in courier font with tabs set to 4 spaces 00050 */ 00051 00052 #ifndef CPPSymbol_hpp 00053 #define CPPSymbol_hpp 00054 00055 #include "DictEntry.hh" 00056 00057 class CPPSymbol : public DictEntry 00058 { 00059 public: 00060 enum ObjectType 00061 {otInvalid=0, otFunction=1, otVariable, otTypedef, 00062 otStruct, otUnion, otEnum, otClass, otEnumElement}; 00063 00064 enum ObjectFunction 00065 {ofNormal=0, ofAddress=1, ofPointer}; 00066 00067 protected: 00068 ObjectType type; 00069 ObjectFunction function; // Not fully used yet 00070 00071 public: 00072 CPPSymbol() {;} 00073 CPPSymbol(const std::string& k, ObjectType ot=otInvalid, ObjectFunction of=ofNormal) 00074 : DictEntry(k) {type = ot; function = of;} 00075 00076 void setType(ObjectType t) {type = t;} 00077 ObjectType getType() {return type;} 00078 00079 void setFunction(ObjectFunction f) {function = f;} 00080 ObjectFunction getFunction() {return function;} 00081 }; 00082 00083 #endif 00084