public Start ( |
||
token | ||
return | void |
private void ParseAsyncInternal(VBComponent component, CancellationToken token, TokenStreamRewriter rewriter = null) { var preprocessor = _preprocessorFactory(); 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) => { lock (State) lock (component) { 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); }
private Task <ComponentParseTask.ParseCompletionArgs> FinishedParseComponentTask(QualifiedModuleName module, CancellationToken token, TokenStreamRewriter rewriter = null) { var tcs = new TaskCompletionSource <ComponentParseTask.ParseCompletionArgs>(); var preprocessor = _preprocessorFactory(); var parser = new ComponentParseTask(module, preprocessor, _attributeParser, _exporter, _state.ProjectsProvider, rewriter); parser.ParseFailure += (sender, e) => { if (e.Cause is OperationCanceledException) { tcs.SetCanceled(); } else { tcs.SetException(e.Cause); } }; parser.ParseCompleted += (sender, e) => { tcs.SetResult(e); }; parser.Start(token); return(tcs.Task); }
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); }
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); }