Commit bec7faa9 authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Fix graph call parsing

parent 73c3f866
Pipeline #117324 passed with stages
in 6 minutes and 45 seconds
...@@ -286,7 +286,7 @@ std::string graph_cpp_graphTokenToLanguageSourceCommandOneOf(const PGraphToken & ...@@ -286,7 +286,7 @@ std::string graph_cpp_graphTokenToLanguageSourceCommandOneOf(const PGraphToken &
const PVecInclude & vecPar = callToken.getVecLeftVar(); const PVecInclude & vecPar = callToken.getVecLeftVar();
if(vecPar.size() == 2lu){ if(vecPar.size() == 2lu){
body += indentation + "//repr_cpp_to_language : Convert command OneOf into a string\n"; body += indentation + "//repr_cpp_to_language : Convert command OneOf into a string\n";
body += indentation + "body += " + getTokenGetterCall(graphToken.getVarType(), vecPar.back(), graphToken.getVarName()) + vecPar.front() + " + \" \";\n"; body += indentation + "body += " + getTokenGetterCall(graphToken.getVarType(), vecPar.back(), graphToken.getVarName()) + " + \" \";\n";
} }
return body; return body;
} }
...@@ -301,8 +301,8 @@ std::string graph_cpp_graphTokenToLanguageSourceCommandCallGraph(const PGraphTok ...@@ -301,8 +301,8 @@ std::string graph_cpp_graphTokenToLanguageSourceCommandCallGraph(const PGraphTok
std::string body(""); std::string body("");
const PVecInclude & vecPar = callToken.getVecLeftVar(); const PVecInclude & vecPar = callToken.getVecLeftVar();
if(vecPar.size() == 2lu){ if(vecPar.size() == 2lu){
body += indentation + "//repr_cpp_to_language : Convert command Call Graph into a string\n"; body += indentation + "//repr_cpp_to_language : Convert command Call Graph into a string, vecPar.front() = '"+vecPar.front()+"'\n";
body += indentation + "body += "+ callToken.getRightFctCallName()+"(" + getTokenGetterCall(graphToken.getVarType(), vecPar.back(), vecPar.front()) + vecPar.front() + ") + \" \";\n"; body += indentation + "body += "+ callToken.getRightFctCallName()+"(" + getTokenGetterCall(graphToken.getVarType(), vecPar.back(), vecPar.front()) + ") + \" \";\n";
} }
return body; return body;
} }
......
...@@ -389,7 +389,9 @@ std::string repr_cpp_tokenFunctionSourceDoCommandCallGraph(const PTabGraphToken ...@@ -389,7 +389,9 @@ std::string repr_cpp_tokenFunctionSourceDoCommandCallGraph(const PTabGraphToken
std::string firstTokenFunction(calleeGraph->getName()); std::string firstTokenFunction(calleeGraph->getName());
const PVecInclude & vecPar = callToken.getVecLeftVar(); const PVecInclude & vecPar = callToken.getVecLeftVar();
std::string parameterCall(getVectorParameterCall(vecPar)); getVectorParameterCall(vecPar);
// std::string parameterCall(getVectorParameterCall(vecPar));
std::string parameterCall(getTokenGetterCall(graph.getVarType(), vecPar.back(), vecPar.front()));
body += "\tif(!"+firstTokenFunction+"(" + parameterCall+")){\t//The call graph don't have undo function\n"; body += "\tif(!"+firstTokenFunction+"(" + parameterCall+")){\t//The call graph don't have undo function\n";
// body += "\t\t"+firstTokenFunction+"Undo("+parameterCall+");\n"; // body += "\t\t"+firstTokenFunction+"Undo("+parameterCall+");\n";
......
...@@ -550,7 +550,9 @@ bool PGraphParser::parseAttributeFunction(PCallToken & callToken){ ...@@ -550,7 +550,9 @@ bool PGraphParser::parseAttributeFunction(PCallToken & callToken){
* @return true on success, false otherwise * @return true on success, false otherwise
*/ */
bool PGraphParser::parseCallGraph(PCallToken & callToken, const std::string & graphName){ bool PGraphParser::parseCallGraph(PCallToken & callToken, const std::string & graphName){
std::cerr << "PGraphParser::parseCallGraph : Try to find CallGraph '"<<graphName<<"'" << std::endl;
if(!findInListString(p_listGraphName, graphName)){return false;} if(!findInListString(p_listGraphName, graphName)){return false;}
std::cerr << "PGraphParser::parseCallGraph : CallGraph '"<<graphName<<"' found" << std::endl;
callToken.setRightFctCallName(graphName); callToken.setRightFctCallName(graphName);
if(!checkExprectedMatch("(", graphName)) return false; if(!checkExprectedMatch("(", graphName)) return false;
if(!checkExprectedMatch(")", graphName + "(")) return false; if(!checkExprectedMatch(")", graphName + "(")) return false;
...@@ -635,7 +637,8 @@ bool PGraphParser::parseToken(PToken & token){ ...@@ -635,7 +637,8 @@ bool PGraphParser::parseToken(PToken & token){
//I use the graph variable //I use the graph variable
token.setType(PTokenType::COMMAND); token.setType(PTokenType::COMMAND);
PCallToken & callToken = token.getCommand(); PCallToken & callToken = token.getCommand();
std::string varName(getStrComposedOf(p_charsetName)); std::string varName(p_currentGraphToken.getVarName());
std::cerr << "PGraphParser::parseToken : start varName call '"<<varName<<"'" << std::endl;
callToken.getVecLeftVar().push_back(varName); callToken.getVecLeftVar().push_back(varName);
if(isMatch(".")){ //for "var.attr" or just "var" if isMatch is wrong if(isMatch(".")){ //for "var.attr" or just "var" if isMatch is wrong
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment