parse only public inherited classes
This commit is contained in:
@@ -577,28 +577,36 @@ bool PICodeParser::parseFileContent(PIString & fc, bool main) {
|
||||
|
||||
|
||||
PICodeParser::Entity * PICodeParser::parseClassDeclaration(const PIString & fc) {
|
||||
static const PIString s_ss = PIStringAscii(" ");
|
||||
static const PIString s_M = PIStringAscii("$M");
|
||||
static const PIString s_class = PIStringAscii("class");
|
||||
PIString cd = fc.trimmed().removeAll('\n').replaceAll('\t', ' ').replaceAll(s_ss, ' '), pn;
|
||||
static const PIString s_ss = PIStringAscii(" ");
|
||||
static const PIString s_M = PIStringAscii("$M");
|
||||
static const PIString s_class = PIStringAscii("class");
|
||||
static const PIString s_public = PIStringAscii("public");
|
||||
PIString cd = fc.trimmed().removeAll('\n').replaceAll('\t', ' ').replaceAll(s_ss, ' '), pn;
|
||||
MetaMap meta;
|
||||
int ind = cd.find(s_M);
|
||||
if (ind >= 0) {
|
||||
meta = tmp_meta.value(cd.takeMid(ind, 5));
|
||||
cd.replaceAll(s_ss, ' ');
|
||||
}
|
||||
PIString typename_ = cd.left(6).trim();
|
||||
bool is_class = typename_ == s_class;
|
||||
ind = cd.find(':');
|
||||
// piCout << "found class <****\n" << cd << "\n****>";
|
||||
ind = cd.find(':');
|
||||
PIVector<Entity *> parents;
|
||||
if (ind > 0) {
|
||||
PIStringList pl = cd.takeMid(ind + 1).trim().split(',');
|
||||
cd.cutRight(1);
|
||||
Entity * pe = 0;
|
||||
for (const auto & p: pl) {
|
||||
if (p.contains(' '))
|
||||
pn = p.mid(p.find(' ') + 1);
|
||||
else
|
||||
PIString access;
|
||||
if (p.contains(' ')) {
|
||||
access = p.left(p.find(' ')).trim();
|
||||
pn = p.mid(p.find(' ') + 1);
|
||||
} else {
|
||||
pn = p;
|
||||
}
|
||||
bool is_public = access.isEmpty() ? !is_class : access == s_public;
|
||||
if (!is_public) continue;
|
||||
pe = findEntityByName(pn);
|
||||
if (pe == 0)
|
||||
; //{piCout << "Error: can`t find" << pn;}
|
||||
@@ -606,12 +614,10 @@ PICodeParser::Entity * PICodeParser::parseClassDeclaration(const PIString & fc)
|
||||
parents << pe;
|
||||
}
|
||||
}
|
||||
PIString typename_ = cd.left(6).trim();
|
||||
bool is_class = typename_ == s_class;
|
||||
Visibility vis = cur_def_vis;
|
||||
cur_def_vis = (is_class ? Private : Public);
|
||||
PIString cn = cd.mid(6).trim();
|
||||
bool is_anonymous = cn.isEmpty();
|
||||
Visibility vis = cur_def_vis;
|
||||
cur_def_vis = (is_class ? Private : Public);
|
||||
PIString cn = cd.mid(6).trim();
|
||||
bool is_anonymous = cn.isEmpty();
|
||||
if (cn.isEmpty()) cn = PIStringAscii("<unnamed_") + PIString::fromNumber(anon_num++) + '>';
|
||||
// piCout << "found " << typename_ << cn;
|
||||
Entity * e = new Entity();
|
||||
|
||||
Reference in New Issue
Block a user