26
26
#include "Puma/ACIntroducer.h"
27
27
using namespace Puma;
32
40
class PreprocessorParser;
40
53
class Introducer : public ACIntroducer {
41
55
CodeWeaver &_code_weaver;
45
59
PreprocessorParser *_cpp;
61
set<const Unit*> _included_aspect_headers;
62
list<CTree*> _ah_trees;
63
typedef map<CClassInfo*,JPL_Class*> TargetMap;
65
list<TokenProvider*> _token_providers;
66
list<TokenStream*> _token_streams;
68
// find a member that is/must be link-once (global) code
69
static CObjectInfo *link_once_object (CClassInfo *ci);
71
// check whether an object was introduced
72
static bool is_intro (CObjectInfo *obj);
74
// parse code that shall be introduced
75
CTree *parse (list<Unit*> units, CTree *(CCSyntax::*rule)(),
76
const char *expected_id, ErrorStream &err);
48
79
// Contructor: every Introducer knows the parser
49
Introducer (CodeWeaver &cw, CCParser &p, Plan &pl) :
50
_code_weaver (cw), _parser (p), _plan (pl), _intro_level (0), _cpp (0) {}
80
Introducer (Plan &pl, CodeWeaver &cw, CCParser &p, ModelBuilder &jpm,
81
IncludeGraph &ig) : _plan (pl), _code_weaver (cw), _parser (p), _jpm (jpm),
82
_intro_level (0), _cpp (0), _ig (ig) {}
84
// Destructor: release all allocated resources
52
87
// called when a new class/union/struct/aspect is created, current scope
53
88
// is the global scope
59
94
// called when a new class/union/struct/aspect definition ends
60
95
// (still in the class scope)
61
virtual void class_end (CT_ClassDef*, CTree*);
96
virtual void class_end (CT_ClassDef*);
98
// called after the parser tried to parse a base clause
99
virtual void base_clause_end (CT_ClassDef*, Token*);
101
// called after the program has been parsed completely
102
virtual void trans_unit_end (CT_Program *);
104
// get the list of aspect header syntax trees
105
list<CTree*> &ah_trees () { return _ah_trees; }
65
109
// check in the plan if the current class needs an introduction
66
110
JPP_Class *plan_lookup (CClassInfo *ci);
112
// create the weaving plan for a given class
113
JPP_Class *create_plan (CClassInfo *ci);
68
115
// manage the intro nesting level and the _cpp pointer
73
121
#endif /* __Introducer_h__ */