Example #1
0
        /// <summary>
        /// Génère les fichiers du projet à partir de la liste des instructions.
        /// </summary>
        public List <OutputFile> GenerateProjectFiles(List <Instruction> instructions, string outputDirectory, bool isServer)
        {
            List <OutputFile>  outputFiles = new List <OutputFile>();
            List <Instruction> enums       = new List <Instruction>();

            foreach (Model.Language.Instruction inst in instructions)
            {
                if (inst is Model.Language.ClassDeclaration)
                {
                    Model.Language.ClassDeclaration decl = (Model.Language.ClassDeclaration)inst;

                    outputFiles.Add(new OutputFile(outputDirectory + "/" + decl.Name + ".h",
                                                   GenerateInstruction(inst)));
                }
                else if (inst is Model.Language.EnumDeclaration)
                {
                    enums.Add(inst);
                }
                else
                {
                    m_project.Log.AddWarning("Instruction de type " + inst.GetType().ToString() + " inattendue.", inst.Line, inst.Character, inst.Source);
                }
            }

            // Génère le fichier des enums
            outputFiles.Add(new OutputFile(outputDirectory + "/Common.h", GenerateCommonFile(enums)));

            return(outputFiles);
        }
Example #2
0
        /// <summary>
        /// Génère les fichiers du projet à partir de la liste des instructions.
        /// </summary>
        public List <OutputFile> GenerateProjectFiles(List <Instruction> instructions, string outputDirectory, bool isServer)
        {
            List <OutputFile>  outputFiles = new List <OutputFile>();
            List <Instruction> enums       = new List <Instruction>();
            StringBuilder      b           = new StringBuilder();

            foreach (Model.Language.Instruction inst in instructions)
            {
                if (inst is Model.Language.ClassDeclaration)
                {
                    Model.Language.ClassDeclaration decl = (Model.Language.ClassDeclaration)inst;
                    b.AppendLine(GenerateYumlClass(decl));
                }
                else if (inst is Model.Language.EnumDeclaration)
                {
                    b.AppendLine("[" + ((Model.Language.EnumDeclaration)inst).Name + "{bg:green}]");
                }
                else
                {
                    m_project.Log.AddWarning("Instruction de type " + inst.GetType().ToString() + " inattendue.", inst.Line, inst.Character, inst.Source);
                }
            }

            // Génère le fichier des enums
            outputFiles.Add(new OutputFile(outputDirectory + "/diag.txt", b.ToString()));
            return(outputFiles);
        }