Exemplo n.º 1
0
 public void UnionWith(VarInfoContainer container)
 {
     foreach (SemanticTree.IConstantDefinitionNode node in container.Constants)
         if (!Constants.Contains(node))
             Constants.Add(node);
     foreach (SemanticTree.IVAriableDefinitionNode node in container.SharedVariables)
         if (!SharedVariables.Contains(node))
             SharedVariables.Add(node);
     foreach (SemanticTree.IVAriableDefinitionNode node in container.PrivateVariables)
         if (!PrivateVariables.Contains(node))
             PrivateVariables.Add(node);
     for (int i = 0; i < container.ReductionVariables.Count; ++i )
         if (!ReductionVariables.Contains(container.ReductionVariables[i]))
         {
             ReductionVariables.Add(container.ReductionVariables[i]);
             ReductionActions.Add(container.ReductionActions[i]);
         }
 }
Exemplo n.º 2
0
        private static VarInfoContainer GetVarInfoContainer(VarFinderSyntaxVisitor VFVis, List<ReductionDirective> Reductions, List<string> PrivateVars, syntax_tree_visitor visitor, SyntaxTree.compiler_directive dir)
        {
            if (Reductions == null)
                Reductions = new List<ReductionDirective>();
            if (PrivateVars == null)
                PrivateVars = new List<string>();
            VarInfoContainer Result = new VarInfoContainer();

            //константы копируются сразу
            Result.Constants = VFVis.Constants;

            //список переменных для редукции
            //ищем переменные с такими именами, проверяем их наличие, тип и если все хорошо - добавляем в список
            foreach (ReductionDirective rd in Reductions)
                foreach (string rdVarName in rd.variables)
                {
                    if (LoopVariables.Contains(rdVarName))
                    {
                        visitor.AddWarning(new PascalABCCompiler.Errors.CommonWarning(String.Format(PascalABCCompiler.StringResources.Get("OMPERROR_REDUCTION_WITH_LOOPVAR_{0}"), rdVarName), visitor.CurrentDocument.file_name, dir.source_context.begin_position.line_num, dir.source_context.begin_position.column_num));
                        continue;
                    }
                    SymbolInfo si = visitor.context.find(rdVarName);
                    if (si == null)
                    {
                        visitor.AddWarning(new PascalABCCompiler.Errors.CommonWarning(String.Format(PascalABCCompiler.StringResources.Get("OMPERROR_UNKNOWN_VARNAME_{0}"), rdVarName), visitor.CurrentDocument.file_name, dir.source_context.begin_position.line_num, dir.source_context.begin_position.column_num));
                        continue;
                    }
                    if (!(si.sym_info is SemanticTree.IVAriableDefinitionNode))
                    {
                        visitor.AddWarning(new PascalABCCompiler.Errors.CommonWarning(String.Format(PascalABCCompiler.StringResources.Get("OMPERROR_NAME_IS_NOT_VAR_{0}"), rdVarName), visitor.CurrentDocument.file_name, dir.source_context.begin_position.line_num, dir.source_context.begin_position.column_num));
                        continue;
                    }
                    if (!IsValidVarForReduction(si.sym_info as SemanticTree.IVAriableDefinitionNode))
                    {
                        visitor.AddWarning(new PascalABCCompiler.Errors.CommonWarning(String.Format(PascalABCCompiler.StringResources.Get("OMPERROR_IS_NOT_POSSIBLE_REDUCTION_WITH_THIS_VAR_{0}"), rdVarName), visitor.CurrentDocument.file_name, dir.source_context.begin_position.line_num, dir.source_context.begin_position.column_num));
                        continue;
                    }
                    Result.ReductionVariables.Add(si.sym_info as SemanticTree.IVAriableDefinitionNode);
                    Result.ReductionActions.Add(rd.Oper);
                    //for (int i = 0; i < VFVis.Variables.Count; ++i)
                    //    if (VFVis.Variables[i].name.ToLower() == rdVarName.ToLower())
                    //    {
                    //        Result.ReductionVariables.Add(VFVis.Variables[i]);
                    //        Result.ReductionActions.Add(rd.Oper);
                    //        break;
                    //    }
                }

            //приватные переменные - аналогично, но без проверки на тип
            foreach (string privateVar in PrivateVars)
            {
                SymbolInfo si = visitor.context.find(privateVar);
                if (si == null)
                {
                    visitor.AddWarning(new PascalABCCompiler.Errors.CommonWarning(String.Format(PascalABCCompiler.StringResources.Get("OMPERROR_UNKNOWN_VARNAME_{0}"), privateVar), visitor.CurrentDocument.file_name, dir.source_context.begin_position.line_num, dir.source_context.begin_position.column_num));
                    continue;
                }
                if (!(si.sym_info is SemanticTree.IVAriableDefinitionNode))
                {
                    visitor.AddWarning(new PascalABCCompiler.Errors.CommonWarning(String.Format(PascalABCCompiler.StringResources.Get("OMPERROR_NAME_IS_NOT_VAR_{0}"), privateVar), visitor.CurrentDocument.file_name, dir.source_context.begin_position.line_num, dir.source_context.begin_position.column_num));
                    continue;
                }
                Result.PrivateVariables.Add(si.sym_info as SemanticTree.IVAriableDefinitionNode);
            }

            //по всем переменным:
            //если она не приватная и по ней нет редукции - переписываем ее в список разделяемых
            foreach (SemanticTree.IVAriableDefinitionNode var in VFVis.Variables)
            {
                bool NotShared = false;
                foreach (SemanticTree.IVAriableDefinitionNode rdn in Result.ReductionVariables)
                    if (rdn.name.ToLower() == var.name.ToLower())
                    {
                        NotShared = true;
                        break;
                    }
                if (!NotShared)
                    foreach (SemanticTree.IVAriableDefinitionNode prVar in Result.PrivateVariables)
                        if (prVar.name.ToLower() == var.name.ToLower())
                        {
                            NotShared = true;
                            break;
                        }
                if (!NotShared)
                    Result.SharedVariables.Add(var);
            }

            return Result;
        }
