Cleaned up variables
parent
c5b153964b
commit
c8ac7f8980
|
@ -36,7 +36,10 @@ struct Class : public Qualified {
|
||||||
typedef std::map<std::string, StaticMethod> StaticMethods;
|
typedef std::map<std::string, StaticMethod> StaticMethods;
|
||||||
|
|
||||||
/// Constructor creates an empty class
|
/// Constructor creates an empty class
|
||||||
Class(bool verbose=true) : isVirtual(false), isSerializable(false), hasSerialization(false), verbose_(verbose) {}
|
Class(bool verbose = true) :
|
||||||
|
isVirtual(false), isSerializable(false), hasSerialization(false), deconstructor(
|
||||||
|
verbose), verbose_(verbose) {
|
||||||
|
}
|
||||||
|
|
||||||
// Then the instance variables are set directly by the Module constructor
|
// Then the instance variables are set directly by the Module constructor
|
||||||
std::vector<std::string> templateArgs; ///< Template arguments
|
std::vector<std::string> templateArgs; ///< Template arguments
|
||||||
|
|
|
@ -97,20 +97,9 @@ Module::Module(const string& interfacePath,
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void Module::parseMarkup(const std::string& data) {
|
void Module::parseMarkup(const std::string& data) {
|
||||||
// these variables will be imperatively updated to gradually build [cls]
|
// The parse imperatively :-( updates variables gradually during parse
|
||||||
// The one with postfix 0 are used to reset the variables after parse.
|
// The one with postfix 0 are used to reset the variables after parse.
|
||||||
Argument arg0, arg;
|
vector<string> namespaces; // current namespace tag
|
||||||
vector<string> arg_dup; ///keep track of duplicates
|
|
||||||
Constructor constructor0(verbose), constructor(verbose);
|
|
||||||
Deconstructor deconstructor0(verbose), deconstructor(verbose);
|
|
||||||
StaticMethod static_method0(verbose), static_method(verbose);
|
|
||||||
Class cls0(verbose),cls(verbose);
|
|
||||||
GlobalFunction globalFunc0(verbose), globalFunc(verbose);
|
|
||||||
ForwardDeclaration fwDec0, fwDec;
|
|
||||||
vector<string> namespaces, /// current namespace tag
|
|
||||||
namespaces_return; /// namespace for current return type
|
|
||||||
string include_path = "";
|
|
||||||
const string null_str = "";
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Grammar with actions that build the Class object. Actions are
|
// Grammar with actions that build the Class object. Actions are
|
||||||
|
@ -139,7 +128,9 @@ void Module::parseMarkup(const std::string& data) {
|
||||||
|
|
||||||
Rule namespace_name_p = lexeme_d[lower_p >> *(alnum_p | '_')] - keywords_p;
|
Rule namespace_name_p = lexeme_d[lower_p >> *(alnum_p | '_')] - keywords_p;
|
||||||
|
|
||||||
Rule namespace_arg_p = namespace_name_p[push_back_a(arg.type.namespaces)] >> str_p("::");
|
Argument arg0, arg;
|
||||||
|
Rule namespace_arg_p = namespace_name_p
|
||||||
|
[push_back_a(arg.type.namespaces)] >> str_p("::");
|
||||||
|
|
||||||
Rule argEigenType_p =
|
Rule argEigenType_p =
|
||||||
eigenType_p[assign_a(arg.type.name)];
|
eigenType_p[assign_a(arg.type.name)];
|
||||||
|
@ -157,6 +148,8 @@ void Module::parseMarkup(const std::string& data) {
|
||||||
|
|
||||||
Rule name_p = lexeme_d[alpha_p >> *(alnum_p | '_')];
|
Rule name_p = lexeme_d[alpha_p >> *(alnum_p | '_')];
|
||||||
|
|
||||||
|
// TODO, do we really need cls here? Non-local
|
||||||
|
Class cls0(verbose),cls(verbose);
|
||||||
Rule classParent_p =
|
Rule classParent_p =
|
||||||
*(namespace_name_p[push_back_a(cls.qualifiedParent.namespaces)] >> str_p("::")) >>
|
*(namespace_name_p[push_back_a(cls.qualifiedParent.namespaces)] >> str_p("::")) >>
|
||||||
className_p[assign_a(cls.qualifiedParent.name)];
|
className_p[assign_a(cls.qualifiedParent.name)];
|
||||||
|
@ -217,11 +210,14 @@ void Module::parseMarkup(const std::string& data) {
|
||||||
|
|
||||||
Rule argumentList_p = !argument_p >> * (',' >> argument_p);
|
Rule argumentList_p = !argument_p >> * (',' >> argument_p);
|
||||||
|
|
||||||
|
// parse class constructor
|
||||||
|
Constructor constructor0(verbose), constructor(verbose);
|
||||||
Rule constructor_p =
|
Rule constructor_p =
|
||||||
(className_p >> '(' >> argumentList_p >> ')' >> ';' >> !comments_p)
|
(className_p >> '(' >> argumentList_p >> ')' >> ';' >> !comments_p)
|
||||||
[push_back_a(constructor.args_list, args)]
|
[push_back_a(constructor.args_list, args)]
|
||||||
[clear_a(args)];
|
[clear_a(args)];
|
||||||
|
|
||||||
|
vector<string> namespaces_return; /// namespace for current return type
|
||||||
Rule namespace_ret_p = namespace_name_p[push_back_a(namespaces_return)] >> str_p("::");
|
Rule namespace_ret_p = namespace_name_p[push_back_a(namespaces_return)] >> str_p("::");
|
||||||
|
|
||||||
// HACK: use const values instead of using enums themselves - somehow this doesn't result in values getting assigned to gibberish
|
// HACK: use const values instead of using enums themselves - somehow this doesn't result in values getting assigned to gibberish
|
||||||
|
@ -300,12 +296,10 @@ void Module::parseMarkup(const std::string& data) {
|
||||||
[assign_a(constructor.name, cls.name)]
|
[assign_a(constructor.name, cls.name)]
|
||||||
[assign_a(cls.constructor, constructor)]
|
[assign_a(cls.constructor, constructor)]
|
||||||
[assign_a(cls.namespaces, namespaces)]
|
[assign_a(cls.namespaces, namespaces)]
|
||||||
[assign_a(deconstructor.name,cls.name)]
|
[assign_a(cls.deconstructor.name,cls.name)]
|
||||||
[assign_a(cls.deconstructor, deconstructor)]
|
|
||||||
[bl::bind(&handle_possible_template, bl::var(classes), bl::var(cls),
|
[bl::bind(&handle_possible_template, bl::var(classes), bl::var(cls),
|
||||||
bl::var(templateArgName), bl::var(templateInstantiations))]
|
bl::var(templateArgName), bl::var(templateInstantiations))]
|
||||||
[clear_a(templateInstantiations)]
|
[clear_a(templateInstantiations)]
|
||||||
[assign_a(deconstructor,deconstructor0)]
|
|
||||||
[assign_a(constructor, constructor0)]
|
[assign_a(constructor, constructor0)]
|
||||||
[assign_a(cls,cls0)];
|
[assign_a(cls,cls0)];
|
||||||
|
|
||||||
|
@ -341,6 +335,8 @@ void Module::parseMarkup(const std::string& data) {
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// parse forward declaration
|
||||||
|
ForwardDeclaration fwDec0, fwDec;
|
||||||
Rule forward_declaration_p =
|
Rule forward_declaration_p =
|
||||||
!(str_p("virtual")[assign_a(fwDec.isVirtual, true)])
|
!(str_p("virtual")[assign_a(fwDec.isVirtual, true)])
|
||||||
>> str_p("class")
|
>> str_p("class")
|
||||||
|
|
Loading…
Reference in New Issue