• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Package.ParseRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.VisualStudio.Package.ParseRequest的典型用法代码示例。如果您正苦于以下问题:C# ParseRequest类的具体用法?C# ParseRequest怎么用?C# ParseRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParseRequest类属于Microsoft.VisualStudio.Package命名空间,在下文中一共展示了ParseRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ParseSource

		}//OnIdle
		
		public override AuthoringScope ParseSource( ParseRequest req )
		{
			var dirty = (req.DirtySpan.iStartLine != req.DirtySpan.iEndLine) || (req.DirtySpan.iStartIndex != req.DirtySpan.iEndIndex);
			BeeSource src = null;
			if( (dirty || (req.Reason == ParseReason.None)) || (req.Reason == ParseReason.Check) )
			{
				src = ((BeeSource)GetSource( req.FileName ));
				try
				{
				}
				catch( ParseError err )
				{
					req.Sink.AddError( req.FileName, err.Message, new TextSpan() {
						iStartLine = err.Lnum,
						iStartIndex = err.At,
						iEndLine = err.Lnum,
						iEndIndex = err.End
					}, Severity.Fatal );
				}
				catch
				{
				}
			}
			return new BeeScope( src );
		}//ParseSource
开发者ID:firda-cze,项目名称:bee,代码行数:27,代码来源:service.cs


示例2: ParseSource

        public override Microsoft.VisualStudio.Package.AuthoringScope ParseSource(ParseRequest req)
        {
            Babel.Source source = (Babel.Source)this.GetSource(req.FileName);
            bool yyparseResult = false;

            // req.DirtySpan seems to be set even though no changes have occurred
            // source.IsDirty also behaves strangely
            // might be possible to use source.ChangeCount to sync instead

            if (req.DirtySpan.iStartIndex != req.DirtySpan.iEndIndex
                || req.DirtySpan.iStartLine != req.DirtySpan.iEndLine) {
                ErrorHandler handler = new ErrorHandler();
                Scanner scanner = new Scanner(); // string interface
                Parser parser = new Parser();  // use noarg constructor
                parser.scanner = scanner;
                scanner.Handler = handler;
                parser.SetHandler(handler);
                scanner.SetSource(req.Text, 0);

                parser.MBWInit(req);
                yyparseResult = parser.Parse();

                // store the parse results
                // source.ParseResult = aast;
                source.ParseResult = null;
                source.Braces = parser.Braces;

                // for the time being, just pull errors back from the error handler
                if (handler.ErrNum > 0) {
                    foreach (Babel.Parser.Error error in handler.SortedErrorList()) {
                        TextSpan span = new TextSpan();
                        span.iStartLine = span.iEndLine = error.line - 1;
                        span.iStartIndex = error.column;
                        span.iEndIndex = error.column + error.length;
                        req.Sink.AddError(req.FileName, error.message, span, Severity.Error);
                    }
                }
            }
            switch (req.Reason) {
                case ParseReason.Check:
                case ParseReason.HighlightBraces:
                case ParseReason.MatchBraces:
                case ParseReason.MemberSelectAndHighlightBraces:
                    // send matches to sink
                    // this should (probably?) be filtered on req.Line / col
                    if (source.Braces != null) {
                        foreach (TextSpan[] brace in source.Braces) {
                            if (brace.Length == 2)
                                req.Sink.MatchPair(brace[0], brace[1], 1);
                            else if (brace.Length >= 3)
                                req.Sink.MatchTriple(brace[0], brace[1], brace[2], 1);
                        }
                    }
                    break;
                default:
                    break;
            }

            return new AuthoringScope(req.Text);
        }
开发者ID:einaregilsson,项目名称:Process-Language-Runtime,代码行数:60,代码来源:CCSLanguage.cs


示例3: ParseRequestWrapper

 public override Microsoft.VisualStudio.Package.AuthoringScope ParseSource
     (ParseRequest request)
 {
     var wrapper = new ParseRequestWrapper(request);
     wrapper.Scanning();
     return new AuthoringScopeWrapper();
 }
开发者ID:hahoyer,项目名称:reni.cs,代码行数:7,代码来源:ReniService.cs


示例4: BooScope

 public BooScope(CompiledProject compiledProject, BooSource source, ParseRequest parseRequest, ParseRequestProcessor parseRequestProcessor)
 {
     this.source = source;
     declarations = new DeclarationFinder(compiledProject, source, parseRequest.FileName);
     this.parseRequest = parseRequest;
     this.parseRequestProcessor = parseRequestProcessor;
 }
开发者ID:jagregory,项目名称:boolangstudio,代码行数:7,代码来源:BooScope.cs


示例5: NSAuthoringScope

 public NSAuthoringScope(ParseRequest req, string dirtyFile, string project)
     : base()
 {
     m_sink = req.Sink;
     m_projectfile = project;
     m_dirtyname = dirtyFile;
     m_filename = req.FileName;
 }
