00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
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 ®istry_, 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