|
|
@ -6,6 +6,7 @@ |
|
|
|
#include <inttypes.h> |
|
|
|
#include <inttypes.h> |
|
|
|
#include <vector> |
|
|
|
#include <vector> |
|
|
|
#include <sstream> |
|
|
|
#include <sstream> |
|
|
|
|
|
|
|
#include <set> |
|
|
|
#include <typeinfo> |
|
|
|
#include <typeinfo> |
|
|
|
#include <typeindex> |
|
|
|
#include <typeindex> |
|
|
|
#include "debug.h" |
|
|
|
#include "debug.h" |
|
|
@ -64,6 +65,8 @@ public: |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
virtual std::string Dump() const {return "%"+Type()+"%";} |
|
|
|
virtual std::string Dump() const {return "%"+Type()+"%";} |
|
|
|
|
|
|
|
virtual void UsedFuncs(std::vector<std::string>& funcs) const {} |
|
|
|
|
|
|
|
virtual void UsedIdents(std::vector<std::string>& ids) const {} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Template for objects without specific constructor/destructor
|
|
|
|
// Template for objects without specific constructor/destructor
|
|
|
@ -148,6 +151,8 @@ public: |
|
|
|
const ObjectBase* Value() const {return val;} |
|
|
|
const ObjectBase* Value() const {return val;} |
|
|
|
void SetPair(const std::string& n, ObjectBase* v) {if(!Exist()) {name=n; val=v;}} |
|
|
|
void SetPair(const std::string& n, ObjectBase* v) {if(!Exist()) {name=n; val=v;}} |
|
|
|
std::string Dump() const override { return Name()+"="+val->Dump(); } |
|
|
|
std::string Dump() const override { return Name()+"="+val->Dump(); } |
|
|
|
|
|
|
|
void UsedFuncs(std::vector<std::string>& funcs) const override {return val->UsedFuncs(funcs);} |
|
|
|
|
|
|
|
void UsedIdents(std::vector<std::string>& ids) const override {return val->UsedIdents(ids);} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Class for objects list
|
|
|
|
// Class for objects list
|
|
|
@ -184,20 +189,30 @@ public: |
|
|
|
if(vals.size()!=0) s.resize(s.length()-2); |
|
|
|
if(vals.size()!=0) s.resize(s.length()-2); |
|
|
|
return s+")"; |
|
|
|
return s+")"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void UsedFuncs(std::vector<std::string>& funcs) const override {for(auto& i: vals) i->UsedFuncs(funcs);} |
|
|
|
|
|
|
|
void UsedIdents(std::vector<std::string>& ids) const override {for(auto& i: vals) i->UsedIdents(ids);} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Class for storing identifiers
|
|
|
|
// Class for storing identifiers
|
|
|
|
class OId: public ObjectBase |
|
|
|
class OId: public ObjectBase |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::string name; |
|
|
|
std::string name; |
|
|
|
|
|
|
|
std::string fullname; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ParseName(const std::string& s) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
fullname=s; |
|
|
|
|
|
|
|
name=s.substr(0,s.find_first_of('.')); |
|
|
|
|
|
|
|
} |
|
|
|
public: |
|
|
|
public: |
|
|
|
OId(const std::string* t):name(*t) {} |
|
|
|
OId(const std::string* t) {ParseName(*t);} |
|
|
|
~OId() {} |
|
|
|
~OId() {} |
|
|
|
bool Print() const override {return false;} |
|
|
|
bool Print() const override {return false;} |
|
|
|
std::string Type() const override {return "IDENT";} |
|
|
|
std::string Type() const override {return "IDENT";} |
|
|
|
std::string Name() const {return name;} |
|
|
|
std::string Name() const {return name;} |
|
|
|
void SetName(std::string s) {name=s;} |
|
|
|
void SetName(std::string s) {ParseName(s);} |
|
|
|
std::string Dump() const override {return Name();}; |
|
|
|
std::string Dump() const override {return fullname;}; |
|
|
|
|
|
|
|
void UsedIdents(std::vector<std::string>& ids) const override {ids.push_back(name);} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Class for storing functions
|
|
|
|
// Class for storing functions
|
|
|
@ -222,6 +237,8 @@ public: |
|
|
|
std::string Name() const {return name;} |
|
|
|
std::string Name() const {return name;} |
|
|
|
void SetName(std::string s) {name=s;} |
|
|
|
void SetName(std::string s) {name=s;} |
|
|
|
std::string Dump() const override {return Name()+args->Dump();}; |
|
|
|
std::string Dump() const override {return Name()+args->Dump();}; |
|
|
|
|
|
|
|
void UsedFuncs(std::vector<std::string>& funcs) const override {funcs.push_back(name); args->UsedFuncs(funcs);} |
|
|
|
|
|
|
|
void UsedIdents(std::vector<std::string>& ids) const override {args->UsedIdents(ids);} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|