/// <summary> /// Build the Dictionary that associate a token of an index-name-1 to its hash + name. /// </summary> /// <param name="indexes">The Array of Index Symbol Definition</param> /// <param name="ownerDefinition">The Owner of the definition that contains the INDEXED BY clause</param> /// <returns>The Dictionary</returns> private static Dictionary <Compiler.Scanner.Token, string> BuiltIndexMap(Node rootNode, List <string> rootProcedures, List <Tuple <string, string> > rootVariableName, SymbolDefinition[] indexes, TypeCobol.Compiler.Nodes.DataDefinition ownerDefinition) { Dictionary <Compiler.Scanner.Token, string> map = new Dictionary <Compiler.Scanner.Token, string>(indexes.Length); List <string> pathProcedures; List <string> pathVariables; GeneratorHelper.ComputeProperPaths(ownerDefinition, out pathProcedures, out pathVariables); List <string> list_items = new List <string>(); //list_items.AddRange(pathProcedures); //Add root procedures for (int j = rootProcedures.Count - 1; j >= 0; j--) { list_items.Add(rootProcedures[j]); } //Add Root variables for (int j = rootVariableName.Count - 1; j >= 0; j--) { list_items.Add(rootVariableName[j].Item1); if (j != 0 && rootVariableName[j].Item2 != null && rootVariableName[j].Item2.Trim().Length > 0) { list_items.Add(rootVariableName[j].Item2); } } list_items.AddRange(pathVariables); string qn = string.Join(".", list_items.ToArray()); AddIndexMap(rootNode, rootNode.QualifiedName.ToString(), indexes, map); AddIndexMap(ownerDefinition, qn, indexes, map); return(map); }
/// <summary> /// Build the Dictionary that associate a token of an index-name-1 to its hash + name. /// </summary> /// <param name="indexes">The Array of Index Symbol Definition</param> /// <param name="ownerDefinition">The Owner of the definition that contains the INDEXED BY clause</param> /// <returns>The Dictionary</returns> private static Dictionary <Compiler.Scanner.Token, string> BuiltIndexMap(List <string> rootProcedures, List <Tuple <string, string> > rootVariableName, SymbolDefinition[] indexes, TypeCobol.Compiler.Nodes.DataDefinition ownerDefinition) { Dictionary <Compiler.Scanner.Token, string> map = new Dictionary <Compiler.Scanner.Token, string>(indexes.Length); List <string> pathProcedures; List <string> pathVariables; GeneratorHelper.ComputeProperPaths(ownerDefinition, out pathProcedures, out pathVariables); List <string> list_items = new List <string>(); //list_items.AddRange(pathProcedures); //Add root procedures for (int j = rootProcedures.Count - 1; j >= 0; j--) { list_items.Add(rootProcedures[j]); } //Add Root variables for (int j = rootVariableName.Count - 1; j >= 0; j--) { list_items.Add(rootVariableName[j].Item1); if (j != 0 && rootVariableName[j].Item2 != null && rootVariableName[j].Item2.Trim().Length > 0) { list_items.Add(rootVariableName[j].Item2); } } list_items.AddRange(pathVariables); string qn = string.Join(".", list_items.ToArray()); foreach (Node child in ownerDefinition.Children) { if (child is IndexDefinition) { IndexDefinition index = child as IndexDefinition; foreach (SymbolDefinition sym in indexes) { if (sym.Name.Equals(index.Name)) { string qualified_name = qn + '.' + index.Name; string hash_name = GeneratorHelper.ComputeIndexHashName(qualified_name, ownerDefinition); map[sym.NameLiteral.Token] = hash_name; } } } } return(map); }