finish codeparser improvements

pip_cmg now works with new nested entities approach
Getters now can access to bitfields
This commit is contained in:
2025-09-18 05:54:31 +03:00
parent af02684dc5
commit 7083b2c32b
15 changed files with 244 additions and 157 deletions

View File

@@ -67,7 +67,7 @@ bool writeModel(PICodeParser & parser,
if (getters) {
ts << "\n\n// Getter funtions\n";
for (const PICodeParser::Entity * e: parser.entities) {
if (!e->has_name || e->name.startsWith("_PI")) continue;
if (e->is_anonymous || e->name.startsWith("_PI")) continue;
makeGetterType(rt, e);
makeGetterValue(rt, e);
}
@@ -95,7 +95,7 @@ bool writeModel(PICodeParser & parser,
if (meta) {
ts << "\n\n// Classes\n";
for (const PICodeParser::Entity * e: parser.entities) {
if (e->name.startsWith("_PI")) continue;
if (e->name.startsWith("_PI") || e->is_anonymous) continue;
makeClassInfo(rt, e);
}
}
@@ -108,7 +108,7 @@ bool writeModel(PICodeParser & parser,
ts << "\n// Getters\n";
for (const PICodeParser::Entity * e: parser.entities) {
if (!needClassStream(e)) continue;
if (!e->has_name || e->name.startsWith("_PI")) continue;
if (e->is_anonymous || e->name.startsWith("_PI")) continue;
ts << "\tci_avf[\"" << e->name << "\"] = getterValue" << toCName(e->name) << ";\n";
ts << "\tci_atf[\"" << e->name << "\"] = getterType" << toCName(e->name) << ";\n";
}
@@ -125,7 +125,7 @@ bool writeModel(PICodeParser & parser,
if (meta) {
ts << "\n// Classes clean\n";
for (const PICodeParser::Entity * e: parser.entities) {
if (e->name.startsWith("_PI")) continue;
if (e->name.startsWith("_PI") || e->is_anonymous) continue;
ts << "\tpiDeleteSafety(ci_ci[\"" << e->name << "\"]);\n";
ts << "\tci_ins->classesInfo->remove(\"" << e->name << "\");\n";
}
@@ -143,7 +143,7 @@ bool writeModel(PICodeParser & parser,
ts << "\n// Getters clean\n";
for (const PICodeParser::Entity * e: parser.entities) {
if (!needClassStream(e)) continue;
if (!e->has_name || e->name.startsWith("_PI")) continue;
if (e->is_anonymous || e->name.startsWith("_PI")) continue;
ts << "\tci_avf.remove(\"" << e->name << "\");\n";
ts << "\tci_atf.remove(\"" << e->name << "\");\n";
}
@@ -173,7 +173,7 @@ bool writeModel(PICodeParser & parser,
if (streams) {
ts << "\n\n// Stream operators\n";
for (const PICodeParser::Entity * e: parser.entities) {
if (!e->has_name || e->name.startsWith("_PI") ||
if (e->is_anonymous || e->name.startsWith("_PI") ||
!(e->visibility == PICodeParser::Global || e->visibility == PICodeParser::Public))
continue;
if (!makeClassStream(rt, e)) return false;
@@ -182,7 +182,7 @@ bool writeModel(PICodeParser & parser,
if (json) {
ts << "\n\n// JSON serialization\n";
for (const PICodeParser::Entity * e: parser.entities) {
if (!e->has_name || e->name.startsWith("_PI") ||
if (e->is_anonymous || e->name.startsWith("_PI") ||
!(e->visibility == PICodeParser::Global || e->visibility == PICodeParser::Public))
continue;
if (!makeClassJSON(rt, e)) return false;