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

ParseAll() private method

Starts parsing all components of all unprotected VBProjects associated with the VBE-Instance passed to the constructor of this parser instance.
private ParseAll ( ) : void
return void
        private void ParseAll()
        {
            var projects = _state.Projects
                // accessing the code of a protected VBComponent throws a COMException:
                .Where(project => project.Protection == vbext_ProjectProtection.vbext_pp_none)
                .ToList();

            var components = projects.SelectMany(p => p.VBComponents.Cast<VBComponent>()).ToList();
            var modified = components.Where(_state.IsModified).ToList();
            var unchanged = components.Where(c => !_state.IsModified(c)).ToList();

            SyncComReferences(projects);

            if (!modified.Any())
            {
                return;
            }

            foreach (var component in modified)
            {
                _state.SetModuleState(component, ParserState.Pending);
            }
            foreach (var component in unchanged)
            {
                _state.SetModuleState(component, ParserState.Parsed);
            }

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

            foreach (var vbComponent in modified)
            {
                ParseAsync(vbComponent, CancellationToken.None);
            }
        }