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 DictEntry_hpp 00053 #define DictEntry_hpp 00054 00055 class DictEntry 00056 { 00057 protected: 00058 std::string key; 00059 int hashCode; 00060 DictEntry *next; // next element in the bucket 00061 DictEntry *scope; // next element in the scope 00062 00063 public: 00064 int this_scope; // 4/2/96 LL - added to store scope 00065 00066 DictEntry() 00067 { 00068 hashCode = -1; 00069 next = scope = NULL; 00070 } 00071 DictEntry(const std::string& k, int h = -1) 00072 { 00073 key = k; 00074 hashCode = h; 00075 next = scope = NULL; 00076 } 00077 virtual ~DictEntry() 00078 { 00079 hashCode = -1; 00080 next = scope = NULL; 00081 } 00082 00083 void setKey(const std::string& k) {key = k;} 00084 const std::string& getKey() {return key;} 00085 00086 void setHashCode(int h) {hashCode = h;} 00087 int getHashCode() {return hashCode;} 00088 00089 void setNext(DictEntry *n) {next = n;} 00090 DictEntry *getNext() {return next;} 00091 00092 void setScope(DictEntry *s) {scope = s;} 00093 DictEntry *getNextInScope() {return scope;} 00094 }; 00095 00096 #endif 00097