Exemplo n.º 3
0
        private static SyntaxTree.statement_list CreateFinalPart(string ObjName, VarInfoContainer Vars)
        {
            SyntaxTree.statement_list stl = new PascalABCCompiler.SyntaxTree.statement_list();

            //создаем присваивания разделяемым переменным
            for (int i = 0; i < Vars.SharedVariables.Count; ++i)
            {
                string VarName = Vars.SharedVariables[i].name;
                if (LoopVariables.Contains(VarName.ToLower()))
                    continue;

                SyntaxTree.dot_node DotNode = new PascalABCCompiler.SyntaxTree.dot_node();
                DotNode.left = new SyntaxTree.ident(ObjName);
                DotNode.right = new SyntaxTree.ident(VarName);

                SyntaxTree.array_type arrType = ConvertToSyntaxType(Vars.SharedVariables[i].type as type_node) as SyntaxTree.array_type;
                if (arrType != null && !is_dyn_arr(arrType))
                {
                    stl.subnodes.Add(AssignArrs(arrType, DotNode, new SyntaxTree.ident(VarName)));
                }
                else
                {
                    SyntaxTree.assign Assign = new PascalABCCompiler.SyntaxTree.assign();
                    Assign.operator_type = PascalABCCompiler.SyntaxTree.Operators.Assignment;
                    Assign.to = new SyntaxTree.ident(VarName);
                    Assign.from = DotNode;
                    stl.subnodes.Add(Assign);
                }

            }

            //создаем присваивания переменным редукции
            for (int i = 0; i < Vars.ReductionVariables.Count; ++i)
            {
                string VarName = Vars.ReductionVariables[i].name;

                SyntaxTree.dot_node DotNode = new PascalABCCompiler.SyntaxTree.dot_node();
                DotNode.left = new SyntaxTree.ident(ObjName);
                DotNode.right = new SyntaxTree.ident("$" + VarName);

                SyntaxTree.array_type arrType = ConvertToSyntaxType(Vars.ReductionVariables[i].type as type_node) as SyntaxTree.array_type;
                if (arrType != null && !is_dyn_arr(arrType))
                {
                    stl.subnodes.Add(AssignArrs(arrType, DotNode, new SyntaxTree.ident(VarName)));
                }
                else
                {
                    SyntaxTree.assign Assign = new PascalABCCompiler.SyntaxTree.assign();
                    Assign.operator_type = PascalABCCompiler.SyntaxTree.Operators.Assignment;
                    Assign.to = new SyntaxTree.ident(VarName);
                    Assign.from = DotNode;
                    stl.subnodes.Add(Assign);
                }
            }

            return stl;
        }
