Skip to content

Commit a2fdffc

Browse files
committed
Merge branch 'next' of https://github.com/rubberduck-vba/Rubberduck into AddModuleCommand
# Conflicts: # Rubberduck.Core/Navigation/CodeExplorer/CodeExplorerViewModel.cs # Rubberduck.Core/Rubberduck.Core.csproj # Rubberduck.Core/UI/CodeExplorer/Commands/AddComponentCommand.cs # Rubberduck.Resources/CodeExplorer/CodeExplorerUI.Designer.cs # Rubberduck.Resources/CodeExplorer/CodeExplorerUI.resx
2 parents a04219f + dd6eae5 commit a2fdffc

File tree

1,204 files changed

+57171
-68207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,204 files changed

+57171
-68207
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*.sln.docstates
88
*.csproj.user
99
*.csproj.DotSettings
10+
launchSettings.json
1011

1112
# External NuGet Packages
1213
[Pp]ackages/
@@ -178,4 +179,7 @@ $RECYCLE.BIN/
178179
Installers/
179180
*.xlsx
180181

181-
CodeGraphData/
182+
CodeGraphData/
183+
/Rubberduck.Deployment/Properties/launchSettings.json
184+
/Rubberduck.Deployment/Rubberduck.API.idl
185+
/Rubberduck.Deployment/Rubberduck.idl

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<img src="https://user-images.githubusercontent.com/5751684/38372412-c3247d70-38bc-11e8-8eaa-2f2d19595a42.png" width=100% />
1+
<img src="https://user-images.githubusercontent.com/5751684/46327997-aeb98d00-c5d2-11e8-9de5-ba6f9cd1eea3.png" />
22

33
<!-- campaign is no longer accepting donations
44
### Donate!
@@ -18,7 +18,7 @@ If you like this project and would like to thank its contributors, you are welco
1818

