Example #1
0
        public MessageCollection Load(string content, string fileName)
        {
            var parser = new Parser();

            CurrentFileSyntax = parser.ParseFile(content, out var errors);
            CurrentFileName   = fileName;

            Metadata.ResetSubrutines();
            var collector = new DefinitionCollector(Metadata);

            collector.Visit(CurrentFileSyntax);

            if (errors.Any())
            {
                return(errors);
            }

            var sanityAnalyzer = new SanityAnalyzer();

            return(sanityAnalyzer.Analyze(CurrentFileSyntax, Metadata));
        }
        public MessageCollection Load(string content, string fileName)
        {
            var parser = new Parser();
            var syntax = parser.ParseFile(content, out var errors);

            CurrentScript = new ScriptFile(fileName, content, syntax);
            interpreter   = new ThreadLocal <Interpreter>(()
                                                          => new Interpreter(Metadata, CurrentScript.FileName, debuggerServer.Create(), retrieveCancellationToken));

            Metadata.Reset();
            var collector = new DefinitionCollector(Metadata);

            collector.Visit(CurrentScript.Syntax);

            if (errors.Any())
            {
                return(errors);
            }

            var sanityAnalyzer = new SanityAnalyzer();

            return(sanityAnalyzer.Analyze(CurrentScript.Syntax, Metadata));
        }