Exemplo n.º 4
0
        private static SyntaxTree.statement_list CreateInitPart(string ClassName, string ObjName, VarInfoContainer Vars)
        {
            SyntaxTree.statement_list stl = new PascalABCCompiler.SyntaxTree.statement_list();

            //Var Statement - объявление экземпляра обьекта-функции
            SyntaxTree.var_statement ClassVar = new PascalABCCompiler.SyntaxTree.var_statement();
            stl.subnodes.Add(ClassVar);
            SyntaxTree.var_def_statement ClassVarDef = new PascalABCCompiler.SyntaxTree.var_def_statement();
            ClassVar.var_def = ClassVarDef;
            SyntaxTree.ident_list ClassIdl = new PascalABCCompiler.SyntaxTree.ident_list();
            ClassVarDef.vars = ClassIdl;
            ClassIdl.idents.Add(new PascalABCCompiler.SyntaxTree.ident(ObjName));
            SyntaxTree.named_type_reference ClassTypeNTR = new PascalABCCompiler.SyntaxTree.named_type_reference();
            ClassVarDef.vars_type = ClassTypeNTR;
            ClassTypeNTR.names.Add(new PascalABCCompiler.SyntaxTree.ident(ClassName));
            SyntaxTree.new_expr ClassInitNE = new PascalABCCompiler.SyntaxTree.new_expr();
            ClassVarDef.inital_value = ClassInitNE;
            SyntaxTree.named_type_reference ClassInitNTR = new PascalABCCompiler.SyntaxTree.named_type_reference();
            ClassInitNE.type = ClassInitNTR;
            ClassInitNTR.names.Add(new PascalABCCompiler.SyntaxTree.ident(ClassName));

            //создаем присваивания разделяемым переменным
            for (int i = 0; i < Vars.SharedVariables.Count; ++i)
            {
                string VarName = Vars.SharedVariables[i].name;

                SyntaxTree.dot_node DotNode = new PascalABCCompiler.SyntaxTree.dot_node();
                DotNode.left = new SyntaxTree.ident(ObjName);
                DotNode.right = new SyntaxTree.ident(VarName);

                SyntaxTree.array_type arrType = ConvertToSyntaxType(Vars.SharedVariables[i].type as type_node) as SyntaxTree.array_type;
                if (arrType != null && !is_dyn_arr(arrType))
                {
                    stl.subnodes.Add(AssignArrs(arrType, new SyntaxTree.ident(VarName), DotNode));
                }
                else
                {
                    SyntaxTree.assign Assign = new PascalABCCompiler.SyntaxTree.assign();
                    Assign.operator_type = PascalABCCompiler.SyntaxTree.Operators.Assignment;
                    Assign.from = new SyntaxTree.ident(VarName);
                    Assign.to = DotNode;
                    stl.subnodes.Add(Assign);
                }
            }
            //создаем присваивания переменным редукции
            for (int i = 0; i < Vars.ReductionVariables.Count; ++i)
            {
                string VarName = Vars.ReductionVariables[i].name;

                SyntaxTree.dot_node DotNode = new PascalABCCompiler.SyntaxTree.dot_node();
                DotNode.left = new SyntaxTree.ident(ObjName);
                DotNode.right = new SyntaxTree.ident("$" + VarName);

                SyntaxTree.array_type arrType = ConvertToSyntaxType(Vars.ReductionVariables[i].type as type_node) as SyntaxTree.array_type;
                if (arrType != null && !is_dyn_arr(arrType))
                {
                    stl.subnodes.Add(AssignArrs(arrType, new SyntaxTree.ident(VarName), DotNode));
                }
                else
                {
                    SyntaxTree.assign Assign = new PascalABCCompiler.SyntaxTree.assign();
                    Assign.operator_type = PascalABCCompiler.SyntaxTree.Operators.Assignment;
                    Assign.from = new SyntaxTree.ident(VarName);
                    Assign.to = DotNode;
                    stl.subnodes.Add(Assign);
                }
            }
            return stl;
        }
