I have a somewhat global issue, I don’t know if someone can help me, I’m working on a big project with a somewhat old codebase, I’m trying to find a solution but I feel like there’s nothing on the internet that already exists / that suits me. My goal is to do variable traceability, I’ll explain a bit:
#include <iostream>
#include <map>
#include <string>
struct Variable {
std::map<std::string, Variable*> _mapXY;
};
int main() {
Variable* a = new Variable();
Variable* b = new Variable();
Variable* d = new Variable();
pgsql
Copier
Modifier
// b["b"] depends on a["e"]
b->_mapXY["b"] = a->_mapXY["e"];
// d["d"] depends on b["b"]
d->_mapXY["d"] = b->_mapXY["b"];
if (d->_mapXY["e"]) {
Variable* c = new Variable();
// c["c"] depends on d["d"]
// but c["c"] also depends on d["e"] because of the if
c->_mapXY["c"] = d->_mapXY["d"];
}
return 0;
}
I need to get as output,
Target column Column it depends on
b["b"] : a["e"]
d["d"] : b["b"]
Condition of the if → c->_mapXY["c"] depends on d["e"]
c["c"] : d["d"]
You have to imagine that there are complex cases with temporary variables etc.. I don’t know if there is a way to have some kind of dependency graph to know which map columns depend on which other map columns and do this automatically (there are 150 files to process, I want to avoid doing this work manually). Does anyone have an idea of something that exists, either at runtime or something external?
I’m testing syntax parsing with regex but it’s complicated because there are many different cases to take into