开发者ID:jianboqi,项目名称:NimStudio,代码行数:8,代码来源:NSAuthoringScope.cs


示例6: ParseSource

        public override AuthoringScope ParseSource(ParseRequest req)
        {
            SassParser parser = new SassParser();
            Source source = (Source)this.GetSource(req.FileName);

            if (req.Sink.BraceMatching)
            {
                if (req.Reason == ParseReason.MatchBraces)
                {
                    foreach (TextSpan[] brace in parser.Braces)
                    {
                        req.Sink.MatchPair(brace[0], brace[1], 1);
                    }
                }
            }
            return new SassParserAuthoringScope();
        }
开发者ID:solostyle,项目名称:sassToolForVisualStudio,代码行数:17,代码来源:SassLanguageService.cs


示例7: ParseSource

        public override AuthoringScope ParseSource(ParseRequest req)
        {
            if (req == null)
            {
                return null;
            }

            var scope = new CQLAuthoringScope();
            req.Scope = scope;

            if (req.Reason == ParseReason.Check)
            {
            }

            if (m_scanner != null && req.Reason == ParseReason.MemberSelect || req.Reason == ParseReason.MemberSelectAndHighlightBraces && req.TokenInfo != null)
            {
                var token = m_scanner.GetToken(req.TokenInfo.Token);

                if (token != null)
                {
                    if (token.Type == 4) // [
                    {
                        scope.AddDeclaration(new CQLDeclaration("Encounter", 0, "An encounter with the patient"));
                        scope.AddDeclaration(new CQLDeclaration("Procedure", 0, "A procedure"));
                        scope.AddDeclaration(new CQLDeclaration("Medication", 0, "A medication"));
                    }

                    if (token.Type == 3) // ,
                    {
                        scope.AddDeclaration(new CQLDeclaration("Performed", 0, "An action performed"));
                        scope.AddDeclaration(new CQLDeclaration("Proposed", 0, "An action performed"));
                        scope.AddDeclaration(new CQLDeclaration("Ordered", 0, "An action performed"));
                    }

                    if (token.Type == 5) // :
                    {
                        scope.AddDeclaration(new CQLDeclaration("\"Inpatient\"", 0, "Inpatient encounter"));
                        scope.AddDeclaration(new CQLDeclaration("\"Outpatient\"", 0, "Outpatient encounter"));
                        scope.AddDeclaration(new CQLDeclaration("\"Face-to-face Interaction\"", 0, "Face-to-face interaction"));
                    }
                }
            }

            return scope;
        }
开发者ID:krondor,项目名称:clinical_quality_language,代码行数:45,代码来源:CQLLanguageService.cs


