Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

parser_spec.hh

Go to the documentation of this file.
00001 /*
00002  *  File:       parser_spec.hh
00003  *              $Id: parser_spec.hh,v 1.6 2002/06/13 11:40:07 alec Exp $
00004  *
00005  *  Author:     Alec Panovici (alecu@email.com)
00006  * 
00007  *  Comments:
00008  *
00009  *  Revision history:
00010  *
00011  *  $Log: parser_spec.hh,v $
00012  *  Revision 1.6  2002/06/13 11:40:07  alec
00013  *  added #line stuff
00014  *
00015  *  Revision 1.5  2002/05/10 07:15:10  alec
00016  *  parser parse tree ok
00017  *
00018  *  Revision 1.4  2002/05/08 18:20:33  alec
00019  *  *** empty log message ***
00020  *
00021  *  Revision 1.3  2002/04/29 09:34:10  alec
00022  *  scanner ptree building compiles
00023  *
00024  */
00025 
00026 
00027 /*
00028   Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com)
00029 
00030   This program is free software; you can redistribute it and/or modify
00031   it under the terms of the GNU General Public License as published by
00032   the Free Software Foundation; either version 2 of the License, or
00033   (at your option) any later version.
00034 
00035   This program is distributed in the hope that it will be useful,
00036   but WITHOUT ANY WARRANTY; without even the implied warranty of
00037   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00038   GNU General Public License for more details.
00039 
00040   You should have received a copy of the GNU General Public License
00041   along with this program; if not, write to the Free Software
00042   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00043 
00044  */
00045 
00046 #ifndef __PARSER_SPEC_HH__
00047 #define __PARSER_SPEC_HH__
00048 
00049 #include "iparser_spec.hh"
00050 #include "production_spec.hh"
00051 
00052 class ITokenSpec;
00053 class EbnfNodeBuilder;
00054 class PropRegistry;
00055 
00059 class ParserSpec : public IParserSpec
00060 {
00061 public:
00062 
00063   ParserSpec (PropRegistry &registry_, ITokenSpec &tokens_);
00064   
00065   virtual IEbnfNodeBuilder& getEbnfNodeBuilder();
00066 
00067   virtual void addProduction (const string &name,
00068                               const string &retTypeName,
00069                               const Position &retTypePos,
00070                               const string &formalArgs,
00071                               const Position &formalArgsPos,
00072                               const string &exceptList,
00073                               const Position &exceptListPos,
00074                               const string &preambleCode,
00075                               const Position &preambleCodePos,
00076                               EbnfNode *expansion,
00077                               const Position &pos) throw (ParseException);
00078 
00079   virtual void setPreambleCode (const string &block, const Position &pos);
00080 
00081   virtual void setClassName (const string &className);
00082 
00083   virtual void setInheritance (const string &inheritance,
00084                                const Position &pos);
00085   
00086   virtual void addCodeBlock (const string &block,
00087                              const Position &pos);
00088 
00092   bool isProduction (const string &name);
00093 
00100   ProductionSpec& getProduction (const string &name) throw (ParseException);
00101   
00102 #ifdef DEBUG
00103 
00107   virtual void dump (ostream &os) const;
00108 #endif
00109 
00110 public:
00111 
00115   EbnfNodeBuilder &nodeBuilder;
00116   
00120   string className;
00121 
00125   CodeChunk preambleCode;
00126 
00132   vector<CodeChunk> userCode;
00133 
00138   CodeChunk inheritance;
00139 
00144   ITokenSpec &tokens;
00145 
00146   vector<ProductionSpec> productions;
00147 };
00148 
00149 #endif /* #ifndef __PARSER_SPEC_HH__ */

Generated at Tue Jul 9 21:05:45 2002 for CppCC by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001