Rubberduck.Parsing.VBA.RubberduckParser.Parse C# (CSharp) Method

Parse() public method

public Parse ( ) : void
return void
        public void Parse()
        {
            if (!_state.Projects.Any())
            {
                foreach (var project in _vbe.VBProjects.Cast<VBProject>())
                {
                    _state.AddProject(project);
                }
            }

            var projects = _state.Projects
                .Where(project => project.Protection == vbext_ProjectProtection.vbext_pp_none)
                .ToList();

            var components = projects.SelectMany(p => p.VBComponents.Cast<VBComponent>()).ToList();
            SyncComReferences(projects);

            foreach (var component in components)
            {
                _state.SetModuleState(component, ParserState.Pending);
            }

            // invalidation cleanup should go into ParseAsync?
            foreach (var invalidated in _componentAttributes.Keys.Except(components))
            {
                _componentAttributes.Remove(invalidated);
            }

            foreach (var vbComponent in components)
            {
                while (!_state.ClearDeclarations(vbComponent)) { }
                
                // expects synchronous parse :/
                ParseComponent(vbComponent);
            }
        }