00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef _classwalk_h
00016 #define _classwalk_h
00017
00018 #include "ptree-core.h"
00019 #include "walker.h"
00020
00021 class ClassWalker : public Walker {
00022 public:
00023 ClassWalker(Parser* p) : Walker(p) { client_data = nil; }
00024 ClassWalker(Parser* p, Environment* e)
00025 : Walker(p, e) { client_data = nil; }
00026 ClassWalker(Environment* e) : Walker(e) { client_data = nil; }
00027 ClassWalker(Walker* w) : Walker(w) { client_data = nil; }
00028
00029 bool IsClassWalker();
00030 void InsertBeforeStatement(Ptree*);
00031 void AppendAfterStatement(Ptree*);
00032 void InsertBeforeToplevel(Ptree*);
00033 void AppendAfterToplevel(Ptree*);
00034 bool InsertDeclaration(Ptree*, Class*, Ptree*, void*);
00035 void* LookupClientData(Class*, Ptree*);
00036
00037 Ptree* GetInsertedPtree();
00038 Ptree* GetAppendedPtree();
00039
00040 Ptree* TranslateMetaclassDecl(Ptree* decl);
00041 Ptree* TranslateClassSpec(Ptree* spec, Ptree* userkey,
00042 Ptree* class_def, Class* metaobject);
00043 Ptree* TranslateTemplateInstantiation(Ptree* spec, Ptree* userkey,
00044 Ptree* class_def, Class* metaobject);
00045 Ptree* ConstructClass(Class* metaobject);
00046
00047 Ptree* ConstructAccessSpecifier(int access);
00048 Ptree* ConstructMember(void* );
00049
00050 Ptree* TranslateStorageSpecifiers(Ptree*);
00051 Ptree* TranslateTemplateFunction(Ptree* temp_def, Ptree* impl);
00052 Class* MakeMetaobjectForCfunctions();
00053 Ptree* TranslateFunctionImplementation(Ptree*);
00054 Ptree* MakeMemberDeclarator(bool record,
00055 void* ,
00056 PtreeDeclarator*);
00057 Ptree* RecordArgsAndTranslateFbody(Class*, Ptree* args, Ptree* body);
00058 Ptree* TranslateFunctionBody(Ptree*);
00059 Ptree* TranslateBlock(Ptree*);
00060 Ptree* TranslateArgDeclList(bool, Ptree*, Ptree*);
00061 Ptree* TranslateInitializeArgs(PtreeDeclarator*, Ptree*);
00062 Ptree* TranslateAssignInitializer(PtreeDeclarator*, Ptree*);
00063 Ptree* TranslateUserAccessSpec(Ptree*);
00064 Ptree* TranslateAssign(Ptree*);
00065 Ptree* TranslateInfix(Ptree*);
00066 Ptree* TranslateUnary(Ptree*);
00067 Ptree* TranslateArray(Ptree*);
00068 Ptree* TranslatePostfix(Ptree*);
00069 Ptree* TranslateFuncall(Ptree*);
00070 Ptree* TranslateDotMember(Ptree*);
00071 Ptree* TranslateArrowMember(Ptree*);
00072 Ptree* TranslateThis(Ptree*);
00073 Ptree* TranslateVariable(Ptree*);
00074 Ptree* TranslateUserStatement(Ptree*);
00075 Ptree* TranslateStaticUserStatement(Ptree*);
00076 Ptree* TranslateNew2(Ptree*, Ptree*, Ptree*, Ptree*, Ptree*,
00077 Ptree*, Ptree*);
00078 Ptree* TranslateDelete(Ptree*);
00079
00080 private:
00081 static Class* GetClassMetaobject(TypeInfo&);
00082 PtreeArray* RecordMembers(Ptree*, Ptree*, Class*);
00083 void RecordMemberDeclaration(Ptree* mem, PtreeArray* tspec_list);
00084 Ptree* TranslateStorageSpecifiers2(Ptree* rest);
00085
00086 static Ptree* CheckMemberEquiv(Ptree*, Ptree*);
00087 static Ptree* CheckEquiv(Ptree* p, Ptree* q) {
00088 return Ptree::Equiv(p, q) ? p : q;
00089 }
00090
00091 private:
00092 struct ClientDataLink : public LightObject {
00093 ClientDataLink* next;
00094 Class* metaobject;
00095 Ptree* key;
00096 void* data;
00097 };
00098
00099 PtreeArray before_statement, after_statement;
00100 PtreeArray before_toplevel, after_toplevel;
00101 PtreeArray inserted_declarations;
00102 ClientDataLink* client_data;
00103 };
00104
00105 #endif