Exemplo n.º 5
0
        private static SyntaxTree.procedure_definition CreateMethod(string MethodName, SyntaxTree.statement Body, string LoopVariableName, SyntaxTree.class_members ClassMember, VarInfoContainer Vars)
        {
            //  генерация метода
            SyntaxTree.procedure_definition ProcDef = new PascalABCCompiler.SyntaxTree.procedure_definition();
            //ClassMember.members.Add(ProcDef);
            SyntaxTree.procedure_header ProcHead = new PascalABCCompiler.SyntaxTree.procedure_header();
            ProcDef.proc_header = ProcHead;
            ProcHead.name = new PascalABCCompiler.SyntaxTree.method_name(null, null, new PascalABCCompiler.SyntaxTree.ident(MethodName), null);
            if (LoopVariableName != "")
            {
                //  параметр, счетчик цикла
                string ParamType = "integer";
                SyntaxTree.formal_parameters FormalParams = new PascalABCCompiler.SyntaxTree.formal_parameters();
                ProcHead.parameters = FormalParams;
                SyntaxTree.typed_parameters TypedParams = new PascalABCCompiler.SyntaxTree.typed_parameters();
                FormalParams.params_list.Add(TypedParams);
                SyntaxTree.ident_list idl = new PascalABCCompiler.SyntaxTree.ident_list();
                TypedParams.idents = idl;
                idl.Add(new SyntaxTree.ident(LoopVariableName));
                SyntaxTree.named_type_reference ntr = new PascalABCCompiler.SyntaxTree.named_type_reference();
                TypedParams.vars_type = ntr;
                ntr.Add(new SyntaxTree.ident(ParamType));
            }

            SyntaxTree.block ProcBlock = new PascalABCCompiler.SyntaxTree.block();
            ProcDef.proc_body = ProcBlock;
            ProcBlock.defs = new PascalABCCompiler.SyntaxTree.declarations();
            if (Vars.Constants.Count > 0)
            {
                SyntaxTree.consts_definitions_list cdl = new PascalABCCompiler.SyntaxTree.consts_definitions_list();
                ProcBlock.defs.defs.Add(cdl);
                //  константы - в методе
                for (int i = 0; i < Vars.Constants.Count; ++i)
                    cdl.Add(CreateClassMember(Vars.Constants[i], "") as SyntaxTree.typed_const_definition);
            }
            if ((Vars.ReductionVariables.Count > 0) || (Vars.PrivateVariables.Count > 0))
            {
                //  переменные редукции - в методе тоже, но без префикса
                SyntaxTree.variable_definitions vds = new PascalABCCompiler.SyntaxTree.variable_definitions();
                ProcBlock.defs.defs.Add(vds);
                for (int i = 0; i < Vars.ReductionVariables.Count; ++i)
                    vds.Add(CreateClassMember(Vars.ReductionVariables[i], "") as SyntaxTree.var_def_statement);
                //  и приватные переменные
                for (int i = 0; i < Vars.PrivateVariables.Count; ++i)
                    vds.Add(CreateClassMember(Vars.PrivateVariables[i], "") as SyntaxTree.var_def_statement);
            }

            if (Body is SyntaxTree.statement_list)
                ProcBlock.program_code = Body as SyntaxTree.statement_list;
            else
            {
                SyntaxTree.statement_list stl = new PascalABCCompiler.SyntaxTree.statement_list();
                stl.subnodes.Add(Body);
                ProcBlock.program_code = stl;
            }

            //присваивания для переменных редукции
            if (Vars.ReductionVariables.Count > 0)
            {
                SyntaxTree.statement_list LoopBodyInit = new PascalABCCompiler.SyntaxTree.statement_list();
                SyntaxTree.statement_list LoopBodyFinal = new PascalABCCompiler.SyntaxTree.statement_list();

                for (int i = 0; i < Vars.ReductionVariables.Count; ++i)
                {
                    //присваивание начального значения
                    SyntaxTree.assign Assign = new PascalABCCompiler.SyntaxTree.assign();
                    Assign.operator_type = PascalABCCompiler.SyntaxTree.Operators.Assignment;
                    Assign.to = new SyntaxTree.ident(Vars.ReductionVariables[i].name);
                    bool isBool = Vars.ReductionVariables[i].type.name.ToLower() == "boolean";
                    switch (Vars.ReductionActions[i])
                    {
                        case ReductionOperations.and:
                            {
                                if (isBool)
                                    Assign.from = new SyntaxTree.bool_const(true);
                                else
                                {
                                    //отрицание нуля
                                    Assign.from = new SyntaxTree.int32_const(0);
                                    LoopBodyInit.subnodes.Add(Assign);
                                    Assign = new PascalABCCompiler.SyntaxTree.assign();
                                    Assign.operator_type = PascalABCCompiler.SyntaxTree.Operators.Assignment;
                                    Assign.to = new SyntaxTree.ident(Vars.ReductionVariables[i].name);
                                    SyntaxTree.un_expr ue = new PascalABCCompiler.SyntaxTree.un_expr();
                                    ue.operation_type = PascalABCCompiler.SyntaxTree.Operators.LogicalNOT;
                                    ue.subnode = new SyntaxTree.ident(Vars.ReductionVariables[i].name);
                                    Assign.from = ue;
                                }
                                break;
                            }
                        case ReductionOperations.or:
                            if (isBool)
                                Assign.from = new SyntaxTree.bool_const(false);
                            else
                            {
                                Assign.from = new SyntaxTree.int32_const(0);
                            }
                            break;
                        case ReductionOperations.xor:  //
                        case ReductionOperations.plus: //см следующую ветку
                        case ReductionOperations.minus: Assign.from = new SyntaxTree.int32_const(0); break;
                        case ReductionOperations.mult: Assign.from = new SyntaxTree.int32_const(1); break;
                    }
                    LoopBodyInit.Add(Assign);

                    //присваивание после итерации
                    Assign = new PascalABCCompiler.SyntaxTree.assign();
                    Assign.operator_type = PascalABCCompiler.SyntaxTree.Operators.Assignment;
                    Assign.to = new SyntaxTree.ident("$" + Vars.ReductionVariables[i].name);
                    SyntaxTree.bin_expr From = new PascalABCCompiler.SyntaxTree.bin_expr();
                    From.left = new SyntaxTree.ident("$" + Vars.ReductionVariables[i].name);
                    From.right = new SyntaxTree.ident(Vars.ReductionVariables[i].name);
                    Assign.from = From;
                    switch (Vars.ReductionActions[i])
                    {
                        case ReductionOperations.and: From.operation_type = PascalABCCompiler.SyntaxTree.Operators.LogicalAND; break;
                        case ReductionOperations.or: From.operation_type = PascalABCCompiler.SyntaxTree.Operators.LogicalOR; break;
                        case ReductionOperations.xor: From.operation_type = PascalABCCompiler.SyntaxTree.Operators.BitwiseXOR; break;
                        case ReductionOperations.plus: From.operation_type = PascalABCCompiler.SyntaxTree.Operators.Plus; break;
                        case ReductionOperations.minus: From.operation_type = PascalABCCompiler.SyntaxTree.Operators.Minus; break;
                        case ReductionOperations.mult: From.operation_type = PascalABCCompiler.SyntaxTree.Operators.Multiplication; break;
                    }
                    LoopBodyFinal.Add(Assign);
                }

                //создаем обьект для блокировки в классе
                SyntaxTree.var_def_statement Lvds = new PascalABCCompiler.SyntaxTree.var_def_statement();
                SyntaxTree.ident_list Lidl = new PascalABCCompiler.SyntaxTree.ident_list();
                Lvds.vars = Lidl;
                Lidl.Add(new SyntaxTree.ident("$ReductionLock"));
                SyntaxTree.named_type_reference Lntr = new PascalABCCompiler.SyntaxTree.named_type_reference();
                Lvds.vars_type = Lntr;
                Lntr.Add(new SyntaxTree.ident("object"));
                SyntaxTree.new_expr Lne = new PascalABCCompiler.SyntaxTree.new_expr();
                Lvds.inital_value = Lne;
                Lne.type = Lntr;
                ClassMember.members.Add(Lvds);

                //создаем lock Statement на обьекте с присваиваниями в конце итерации
                SyntaxTree.lock_stmt reductionLock = new PascalABCCompiler.SyntaxTree.lock_stmt();
                reductionLock.lock_object = new SyntaxTree.ident("$ReductionLock");
                reductionLock.stmt = LoopBodyFinal;

                //собираем все вместе и присваиваем это телу процедуры
                LoopBodyInit.subnodes.AddRange(ProcBlock.program_code.subnodes);
                LoopBodyInit.subnodes.Add(reductionLock);
                ProcBlock.program_code = LoopBodyInit;
            }
            return ProcDef;
        }
