public static SwapChildrenPosition ( Production parent, Node node1, Node node2 ) : void | ||
parent | Production | |
node1 | Node | |
node2 | Node | |
return | void |
public override Node ExitFunctionConstructorCallOrVariableDeclaration(Production node) { Token identifier = (Token)GrammaticaNodeUtils.FindChildOf(node, new string[2] { "Type", "IDENTIFIER" }); if (identifier == null) { return(node); } replaceIntrinsicFunc(identifier); // mul(term, term) => term * term if (identifier.GetImage().Equals("mul")) { identifier.AddValue(""); Node virgula = GrammaticaNodeUtils.FindChildOf(node, new string[2] { "PartOf_Constructor_Call", "COMMA" }); virgula.AddValue(" * "); } // cross(T,N) => cross(N,T). if (identifier.GetImage().Equals("cross")) { Production listOfParam = (Production)GrammaticaNodeUtils.FindChildOf(node, "PartOf_Constructor_Call"); Node exp1 = GrammaticaNodeUtils.FindChildOf(listOfParam, "Expression", 1); Node exp2 = GrammaticaNodeUtils.FindChildOf(listOfParam, "Expression", 2); GrammaticaNodeUtils.SwapChildrenPosition(listOfParam, exp1, exp2); } // add dependent function Node n = GrammaticaNodeUtils.FindChildOf(node, "PartOf_Constructor_Call"); if (n != null && identifier != null && functionScope != null) { // function call or constructor call. dependencyGraph.SearchDependant(identifier.GetImage()).AddCallsBy(functionScope); } // Adds only globalVars. if (!scopeVars.Contains(identifier.GetImage())) { dependencyGraph.SearchDependant(identifier.GetImage()).AddCallsBy(functionScope); } return(node); }