private void LogParseException(SyntaxErrorException exception, VBComponent component)
        {
            var offendingProject = component.Collection.Parent.Name;
            var offendingComponent = component.Name;
            var offendingLine = component.CodeModule.get_Lines(exception.LineNumber, 1);

            var message = string.Format("Parser encountered a syntax error in {0}.{1}, line {2}. Content: '{3}'", offendingProject, offendingComponent, exception.LineNumber, offendingLine);
            _logger.ErrorException(message, exception);
        }
        private void OnParserError(SyntaxErrorException exception, VBComponent component)
        {
            if (LogManager.IsLoggingEnabled())
            {
                LogParseException(exception, component);
            }

            var handler = ParserError;
            if (handler != null)
            {
                handler(this, new ParseErrorEventArgs(exception, component));
            }
        }
 public ParseErrorEventArgs(SyntaxErrorException exception, VBComponent component, ICodePaneWrapperFactory wrapperFactory)
 {
     _exception = exception;
     _component = component;
     _wrapperFactory = wrapperFactory;
 }
 public ParseErrorEventArgs(SyntaxErrorException exception, VBComponent component)
 {
     _exception = exception;
     _component = component;
 }
        public void SetModuleState(VBComponent component, ParserState state, SyntaxErrorException parserError = null)
        {
            if (AllUserDeclarations.Any())
            {
                var projectId = component.Collection.Parent.HelpFile;
                var project = AllUserDeclarations.SingleOrDefault(item =>
                    item.DeclarationType == DeclarationType.Project && item.ProjectId == projectId);

                if (project == null)
                {
                    // ghost component shouldn't even exist
                    ClearDeclarations(component);
                    Status = EvaluateParserState();
                    return;
                }
            }
            var key = new QualifiedModuleName(component);
            _moduleStates.AddOrUpdate(key, state, (c, s) => state);
            _moduleExceptions.AddOrUpdate(key, parserError, (c, e) => parserError);

            Debug.WriteLine("Module '{0}' state is changing to '{1}' (thread {2})", key.ComponentName, state, Thread.CurrentThread.ManagedThreadId);
            OnModuleStateChanged(component, state);

            Status = EvaluateParserState();
        }