示例8: CreateScopeTest

        public void CreateScopeTest()
        {
            Assert.IsNull(ConsoleAuthoringScope.CreateScope(null));

            ParseRequest request = new ParseRequest(false);

            request.Reason = ParseReason.None;
            Assert.IsNull(ConsoleAuthoringScope.CreateScope(request));

            request.Reason = ParseReason.MemberSelect;
            Assert.IsNotNull(ConsoleAuthoringScope.CreateScope(request));

            request.Reason = ParseReason.HighlightBraces;
            Assert.IsNull(ConsoleAuthoringScope.CreateScope(request));

            request.Reason = ParseReason.MemberSelectAndHighlightBraces;
            Assert.IsNull(ConsoleAuthoringScope.CreateScope(request));

            request.Reason = ParseReason.MatchBraces;
            Assert.IsNull(ConsoleAuthoringScope.CreateScope(request));

            request.Reason = ParseReason.Check;
            Assert.IsNull(ConsoleAuthoringScope.CreateScope(request));

            request.Reason = ParseReason.CompleteWord;
            Assert.IsNotNull(ConsoleAuthoringScope.CreateScope(request));

            request.Reason = ParseReason.DisplayMemberList;
            Assert.IsNotNull(ConsoleAuthoringScope.CreateScope(request));

            request.Reason = ParseReason.QuickInfo;
            Assert.IsNull(ConsoleAuthoringScope.CreateScope(request));

            request.Reason = ParseReason.MethodTip;
            Assert.IsNull(ConsoleAuthoringScope.CreateScope(request));

            request.Reason = ParseReason.Autos;
            Assert.IsNull(ConsoleAuthoringScope.CreateScope(request));

            request.Reason = ParseReason.CodeSpan;
            Assert.IsNull(ConsoleAuthoringScope.CreateScope(request));

            request.Reason = ParseReason.Goto;
            Assert.IsNull(ConsoleAuthoringScope.CreateScope(request));
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:45,代码来源:AuthoringScopeTest.cs


示例9: ParseSource

 public override AuthoringScope ParseSource(ParseRequest req)
 {
     XSharpAuthoringScope scope = new XSharpAuthoringScope();
     if (req.Reason == ParseReason.Check ||
         req.Reason == ParseReason.None)
     {
         // Parse the entire source as given in req.Text. Store results in the XSharpAuthoringScope object.
     }
     else if (req.Reason == ParseReason.DisplayMemberList)
     {
         // Parse the line specified in req.Line for the two tokens just before req.Col to get the identifier and the member connector symbol. 
         // Find members of the identifer in the parse tree and store the list of members in the Declarations class.
     }
     else if (req.Reason == ParseReason.MethodTip)
     {
         // Parse the line specified in req.Line for the token just before req.Col to obtain the name of the method. 
         // Find all method signatures with the same name in the existing parse tree and store the list of signatures in the Methods class.
     }
     // continue for the rest of the supported ParseReason values.
     return scope;
 }
开发者ID:X-Sharp,项目名称:XSharpPublic,代码行数:21,代码来源:XSharpLanguageService.cs


示例10: ParseSource

        public override AuthoringScope ParseSource(ParseRequest req)
        {
            Core.FStarParser parser = new Core.FStarParser();
            var result = new TestAuthoringScope();
            var tokens = new List<TokenInfo>();
            if (req.Sink.BraceMatching || ParseReason.MatchBraces == req.Reason || ParseReason.HighlightBraces == req.Reason)
            {
                var scanner = GetScanner(null);
                scanner.SetSource(req.Text, 0);
                var line = 0;
                var col = 0;
                req.View.GetCaretPos(out line, out col);
                (scanner as VisualFStar.Core.FStarScanner).MatchPair(req.Sink, req.Text, line, col);

            }
            else parser.Parse(req);
            if (ParseReason.Check == req.Reason)
            {
                Console.WriteLine("!!!!");
            }
            return result;
        }
开发者ID:YaccConstructor,项目名称:VisualFStar,代码行数:22,代码来源:FStarLanguageService.cs


示例11: TriggerParse

 /// <summary>
 /// Triggers the parse.
 /// </summary>
 /// <param name="request">The request.</param>
 /// <param name="yyresult">if set to <c>true</c> [yyresult].</param>
 /// <returns></returns>
 private static LuaParser TriggerParse(ParseRequest request, out bool yyresult)
 {
     LuaParser parser = CreateParser(request);
     yyresult = parser.Parse();
     return parser;
 }
开发者ID:jda808,项目名称:NPL,代码行数:12,代码来源:LanguageService.cs


示例12: GetLastWord

        /// <summary>
        /// Gets the last word.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        private static string GetLastWord(ParseRequest request)
        {
            string line;
            request.View.GetTextStream(request.Line, 0, request.Line, request.TokenInfo.EndIndex, out line);

            if (line != null)
            {
                // Find the delimiter before the last word
                int lastDelimiterIndex = line.LastIndexOfAny(lastWordDelimiters);

                // Get the last word before the caret
                return lastDelimiterIndex != -1 ? line.Substring(lastDelimiterIndex + 1) : line;
            }

            return String.Empty;
        }
开发者ID:jda808,项目名称:NPL,代码行数:21,代码来源:LanguageService.cs


示例13: CreateParser

        /// <summary>
        /// Creates the parser.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        private static LuaParser CreateParser(ParseRequest request)
        {
            // Create ErrorHandler for scanner
            var handler = new ParaEngine.Tools.Lua.Parser.ErrorHandler();

            // Create scanner and parser
            LuaScanner scanner = new ParaEngine.Tools.Lua.Lexer.Scanner();
            LuaParser parser = new LuaParser();

            // Set the error handler for the scanner
            scanner.Handler = handler;

            // Associate the scanner with the parser
            parser.scanner = scanner;

            // Initialize with the request (can be null)
            parser.Request = request;

            // If the parser is created for a request, automatically set the source from the request
            if (request != null)
                scanner.SetSource(request.Text, 0);

            // Return the parser
            return parser;
        }
开发者ID:jda808,项目名称:NPL,代码行数:30,代码来源:LanguageService.cs


示例14: ParseSource

        /// <summary>
        /// Processes a Parse request.
        /// </summary>
        /// <param name="request">The request to process.</param>
        /// <returns>An AuthoringScope containing the declarations and other information.</returns>
        public override Microsoft.VisualStudio.Package.AuthoringScope ParseSource(ParseRequest request)
        {
            Trace.WriteLine(request.Reason);
            authoringScope.Clear();

            if (request.ShouldParse())
            {
                // Make sure we are processing hidden regions
                request.Sink.ProcessHiddenRegions = true;

                // Create a parser for the request, and execute parsing...
                bool successfulParse;
                LuaParser parser = TriggerParse(request, out successfulParse);
                InitializeFileCodeModel(parser.Chunk);

                if (successfulParse)
                {
                    RefreshDeclarationsForRequest(request, parser, true);
                }

                if (request.NeedsDeclarations())
                {
                    AddDeclarationProvidersToScope(request);

                    if (request.NeedsQualifiedName())
                    {
                        authoringScope.SetQualifiedName(GetLastWord(request));
                    }
                }
            }
            else
            {
                if(request.Reason == ParseReason.QuickInfo)
                {
                    // TODO: mouse over a text to display some info.
                }
            }

            // Return authoring scope
            return authoringScope;
        }
开发者ID:jda808,项目名称:NPL,代码行数:46,代码来源:LanguageService.cs


示例15: HandleParseResponse

    internal void HandleParseResponse(ParseRequest req) {

      try {
        ReportErrors(req.Sink.Errors);
      } catch (Exception e) {
        CCITracing.Trace("HandleParseResponse exception: " + e.Message);
      }

    }
开发者ID:hesam,项目名称:SketchSharp,代码行数:9,代码来源:Source.cs


示例16: HandleMethodTipResponse

    internal void HandleMethodTipResponse(ParseRequest req) {

      try {
        CallInfo call = req.Sink.MethodCalls.GetCurrentMethodCall();
        if (call == null) goto fail;
        IdentifierList names = call.names;
        if (names.Length == 0) goto fail;

        Identifier name = names[names.Length-1];
        SourceContext ctx = name.SourceContext;
        Methods methods = req.Scope.GetMethods(ctx.StartLine-1, ctx.StartColumn-1, name);
        if (methods == null)
            goto fail;

        TextSpan span = new TextSpan();
        span.iStartLine = ctx.StartLine-1;
        span.iStartIndex = ctx.StartColumn-1;
        span.iEndLine = ctx.EndLine-1;
        span.iEndIndex = ctx.EndColumn-1;

        int currentParameter = call.currentParameter;
        this.methodData.Refresh(req.View, methods, currentParameter, span );
        return;

      fail:
        DismissMethodTip();        

      } catch (Exception e) {
        CCITracing.Trace("HandleMethodTipResponse exception: " + e.Message);
      }
    }    
开发者ID:hesam,项目名称:SketchSharp,代码行数:31,代码来源:Source.cs


示例17: ParseSource

 /// <summary>
 /// This method parses the source code based on the specified ParseRequest object.
 /// We don't need implement any logic here.
 /// </summary>
 /// <param name="req">The <see cref="ParseRequest"/> describes how to parse the source file.</param>
 /// <returns>If successful, returns an <see cref="AuthoringScope"/> object; otherwise, returns a null value.</returns>
 public override AuthoringScope ParseSource(ParseRequest req)
 {
     throw new NotImplementedException();
 }
开发者ID:roffster,项目名称:SpecFlow,代码行数:10,代码来源:RegExLangServ.cs


示例18: AddStaticDeclarationProvidersToScope

        /// <summary>
        /// Adds the static declaration providers to scope.
        /// </summary>
        /// <param name="request">The request.</param>
        private void AddStaticDeclarationProvidersToScope(ParseRequest request)
        {
            if (request.Reason == ParseReason.CompleteWord)
            {
                authoringScope.AddProvider(keywordDeclarationProvider);
                authoringScope.AddProvider(snippetDeclarationProvider);
            }

            authoringScope.AddProvider(xmlDeclarationProvider);
        }
开发者ID:jda808,项目名称:NPL,代码行数:14,代码来源:LanguageService.cs


示例19: AddDeclarationProvidersToScope

 /// <summary>
 /// Adds the declaration providers to scope.
 /// </summary>
 /// <param name="request">The request.</param>
 private void AddDeclarationProvidersToScope(ParseRequest request)
 {
     AddStaticDeclarationProvidersToScope(request);
     AddDynamicDeclarationProvidersToScope(request);
 }
开发者ID:jda808,项目名称:NPL,代码行数:9,代码来源:LanguageService.cs


示例20: AddDynamicDeclarationProvidersToScope

 /// <summary>
 /// Adds the dynamic declaration providers to scope.
 /// </summary>
 /// <param name="request">The request.</param>
 private void AddDynamicDeclarationProvidersToScope(ParseRequest request)
 {
     AddTableProvidersFromDictionary(luaFileDeclarationProviders);
     AddTableProvidersFromDictionary(frameXmlDeclarationProviders);
 }
开发者ID:jda808,项目名称:NPL,代码行数:9,代码来源:LanguageService.cs



注:本文中的Microsoft.VisualStudio.Package.ParseRequest类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Package.ProjectElement类代码示例发布时间:2022-05-26
下一篇:
C# Package.HierarchyNode类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap