private void ClearTables()
 {
     OutputTokens.Clear();
     OutputIdentifiers.Clear();
     OutputConstants.Clear();
     OutputErrors.Clear();
 }
        private void ExecuteRun(object obj)
        {
            ClearTables();
            var output = lexer.Run(ProgramText);

            OutputTokens      = OutputTokens.CopyFrom(output.outputTokens);
            OutputIdentifiers = OutputIdentifiers.CopyFrom(output.outputIdentifiers);
            OutputConstants   = OutputConstants.CopyFrom(output.outoutConstans);
            OutputErrors      = OutputErrors.CopyFrom(output.errors, parser.Process(output.outputTokens));
            OutputText        = parser.Rezult;
        }
Exemple #3
0
        public Assembly Compile(string assemblyPath, OutputErrors renderErrors)
        {
            CompilerParameters options = new CompilerParameters();

            options.IncludeDebugInformation = false;
            options.GenerateExecutable      = false;
            options.GenerateInMemory        = (assemblyPath == null);

            foreach (string refAsm in listReferencedAssemblies)
            {
                options.ReferencedAssemblies.Add(refAsm);
            }
            if (assemblyPath != null)
            {
                options.OutputAssembly = assemblyPath.Replace('\\', '/');
            }

            CodeDomProvider codeProvider = Provider();

            CompilerResults results =
                codeProvider.CompileAssemblyFromDom(options, CompileUnit);

            codeProvider.Dispose();

            if (results.Errors.Count == 0)
            {
                return(results.CompiledAssembly);
            }


            renderErrors("Errors:");

            foreach (CompilerError err in results.Errors)
            {
                renderErrors(err.ToString());
            }

            return(null);
        }
Exemple #4
0
 public Assembly Compile(OutputErrors renderErrors)
 {
     return(Compile(null, renderErrors));
 }