-
Notifications
You must be signed in to change notification settings - Fork 295
/
VBComponentParseResult.cs
50 lines (41 loc) · 1.85 KB
/
VBComponentParseResult.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System.Collections.Generic;
using Antlr4.Runtime;
using Antlr4.Runtime.Tree;
using Microsoft.Vbe.Interop;
using Rubberduck.Parsing.Nodes;
using Rubberduck.Parsing.Symbols;
using Rubberduck.VBEditor;
using Rubberduck.VBEditor.VBEInterfaces.RubberduckCodePane;
namespace Rubberduck.Parsing
{
public class VBComponentParseResult
{
public VBComponentParseResult(VBComponent component, IParseTree parseTree, IEnumerable<CommentNode> comments, ITokenStream tokenStream, ICodePaneWrapperFactory wrapperFactory)
{
_component = component;
_qualifiedName = new QualifiedModuleName(component);
_parseTree = parseTree;
_comments = comments;
_tokenStream = tokenStream;
var listener = new DeclarationSymbolsListener(_qualifiedName, Accessibility.Implicit, _component.Type);
var walker = new ParseTreeWalker();
walker.Walk(listener, _parseTree);
_declarations.AddRange(listener.Declarations.Items);
}
private readonly List<Declaration> _declarations = new List<Declaration>();
public IEnumerable<Declaration> Declarations { get { return _declarations; } }
private readonly VBComponent _component;
public VBComponent Component { get { return _component; } }
private readonly QualifiedModuleName _qualifiedName;
public QualifiedModuleName QualifiedName { get { return _qualifiedName; } }
private IParseTree _parseTree;
public IParseTree ParseTree { get { return _parseTree; } }
private IEnumerable<CommentNode> _comments;
public IEnumerable<CommentNode> Comments { get { return _comments; } }
private readonly ITokenStream _tokenStream;
public TokenStreamRewriter GetRewriter()
{
return new TokenStreamRewriter(_tokenStream);
}
}
}