1919
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/rubberduck-vba/Rubberduck.svg)](http://isitmaintained.com/project/rubberduck-vba/Rubberduck "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/rubberduck-vba/Rubberduck.svg)](http://isitmaintained.com/project/rubberduck-vba/Rubberduck "Percentage of issues still open")
2020

21-
> **[rubberduckvba.com](http://rubberduckvba.com)** [Wiki](https://github.com/retailcoder/Rubberduck/wiki) [Rubberduck News](https://rubberduckvba.wordpress.com/)
21+
> **[rubberduckvba.com](http://rubberduckvba.com)** [Wiki](https://github.com/rubberduck-vba/Rubberduck/wiki) [Rubberduck News](https://rubberduckvba.wordpress.com/)
2222
> devs@rubberduckvba.com
2323
> Follow [@rubberduckvba](https://twitter.com/rubberduckvba) on Twitter
2424
@@ -29,15 +29,14 @@ If you like this project and would like to thank its contributors, you are welco
2929
* [Installing](https://github.com/rubberduck-vba/Rubberduck/wiki/Installing)
3030
* [Getting Started](https://github.com/rubberduck-vba/Rubberduck/blob/next/docs/GettingStarted.md) using Rubberduck
3131
* [Contributing](https://github.com/rubberduck-vba/Rubberduck/blob/next/CONTRIBUTING.md)
32-
* [User Testimonials](https://github.com/rubberduck-vba/Rubberduck/blob/next/thanks.md)
3332

3433
---
3534

3635
## License
3736

3837
Rubberduck is a COM add-in for the VBA IDE (VBE).
3938

40-
Copyright (C) 2014-2018 Mathieu Guindon & Christopher McClellan
39+
Copyright (C) 2014-2018 Rubberduck project contributors
4140

4241
This program is free software: you can redistribute it and/or modify
4342
it under the terms of the GNU General Public License as published by
Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
using System.Reflection;
2-
using System.Runtime.CompilerServices;
1+
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43
using Rubberduck.Resources.Registration;
54

6-
// General Information about an assembly is controlled through the following
7-
// set of attributes. Change these attribute values to modify the information
8-
// associated with an assembly.
9-
[assembly: AssemblyTitle("Rubberduck.API")]
10-
[assembly: AssemblyDescription("Rubberduck Reflection API")]
11-
[assembly: AssemblyConfiguration("")]
12-
[assembly: AssemblyCompany("Rubberduck-VBA")]
13-
[assembly: AssemblyProduct("Rubberduck.API")]
14-
[assembly: AssemblyCopyright("Copyright © 2018")]
15-
[assembly: AssemblyCulture("en")]
16-
[assembly: AssemblyTrademark("")]
175
[assembly: InternalsVisibleTo("RubberduckTests")]
186

197
// Setting ComVisible to false makes the types in this assembly not visible
@@ -23,15 +11,3 @@
2311

2412
// The following GUID is for the ID of the typelib if this project is exposed to COM
2513
[assembly: Guid(RubberduckGuid.RubberduckApiTypeLibGuid)]
26-
27-
// Version information for an assembly consists of the following four values:
28-
//
29-
// Major Version
30-
// Minor Version
31-
// Build Number
32-
// Revision
33-
//
34-
// You can specify all the values or you can default the Build and Revision Numbers
35-
// by using the '*' as shown below:
36-
// [assembly: AssemblyVersion("1.0.*")]
37-
[assembly: AssemblyVersion("2.1.*")]

Rubberduck.API/Rubberduck.API.csproj

Lines changed: 14 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,24 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
2+
<Project Sdk="Sunburst.NET.Sdk.WPF/1.0.47">
43
<PropertyGroup>
5-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
4+
<Product>Rubberduck.API</Product>
5+
<Description>Rubberduck Reflection API</Description>
6+
<Copyright>Copyright © 2018</Copyright>
77
<ProjectGuid>{AC1B4A57-364A-4F90-A0CD-6EE818349CE5}</ProjectGuid>
8-
<OutputType>Library</OutputType>
9-
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>Rubberduck.API</RootNamespace>
11-
<AssemblyName>Rubberduck.API</AssemblyName>
12-
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
13-
<FileAlignment>512</FileAlignment>
14-
<TargetFrameworkProfile />
8+
<!--
9+
TODO: affix AssemblyVersion and/or FileVersion for COM-Registration?!
10+
-->
1511
</PropertyGroup>
16-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17-
<DebugSymbols>true</DebugSymbols>
18-
<DebugType>full</DebugType>
19-
<Optimize>false</Optimize>
20-
<OutputPath>bin\Debug\</OutputPath>
21-
<DefineConstants>DEBUG;TRACE</DefineConstants>
22-
<ErrorReport>prompt</ErrorReport>
23-
<WarningLevel>4</WarningLevel>
24-
</PropertyGroup>
25-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26-
<DebugType>pdbonly</DebugType>
27-
<Optimize>true</Optimize>
28-
<OutputPath>bin\Release\</OutputPath>
29-
<DefineConstants>TRACE</DefineConstants>
30-
<ErrorReport>prompt</ErrorReport>
31-
<WarningLevel>4</WarningLevel>
32-
</PropertyGroup>
33-
<ItemGroup>
34-
<Reference Include="System" />
35-
<Reference Include="System.Core" />
36-
<Reference Include="Microsoft.CSharp" />
37-
</ItemGroup>
38-
<ItemGroup>
39-
<Compile Include="VBA\ApiProvider.cs" />
40-
<Compile Include="VBA\Accessibility.cs" />
41-
<Compile Include="VBA\Declaration.cs" />
42-
<Compile Include="VBA\Declarations.cs" />
43-
<Compile Include="VBA\DeclarationType.cs" />
44-
<Compile Include="VBA\IdentifierReference.cs" />
45-
<Compile Include="VBA\IdentifierReferences.cs" />
46-
<Compile Include="VBA\Parser.cs" />
47-
<Compile Include="VBA\ParserState.cs" />
48-
<Compile Include="Properties\AssemblyInfo.cs" />
49-
</ItemGroup>
50-
<ItemGroup>
51-
<ProjectReference Include="..\Rubberduck.Core\Rubberduck.Core.csproj">
52-
<Project>{a1587eac-7b54-407e-853f-4c7493d0323e}</Project>
53-
<Name>Rubberduck.Core</Name>
54-
</ProjectReference>
55-
<ProjectReference Include="..\Rubberduck.Main\Rubberduck.Main.csproj">
56-
<Project>{E8AB5D93-2D0F-423D-BC15-5EE118673E48}</Project>
57-
<Name>Rubberduck.Main</Name>
58-
</ProjectReference>
59-
<ProjectReference Include="..\Rubberduck.Parsing\Rubberduck.Parsing.csproj">
60-
<Project>{a4a618e1-cbca-435f-9c6c-5181e030adfc}</Project>
61-
<Name>Rubberduck.Parsing</Name>
62-
</ProjectReference>
63-
<ProjectReference Include="..\Rubberduck.Resources\Rubberduck.Resources.csproj">
64-
<Project>{1b84b387-f7c4-4876-9bdf-c644c365359a}</Project>
65-
<Name>Rubberduck.Resources</Name>
66-
</ProjectReference>
67-
<ProjectReference Include="..\Rubberduck.VBEEditor\Rubberduck.VBEditor.csproj">
68-
<Project>{8ce35eb3-8852-4ba1-84dd-df3f5d2967b0}</Project>
69-
<Name>Rubberduck.VBEditor</Name>
70-
</ProjectReference>
71-
</ItemGroup>
12+
<Import Project="..\RubberduckBaseProject.csproj" />
13+
7214
<ItemGroup>
73-
<Folder Include="Plugin\" />
15+
<ProjectReference Include="..\Rubberduck.Core\Rubberduck.Core.csproj" />
16+
<ProjectReference Include="..\Rubberduck.Main\Rubberduck.Main.csproj" />
17+
<ProjectReference Include="..\Rubberduck.Parsing\Rubberduck.Parsing.csproj" />
18+
<ProjectReference Include="..\Rubberduck.Resources\Rubberduck.Resources.csproj" />
19+
<ProjectReference Include="..\Rubberduck.VBEEditor\Rubberduck.VBEditor.csproj" />
7420
</ItemGroup>
7521
<ItemGroup>
7622
<None Include="app.config" />
7723
</ItemGroup>
78-
<ItemGroup>
79-
<Analyzer Include="..\RubberduckCodeAnalysis\bin\Release\RubberduckCodeAnalysis.dll" />
80-
</ItemGroup>
81-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
8224
</Project>

Rubberduck.API/VBA/Parser.cs

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,27 @@
44
using System.Globalization;
55
using System.Linq;
66
using System.Runtime.InteropServices;
7-
using Rubberduck.Common;
7+
using System.Threading;
8+
using Rubberduck.Parsing.ComReflection;
89
using Rubberduck.Parsing.PreProcessing;
10+
using Rubberduck.Parsing.Rewriter;
911
using Rubberduck.Parsing.Symbols.DeclarationLoaders;
1012
using Rubberduck.Parsing.VBA;
11-
using Rubberduck.Parsing.Symbols;
1213
using Rubberduck.Parsing.UIContext;
14+
using Rubberduck.Parsing.VBA.ComReferenceLoading;
15+
using Rubberduck.Parsing.VBA.DeclarationCaching;
16+
using Rubberduck.Parsing.VBA.DeclarationResolving;
17+
using Rubberduck.Parsing.VBA.Parsing;
18+
using Rubberduck.Parsing.VBA.Parsing.ParsingExceptions;
19+
using Rubberduck.Parsing.VBA.ReferenceManagement;
1320
using Rubberduck.Resources.Registration;
1421
using Rubberduck.VBEditor.ComManagement;
1522
using Rubberduck.VBEditor.Events;
1623
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
1724
using Rubberduck.VBEditor.Utility;
1825
using Rubberduck.Root;
26+
using Rubberduck.VBEditor.ComManagement.TypeLibs;
27+
using Rubberduck.VBEditor.SourceCodeHandling;
1928

2029
namespace Rubberduck.API.VBA
2130
{
@@ -59,16 +68,17 @@ public interface IParserEvents
5968
public sealed class Parser : IParser, IDisposable
6069
{
6170
private RubberduckParserState _state;
62-
private AttributeParser _attributeParser;
63-
private ParseCoordinator _parser;
71+
private SynchronousParseCoordinator _parser;
6472
private IVBE _vbe;
6573
private IVBEEvents _vbeEvents;
6674
private readonly IUiDispatcher _dispatcher;
75+
private readonly CancellationTokenSource _tokenSource;
6776

6877
internal Parser()
6978
{
7079
UiContextProvider.Initialize();
7180
_dispatcher = new UiDispatcher(UiContextProvider.Instance());
81+
_tokenSource = new CancellationTokenSource();
7282
}
7383

7484
// vbe is the com coclass interface from the interop assembly.
@@ -86,17 +96,26 @@ internal Parser(object vbe) : this()
8696
var projectRepository = new ProjectsRepository(_vbe);
8797
_state = new RubberduckParserState(_vbe, projectRepository, declarationFinderFactory, _vbeEvents);
8898
_state.StateChanged += _state_StateChanged;
89-
90-
var sourceCodeHandler = _vbe.SourceCodeHandler;
91-
92-
IVBAPreprocessor preprocessorFactory() => new VBAPreprocessor(double.Parse(_vbe.Version, CultureInfo.InvariantCulture));
93-
_attributeParser = new AttributeParser(sourceCodeHandler, preprocessorFactory, _state.ProjectsProvider);
99+
var vbeVersion = double.Parse(_vbe.Version, CultureInfo.InvariantCulture);
100+
var predefinedCompilationConstants = new VBAPredefinedCompilationConstants(vbeVersion);
101+
var typeLibProvider = new TypeLibWrapperProvider(projectRepository);
102+
var compilationArgumentsProvider = new CompilationArgumentsProvider(typeLibProvider, _dispatcher, predefinedCompilationConstants);
103+
var compilationsArgumentsCache = new CompilationArgumentsCache(compilationArgumentsProvider);
104+
var preprocessorErrorListenerFactory = new PreprocessingParseErrorListenerFactory();
105+
var preprocessorParser = new VBAPreprocessorParser(preprocessorErrorListenerFactory, preprocessorErrorListenerFactory);
106+
var preprocessor = new VBAPreprocessor(preprocessorParser, compilationsArgumentsCache);
107+
var mainParseErrorListenerFactory = new MainParseErrorListenerFactory();
108+
var mainTokenStreamParser = new VBATokenStreamParser(mainParseErrorListenerFactory, mainParseErrorListenerFactory);
109+
var tokenStreamProvider = new SimpleVBAModuleTokenStreamProvider();
110+
var stringParser = new TokenStreamParserStringParserAdapterWithPreprocessing(tokenStreamProvider, mainTokenStreamParser, preprocessor);
94111
var projectManager = new RepositoryProjectManager(projectRepository);
95112
var moduleToModuleReferenceManager = new ModuleToModuleReferenceManager();
96113
var parserStateManager = new ParserStateManager(_state);
97114
var referenceRemover = new ReferenceRemover(_state, moduleToModuleReferenceManager);
98115
var supertypeClearer = new SupertypeClearer(_state);
99-
var comSynchronizer = new COMReferenceSynchronizer(_state, parserStateManager);
116+
var comLibraryProvider = new ComLibraryProvider();
117+
var referencedDeclarationsCollector = new LibraryReferencedDeclarationsCollector(comLibraryProvider);
118+
var comSynchronizer = new COMReferenceSynchronizer(_state, parserStateManager, projectRepository, referencedDeclarationsCollector);
100119
var builtInDeclarationLoader = new BuiltInDeclarationLoader(
101120
_state,
102121
new List<ICustomDeclarationLoader>
@@ -108,12 +127,17 @@ internal Parser(object vbe) : this()
108127
//new RubberduckApiDeclarations(_state)
109128
}
110129
);
130+
var codePaneSourceCodeHandler = new CodePaneSourceCodeHandler(projectRepository);
131+
var sourceFileHandler = _vbe.TempSourceFileHandler;
132+
var attributesSourceCodeHandler = new SourceFileHandlerSourceCodeHandlerAdapter(sourceFileHandler, projectRepository);
133+
var moduleParser = new ModuleParser(
134+
codePaneSourceCodeHandler,
135+
attributesSourceCodeHandler,
136+
stringParser);
111137
var parseRunner = new ParseRunner(
112138
_state,
113139
parserStateManager,
114-
preprocessorFactory,
115-
_attributeParser,
116-
sourceCodeHandler);
140+
moduleParser);
117141
var declarationResolveRunner = new DeclarationResolveRunner(
118142
_state,
119143
parserStateManager,
@@ -134,25 +158,25 @@ internal Parser(object vbe) : this()
134158
_state,
135159
moduleToModuleReferenceManager,
136160
referenceRemover,
137-
supertypeClearer
161+
supertypeClearer,
162+
compilationsArgumentsCache
138163
);
139164

140-
_parser = new ParseCoordinator(
165+
_parser = new SynchronousParseCoordinator(
141166
_state,
142167
parsingStageService,
143168
parsingCacheService,
144169
projectManager,
145170
parserStateManager
146171
);
147172
}
148-
173+
149174
/// <summary>
150175
/// Blocking call, for easier unit-test code
151176
/// </summary>
152177
public void Parse()
153178
{
154-
// blocking call
155-
_parser.Parse(new System.Threading.CancellationTokenSource());
179+
_parser.Parse(_tokenSource);
156180
}
157181

158182
/// <summary>
@@ -163,7 +187,7 @@ public void BeginParse()
163187
// non-blocking call
164188
_dispatcher.Invoke(() => _state.OnParseRequested(this));
165189
}
166-
190+
167191
public delegate void OnStateChangedDelegate(ParserState ParserState);
168192
public event OnStateChangedDelegate OnStateChanged;
169193

Rubberduck.CodeAnalysis/CodeMetrics/CodeMetricBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Collections.Generic;
22
using Rubberduck.Parsing.Grammar;
33
using Rubberduck.Parsing.Symbols;
4+
using Rubberduck.Parsing.VBA.DeclarationCaching;
45
using Rubberduck.VBEditor;
56

67
namespace Rubberduck.CodeAnalysis.CodeMetrics

Rubberduck.CodeAnalysis/CodeMetrics/CodeMetricsAnalyst.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Rubberduck.VBEditor;
55
using System.Collections.Generic;
66
using System.Linq;
7+
using Rubberduck.Parsing.VBA.DeclarationCaching;
78

89
namespace Rubberduck.CodeAnalysis.CodeMetrics
910
{

0 commit comments

Comments
 (0)