Exemplo n.º 6
0
        private static SyntaxTree.type_declarations CreateClass(string ClassName,out SyntaxTree.class_members ClassMember, VarInfoContainer Vars)
        {
            //генерация класса
            SyntaxTree.type_declarations TypeDecls = new PascalABCCompiler.SyntaxTree.type_declarations();
            SyntaxTree.type_declaration TypeDecl = new PascalABCCompiler.SyntaxTree.type_declaration();
            TypeDecls.types_decl.Add(TypeDecl);
            TypeDecl.type_name = new PascalABCCompiler.SyntaxTree.ident(ClassName);
            SyntaxTree.class_definition ClassDef = new PascalABCCompiler.SyntaxTree.class_definition();
            TypeDecl.type_def = ClassDef;
            SyntaxTree.class_body ClassBody = new PascalABCCompiler.SyntaxTree.class_body();
            ClassDef.body = ClassBody;
            ClassMember = new PascalABCCompiler.SyntaxTree.class_members();
            ClassBody.class_def_blocks.Add(ClassMember);
            ClassMember.access_mod = new PascalABCCompiler.SyntaxTree.access_modifer_node(PascalABCCompiler.SyntaxTree.access_modifer.public_modifer);

            //  генерация полей класса
            //  shared переменные
            for (int i = 0; i < Vars.SharedVariables.Count; ++i)
                ClassMember.members.Add(CreateClassMember(Vars.SharedVariables[i], ""));
            //  переменные редукции - с долларовым префиксом
            for (int i = 0; i < Vars.ReductionVariables.Count; ++i)
                ClassMember.members.Add(CreateClassMember(Vars.ReductionVariables[i], "$"));

            
            return TypeDecls;
        }
