Ejemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="parent">The parent of the new Generate Node to Create</param>
        /// <param name="pattern">The pattern to apply</param>
        /// <param name="variables">The Substitution variables</param>
        /// <param name="group">The Group ID</param>
        /// <param name="delimiter">Substitution variable delimiter</param>
        /// <param name="position">The Insertion position (index) as child in the Parent node</param>
        public Create(Node parent, TypeCobol.Codegen.Skeletons.Pattern pattern, Dictionary <string, object> variables, string group, string delimiter, int?position)
        {
            this.Parent = parent;
            if (group != null)
            {
                this.Group = new TypeCobol.Codegen.Skeletons.Templates.RazorEngine().Replace(group, variables, delimiter);
            }
            var solver = TypeCobol.Codegen.Skeletons.Templates.RazorEngine.Create(pattern.Template, variables, delimiter);

            this.Child = new GeneratedNode((TypeCobol.Codegen.Skeletons.Templates.RazorEngine)solver);
            if (pattern.NewLine)
            {
                this.Child.SetFlag(Node.Flag.FactoryGeneratedNodeWithFirstNewLine, true);
            }
            //Mark this node as has been generated by a factory creation mechanism.
            this.Child.SetFlag(Node.Flag.FactoryGeneratedNode, true);
            this.position = position;

            //This is a special case for issue :
            //Codegen for procedure : remove usage of external  #519
            if (pattern.Name != null && pattern.Name.Equals("ProcedureDivisionCalleeWithoutExternal"))
            {
                //look for the ProcedureDivision Node
                Node proc_parent = parent;
                while (!(proc_parent is TypeCobol.Compiler.Nodes.ProcedureDivision))
                {
                    proc_parent = proc_parent.Parent;
                }
                if (proc_parent != null)
                {
                    proc_parent.SetFlag(Node.Flag.ProcedureDivisionUsingPntTabPnt, true);
                    proc_parent.SetFlag(Node.Flag.ForceGetGeneratedLines, true);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="parent">The parent of the new Generate Node to Create</param>
        /// <param name="pattern">The pattern to apply</param>
        /// <param name="variables">The Substitution variables</param>
        /// <param name="group">The Group ID</param>
        /// <param name="delimiter">Substitution variable delimiter</param>
        /// <param name="position">The Insertion position (index) as child in the Parent node</param>
        public Create(Node parent, TypeCobol.Codegen.Skeletons.Pattern pattern, Dictionary <string, object> variables, string group, string delimiter, int?position)
        {
            this.Parent = parent;
            if (group != null)
            {
                this.Group = new TypeCobol.Codegen.Skeletons.Templates.RazorEngine().Replace(group, variables, delimiter);
            }
            var solver = TypeCobol.Codegen.Skeletons.Templates.RazorEngine.Create(pattern.Template, variables, delimiter);

            this.Child = new GeneratedNode((TypeCobol.Codegen.Skeletons.Templates.RazorEngine)solver);
            if (pattern.NewLine)
            {
                this.Child.SetFlag(Node.Flag.FactoryGeneratedNodeWithFirstNewLine, true);
            }
            //Mark this node as has been generated by a factory creation mechanism.
            this.Child.SetFlag(Node.Flag.FactoryGeneratedNode, true);
            this.position = position;
        }