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 CPPDictionary_hpp 00053 #define CPPDictionary_hpp 00054 00055 #include "Dictionary.hh" 00056 #include "CPPSymbol.hh" 00057 00058 class CPPDictionary : public Dictionary 00059 { 00060 public: 00061 CPPDictionary(int nb=43, int ns=50, int nc=30000) 00062 : Dictionary(nb, ns, nc) 00063 {} 00064 protected: 00065 void dumpSymbol(FILE * /*f*/, DictEntry * /*de*/) 00066 { 00067 /* CPPSymbol *cs = (CPPSymbol *)de; 00068 00069 if (!(cs->getType()==CPPSymbol::otTypedef || 00070 cs->getType()==CPPSymbol::otClass || 00071 cs->getType()==CPPSymbol::otEnum || 00072 cs->getType()==CPPSymbol::otUnion || 00073 cs->getType()==CPPSymbol::otStruct) ) 00074 fprintf(f, "[non-"); 00075 else 00076 fprintf(f, "["); 00077 fprintf(f, "type: %s]\n", cs->getKey().c_str());*/ 00078 } 00079 }; 00080 00081 #endif 00082 00083