Exemplo n.º 7
0
        private static bool GenerateOMPParallelSectionsCall(statements_list stmts, SyntaxTree.statement_list syntax_stmts, statements_list omp_stmts, syntax_tree_visitor syntax_tree_visitor)
        {

            SyntaxTree.expression_list delegates = new PascalABCCompiler.SyntaxTree.expression_list();
            SyntaxTree.statement_list stlInit = new PascalABCCompiler.SyntaxTree.statement_list();
            SyntaxTree.statement_list stlFinal = new PascalABCCompiler.SyntaxTree.statement_list();
            VarInfoContainer Vars = new VarInfoContainer();
            string ClassName = syntax_tree_visitor.context.get_free_name("$section_class{0}");
            List<SyntaxTree.statement> Sections = new List<PascalABCCompiler.SyntaxTree.statement>();
            foreach (SyntaxTree.statement syntax_statement in syntax_stmts.subnodes)
            {
                if (syntax_statement is SyntaxTree.empty_statement)
                    continue;       //А зачем? ;-)
                if (syntax_statement is SyntaxTree.var_statement)
                {
                    //выдать предупреждение. Это не нормально для параллельных секций
                    syntax_tree_visitor.visit(syntax_statement as SyntaxTree.var_statement);
                }
                else
                {
                    //ищем используемые переменные
                    VarFinderSyntaxVisitor VFvis = new VarFinderSyntaxVisitor(syntax_statement, syntax_tree_visitor.context, false);
                    SyntaxTree.compiler_directive dir = syntax_tree_visitor.DirectivesToNodesLinks[syntax_stmts];
                    
                    //if (DirInfosTable[dir].ErrorName == "WARNING_IN_CLAUSE_PARAMETERS_REPEATED_VARS")
                    //    syntax_tree_visitor.AddWarning(new Errors.CommonWarning(StringResources.Get(DirInfosTable[dir].ErrorName), syntax_stmts.source_context.FileName, DirInfosTable[dir].SC.begin_position.line_num, DirInfosTable[dir].SC.begin_position.column_num));
                    //else if (DirInfosTable[dir].ErrorName == "ERROR_IN_CLAUSE_PARAMETERS")
                    //{
                    //    syntax_tree_visitor.AddWarning(new Errors.CommonWarning(StringResources.Get(DirInfosTable[dir].ErrorName), syntax_stmts.source_context.FileName, DirInfosTable[dir].SC.begin_position.line_num, DirInfosTable[dir].SC.begin_position.column_num));
                    //}
                    //else
                    if (DirInfosTable[dir].ErrorName != null)
                    {
                        syntax_tree_visitor.AddWarning(new Errors.CommonWarning(PascalABCCompiler.StringResources.Get(DirInfosTable[dir].ErrorName), syntax_stmts.source_context.FileName, DirInfosTable[dir].SC.begin_position.line_num, DirInfosTable[dir].SC.begin_position.column_num));
                    }
                    Vars.UnionWith(GetVarInfoContainer(VFvis, null, DirInfosTable[dir].Privates, syntax_tree_visitor, dir));
                    Sections.Add(syntax_statement);
                }
            }
            //сохраняем контекст
            ContextInfo contextInfo = new ContextInfo(syntax_tree_visitor);

            try
            {
                //создание и конвертирование класса
                SyntaxTree.class_members member;
                SyntaxTree.type_declarations Decls = CreateClass(ClassName, out member, Vars);
                for (int i = 0; i < Sections.Count; ++i)
                    member.members.Add(CreateMethod("method" + i.ToString(), Sections[i], "", member, Vars));
                syntax_tree_visitor.visit(Decls);
            }
            finally
            {
                //восстанавливаем контекст
                contextInfo.RestoreContext(syntax_tree_visitor);
            }
            //создаем инициализацию и финализацию
            int NameNum = 0;
            string ObjName = GetFreeName("$section_obj", ref NameNum, syntax_tree_visitor.context);

            stlInit.subnodes.AddRange(CreateInitPart(ClassName, ObjName, Vars).subnodes);
            stlFinal.subnodes.AddRange(CreateFinalPart(ObjName, Vars).subnodes);

            SyntaxTree.procedure_call pc = new PascalABCCompiler.SyntaxTree.procedure_call();
            SyntaxTree.method_call mc = new PascalABCCompiler.SyntaxTree.method_call();
            mc.dereferencing_value = CreateTPLFunctionReference("Invoke");
            pc.func_name = mc;
            SyntaxTree.expression_list exl = new PascalABCCompiler.SyntaxTree.expression_list();
            //foreach (string str in ObjNames)
            for (int i=0; i<Sections.Count; ++i)
                exl.Add(new SyntaxTree.dot_node(new SyntaxTree.ident(ObjName), new SyntaxTree.ident("Method"+i.ToString())));
            mc.parameters = exl;

            stlInit.subnodes.Add(CreateNestedRegionBorder(true));
            stlInit.subnodes.Add(pc);
            stlInit.subnodes.AddRange(stlFinal.subnodes);
            stlInit.subnodes.Add(CreateNestedRegionBorder(false));

            statement_node st = syntax_tree_visitor.ret.visit(stlInit);
            omp_stmts.statements.AddElement(st);
            return true;
        }