Boo.Lang.Parser.BooParsingStep.Run C# (CSharp) Метод

Run() публичный Метод

public Run ( ) : void
Результат void
        public void Run()
        {
            ParserErrorHandler errorHandler = new ParserErrorHandler(OnParserError);

            foreach (ICompilerInput input in _context.Parameters.Input)
            {
                try
                {
                    using (System.IO.TextReader reader = input.Open())
                    {
                        ParseModule(input.Name, reader, errorHandler);
                    }
                }
                catch (CompilerError error)
                {
                    _context.Errors.Add(error);
                }
                catch (antlr.TokenStreamRecognitionException x)
                {
                    OnParserError(x.recog);
                }
                catch (Exception x)
                {
                    _context.Errors.Add(CompilerErrorFactory.InputError(input.Name, x));
                }
            }
        }

Usage Example

        private void AddNamespaceImports(Import node)
        {
            RemoveCurrentNode();

            string url = GetFilePath(node);
            using(TextReader reader = urlResolver(url, baseDirectory))
            {
                BooParsingStep parser = new BooParsingStep();
                CompilerContext context = new CompilerContext();
                StringInput input = new StringInput(node.AssemblyReference.Name, reader.ReadToEnd());
                context.Parameters.Input.Add(input);
                parser.Initialize(context);
                parser.Run();
                Module current = (Module) node.GetAncestor(NodeType.Module);
                foreach (Module module in context.CompileUnit.Modules)
                {
                    foreach (Import import in module.Imports)
                    {
                        current.Imports.Add(import);
                    }
                }
            }
        }