finish codeparser improvements
pip_cmg now works with new nested entities approach Getters now can access to bitfields
This commit is contained in:
@@ -94,10 +94,10 @@ void PICodeParser::parseFile(const PIString & file, bool follow_includes) {
|
||||
if (c->parent_scope)
|
||||
piCout << "parent" << c->parent_scope->name;
|
||||
piCout << "Functions:";
|
||||
for (const auto & m: c->functions)
|
||||
for (const auto & m: c->functions)
|
||||
piCout << m.type << m.name << m.meta;
|
||||
piCout << "Members:";
|
||||
for (const auto & m: c->members)
|
||||
for (const auto & m: c->members)
|
||||
piCout << m.type << m.name << m.meta;
|
||||
}
|
||||
piCout << "\n\nDefines:";
|
||||
@@ -110,7 +110,7 @@ void PICodeParser::parseFile(const PIString & file, bool follow_includes) {
|
||||
piCout << "\n\nEnums:";
|
||||
for (const auto & c: enums) {
|
||||
piCout << PIStringAscii("enum") << c.name << c.meta;
|
||||
for (const auto & e: c.members)
|
||||
for (const auto & e: c.members)
|
||||
piCout << " " << e.name << '=' << e.value << e.meta;
|
||||
}
|
||||
piCout << "\n\nTypedefs:";
|
||||
@@ -137,7 +137,7 @@ void PICodeParser::parseFiles(const PIStringList & files, bool follow_includes)
|
||||
piCout << PIStringAscii("enum") << c.name << c.members;
|
||||
piCout << "\n\nTypedefs:";
|
||||
for (const auto & c: typedefs)
|
||||
piCout << PIStringAscii("typedef") << c;*/
|
||||
piCout << PIStringAscii("typedef") << c;*/
|
||||
}
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@ void PICodeParser::clear() {
|
||||
<< "a2"
|
||||
<< "n2"
|
||||
<< "a3"
|
||||
<< "n3");
|
||||
<< "n3");
|
||||
}
|
||||
|
||||
|
||||
@@ -611,17 +611,17 @@ PICodeParser::Entity * PICodeParser::parseClassDeclaration(const PIString & fc)
|
||||
Visibility vis = cur_def_vis;
|
||||
cur_def_vis = (is_class ? Private : Public);
|
||||
PIString cn = cd.mid(6).trim();
|
||||
bool has_name = !cn.isEmpty();
|
||||
bool is_anonymous = cn.isEmpty();
|
||||
if (cn.isEmpty()) cn = PIStringAscii("<unnamed_") + PIString::fromNumber(anon_num++) + '>';
|
||||
// piCout << "found " << typename_ << cn;
|
||||
Entity * e = new Entity();
|
||||
e->meta = meta;
|
||||
e->name = cur_namespace + cn;
|
||||
e->type = typename_;
|
||||
e->has_name = has_name;
|
||||
e->parents = parents;
|
||||
e->visibility = vis;
|
||||
e->file = cur_file;
|
||||
Entity * e = new Entity();
|
||||
e->meta = meta;
|
||||
e->name = cur_namespace + cn;
|
||||
e->type = typename_;
|
||||
e->is_anonymous = is_anonymous;
|
||||
e->parents = parents;
|
||||
e->visibility = vis;
|
||||
e->file = cur_file;
|
||||
entities << e;
|
||||
return e;
|
||||
}
|
||||
@@ -651,7 +651,6 @@ PICodeParser::Entity * PICodeParser::parseClass(Entity * parent, PIString & fc,
|
||||
}
|
||||
// piCout << "found class <****\n" << fc << "\n****>";
|
||||
if (ce) {
|
||||
if (parent) parent->children << ce;
|
||||
ce->parent_scope = parent;
|
||||
}
|
||||
int ps = -1;
|
||||
@@ -693,7 +692,7 @@ PICodeParser::Entity * PICodeParser::parseClass(Entity * parent, PIString & fc,
|
||||
fc.takeSymbol();
|
||||
continue;
|
||||
}
|
||||
tmp = fc.takeLeft(fc.find('{'));
|
||||
tmp = fc.takeLeft(fc.find('{')).trim();
|
||||
stmp = fc.takeRange('{', '}');
|
||||
stmp = cw + ' ' + tmp + '{' + stmp + '}';
|
||||
auto new_entity = parseClass(ce, stmp, false);
|
||||
@@ -706,15 +705,13 @@ PICodeParser::Entity * PICodeParser::parseClass(Entity * parent, PIString & fc,
|
||||
if (fc.takeSymbol() == ";") break;
|
||||
} while (var.isNotEmpty());
|
||||
if (new_entity) {
|
||||
if (vars.isNotEmpty()) {
|
||||
ce->children.removeAll(new_entity);
|
||||
Member me;
|
||||
me.visibility = cur_def_vis;
|
||||
me.type = new_entity->name;
|
||||
for (const auto & v: vars) {
|
||||
me.name = v;
|
||||
ce->members << me;
|
||||
}
|
||||
Member me;
|
||||
me.visibility = cur_def_vis;
|
||||
me.type = new_entity->name;
|
||||
if (tmp.isEmpty() && vars.isEmpty()) vars = {""};
|
||||
for (const auto & v: vars) {
|
||||
me.name = v;
|
||||
ce->members << me;
|
||||
}
|
||||
}
|
||||
// piCout << "!!! <" << vars;
|
||||
@@ -1261,7 +1258,7 @@ void PICodeParser::replaceMeta(PIString & dn) {
|
||||
PICodeParser::Entity * PICodeParser::findEntityByName(const PIString & en) {
|
||||
for (auto * e: entities)
|
||||
if (e->name == en) return e;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user