コード例 #1
0
 public ComponentParseTask(VBComponent vbComponent, VBAPreprocessor preprocessor, IAttributeParser attributeParser, TokenStreamRewriter rewriter = null)
 {
     _attributeParser = attributeParser;
     _preprocessor = preprocessor;
     _component = vbComponent;
     _rewriter = rewriter;
     _qualifiedName = new QualifiedModuleName(vbComponent); 
 }
コード例 #2
0
        private void ParseAsyncInternal(VBComponent component, CancellationToken token, TokenStreamRewriter rewriter = null)
        {
            var preprocessor = new VBAPreprocessor(double.Parse(_vbe.Version, CultureInfo.InvariantCulture));
            var parser = new ComponentParseTask(component, preprocessor, _attributeParser, rewriter);
            parser.ParseFailure += (sender, e) => _state.SetModuleState(component, ParserState.Error, e.Cause as SyntaxErrorException);
            parser.ParseCompleted += (sender, e) =>
            {
                // possibly lock _state
                _state.SetModuleAttributes(component, e.Attributes);
                _state.AddParseTree(component, e.ParseTree);
                _state.AddTokenStream(component, e.Tokens);
                _state.SetModuleComments(component, e.Comments);
                _state.SetModuleAnnotations(component, e.Annotations);

                // This really needs to go last
                _state.SetModuleState(component, ParserState.Parsed);
            };
            _state.SetModuleState(component, ParserState.Parsing);
            parser.Start(token);
        }