Esempio n. 1
0
        private CodeCompileUnit[] GetCompileUnits()
        {
            var compileUnits = new List<CodeCompileUnit>();
            foreach (var source in _sources)
            {
                var parser = new CodeParser(source);
                var ast = parser.Parse();
                if (parser.Errors.Any()) //antlr parse errors
                    Errors.AddRange(parser.Errors);

                if (!Errors.Any())
                {
                    var generator = new CodeDomGenerator(ast);
                    compileUnits.Add(generator.Generate());
                    if (generator.Errors.Any()) //Semantic erros
                        Errors.AddRange(generator.Errors);
                }
            }

            return compileUnits.ToArray();
        }